Method, device, electronic device and storage medium for determining camera external parameters inside a vehicle
By setting a camera on the steering wheel column of the vehicle, the characteristics of the target interior points are used to automatically construct the camera's external parameter relationship, which solves the problem of complex camera external parameter determination operations in the existing technology and achieves automated and highly accurate camera external parameters. Sure.
Patent Information
- Application Number
- CN202411118585.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-08-15
AI Technical Summary
The existing technology has high operational requirements when re-determining the camera's external parameters in the vehicle intelligent system, requiring the user to meet the usage standards of the calibration board, which complicates the operation.
By setting a camera on the column of the vehicle steering wheel, using the center point coordinates and perimeter of the target interior point in the first video frame, a rotation matrix and a translation matrix relationship between the reference camera coordinate system and the current camera coordinate system are constructed to automatically determine the camera External reference, avoid artificial involvement.
It reduces the operational requirements when re-determining the camera's external parameters, realizes automated determination of the camera's external parameters, and improves the ease of use and accuracy of the system.
Smart Images

Figure CN118644560B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for determining external parameters of a camera inside a vehicle. Background Art
[0002] For smart vehicles with gesture control functions, the eye tracking function can be used to determine the controllable components in the vehicle that the user currently wants to control, and then the gesture recognition function can be used to recognize the user's current gesture, and then the controllable components can be controlled. In the process of using the eye tracking function to determine the controllable components, it is necessary to convert each controllable component from the world coordinate system to the camera coordinate system, so as to determine the corresponding controllable component according to the gaze coordinates of the user's line of sight in the camera coordinate system. In the process of converting each controllable component from the world coordinate system to the camera coordinate system, it is necessary to use camera extrinsics for conversion.
[0003] When the camera moves, the camera extrinsic parameters need to be re-determined, otherwise the determined controllable components will be inaccurate or the controllable components cannot be determined. Currently, when redetermining the camera extrinsic parameters, a calibration board is required. During this process, the user's operation is required to meet the usage standards of the calibration board, which leads to relatively high operational requirements when using the calibration board to redetermine the camera extrinsic parameters. Summary of the invention
[0004] In view of this, embodiments of the present application provide a method, device, electronic device, and storage medium for determining camera extrinsic parameters inside a vehicle, so as to reduce the operational requirements when redetermining the camera extrinsic parameters.
[0005] In a first aspect, an embodiment of the present application provides a method for determining an external parameter of a camera inside a vehicle, wherein a camera is disposed on a column of a steering wheel of the vehicle, and the method comprises:
[0006] When a trigger condition for re-determining the camera extrinsic parameters of the camera is met, determining the center point coordinates and the perimeter of a figure formed by at least one target interior point in the first video frame according to the first video frame captured by the camera, wherein when the number of the target interior point is one, the center point coordinates are the pixel coordinates of the target interior point, and the perimeter is the horizontal coordinate of the target interior point;
[0007] According to a first linear relationship between the center point coordinates and the RT matrix, a second linear relationship between the perimeter and the RT matrix, and a third linear relationship between the center point coordinates and the perimeter, a first transformation relationship between a first rotation matrix for representing the conversion of a reference camera coordinate system to a current camera coordinate system and a target interior point element and a second transformation relationship between a first translation matrix for representing the conversion of a reference camera coordinate system to a current camera coordinate system and the target interior point element are constructed, wherein the target interior point element includes the center point coordinates and the perimeter, and the RT matrix is composed of a rotation matrix and a translation matrix;
[0008] According to the M matrix, the N matrix, the first transformation relationship and the second transformation relationship, the first rotation matrix and the first translation matrix are determined to use the first rotation matrix and the first translation matrix as camera extrinsics of the camera, wherein the M matrix is a second translation matrix when transferring specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system, and the N matrix is a second rotation matrix when transferring the specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system.
[0009] Optionally, determining the center point coordinates and the perimeter of a figure formed by at least one target interior decoration point in the first video frame according to the first video frame captured by the camera includes:
[0010] Inputting the first video frame into a trained interior decoration point positioning model to obtain pixel coordinates of at least one target interior decoration point;
[0011] According to the pixel coordinates of at least one of the target interior decoration points, the center point coordinates and the perimeter of the figure formed by at least one of the target interior decoration points are determined.
[0012] Optionally, the method further comprises:
[0013] Acquire a plurality of first videos captured by the camera during the movement of the pipe string;
[0014] The interior decoration point positioning model to be trained is trained using each second video frame annotated in the first video to obtain the trained interior decoration point positioning model, wherein when annotating each second video frame, the target interior decoration points in each second video frame are annotated.
[0015] Optionally, the moving range of the pipe string is less than or equal to the area formed by the maximum stroke that the pipe string can reach when moving up and down and telescopically.
[0016] Optionally, each of the first videos includes a plurality of sub-videos shot at a plurality of discrete positions within the moving range.
[0017] Optionally, when moving the tubular column, it starts from a vertex of the trapezoid formed by the area and ends at a vertex on the side opposite to the side where the vertex is located. During the movement, it moves in an S shape. During the S-shaped movement, the distance between the peak and trough of the S shape and the maximum stroke that the tubular column can reach is less than a preset distance.
[0018] Optionally, different first videos are shot under different lighting environments.
[0019] Optionally, the target interior decoration point includes a position in the second video frame where a pixel difference is greater than a preset pixel difference and / or an acute angle point formed by two edges in the second video frame.
[0020] Optionally, the number of target interior points marked in any of the second video frames is equal to the number of target interior points determined in the first video frame.
[0021] Optionally, the trigger condition includes at least one of the following:
[0022] When the vehicle is started, when the position of the steering wheel moves, when the redetermination cycle of the camera external parameters is reached, and when the driving speed of the vehicle is greater than a preset speed.
[0023] Optionally, the method further comprises:
[0024] Determining a first position of a controllable component in the vehicle in the camera coordinate system according to the camera extrinsic parameter;
[0025] When a facial image of a user is captured by the camera, a second position of the user's sight line in the camera coordinate system is determined by using sight line positioning;
[0026] A target position overlapping with the second position is determined from the first position.
[0027] In a second aspect, an embodiment of the present application provides a device for determining an external parameter of a camera inside a vehicle, the device comprising:
[0028] a first determination unit, for determining, when a trigger condition for re-determining a camera extrinsic parameter of a camera is met, a center point coordinate and a perimeter of a figure formed by at least one target interior point in a first video frame captured by the camera, wherein when the number of the target interior point is one, the center point coordinate is a pixel coordinate of the target interior point, and the perimeter is a horizontal coordinate of the target interior point, wherein the camera is disposed on a column of a steering wheel of a vehicle;
[0029] A construction unit, configured to construct a first transformation relationship for representing a relationship between a first rotation matrix for representing a conversion from a reference camera coordinate system to a current camera coordinate system and a target interior point element, and a second transformation relationship for representing a relationship between a first translation matrix for representing a conversion from a reference camera coordinate system to a current camera coordinate system and the target interior point element, based on a first linear relationship for representing the center point coordinates and an RT matrix, a second linear relationship for representing the perimeter and the RT matrix, and a third linear relationship for representing the center point coordinates and the perimeter, wherein the target interior point element includes the center point coordinates and the perimeter, and the RT matrix is composed of a rotation matrix and a translation matrix;
[0030] A second determination unit is used to determine the first rotation matrix and the first translation matrix according to the M matrix, the N matrix, the first transformation relationship and the second transformation relationship, so as to use the first rotation matrix and the first translation matrix as camera extrinsics of the camera, wherein the M matrix is a second translation matrix when transferring specified pixel points in the first video frame captured by the camera at a current position to the reference camera coordinate system, and the N matrix is a second rotation matrix when transferring the specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system.
[0031] Optionally, the first determining unit is used to determine, according to the first video frame captured by the camera, the coordinates of the center point and the perimeter of the figure formed by at least one target interior point in the first video frame, including:
[0032] Inputting the first video frame into a trained interior decoration point positioning model to obtain pixel coordinates of at least one target interior decoration point;
[0033] According to the pixel coordinates of at least one of the target interior decoration points, the center point coordinates and the perimeter of the figure formed by at least one of the target interior decoration points are determined.
[0034] Optionally, the device further comprises:
[0035] An acquisition unit, used for acquiring a plurality of first videos captured by the camera during the movement of the pipe string;
[0036] A training unit is used to train the interior decoration point positioning model to be trained using each second video frame annotated in the first video to obtain the trained interior decoration point positioning model, wherein when annotating each second video frame, the target interior decoration points in each second video frame are annotated.
[0037] Optionally, the moving range of the pipe string is less than or equal to the area formed by the maximum stroke that the pipe string can reach when moving up and down and telescopically.
[0038] Optionally, each of the first videos includes a plurality of sub-videos shot at a plurality of discrete positions within the moving range.
[0039] Optionally, when moving the tubular column, it starts from a vertex of the trapezoid formed by the area and ends at a vertex on the side opposite to the side where the vertex is located. During the movement, it moves in an S shape. During the S-shaped movement, the distance between the peak and trough of the S shape and the maximum stroke that the tubular column can reach is less than a preset distance.
[0040] Optionally, different first videos are shot under different lighting environments.
[0041] Optionally, the target interior decoration point includes a position in the second video frame where a pixel difference is greater than a preset pixel difference and / or an acute angle point formed by two edges in the second video frame.
[0042] Optionally, the number of target interior points marked in any of the second video frames is equal to the number of target interior points determined in the first video frame.
[0043] Optionally, the trigger condition includes at least one of the following:
[0044] When the vehicle is started, when the position of the steering wheel moves, when the redetermination cycle of the camera external parameters is reached, and when the driving speed of the vehicle is greater than a preset speed.
[0045] Optionally, the device further comprises:
[0046] A third determining unit, configured to determine a first position of a controllable component in the vehicle in the camera coordinate system according to the camera extrinsic parameter;
[0047] a positioning unit, configured to determine a second position of the user's line of sight in the camera coordinate system by using line of sight positioning when the camera captures a facial image of the user;
[0048] A fourth determining unit is used to determine a target position overlapping with the second position from the first position.
[0049] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for determining the external parameters of a camera inside a vehicle as described in any one of the first aspects above.
[0050] In a fourth aspect, an embodiment of the present application provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for determining the external parameters of a camera inside a vehicle as described in any one of the first aspects above.
[0051] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0052] In the present application, when it is necessary to redetermine the camera external parameters, a first video frame is obtained by shooting with a camera arranged on a column of a vehicle steering wheel, and the center point coordinates and the perimeter of a figure formed by at least one target interior point in the first video frame are determined. Then, based on a first linear relationship between the center point coordinates and an RT matrix, a second linear relationship between the perimeter and the RT matrix, and a third linear relationship between the center point coordinates and the perimeter, a first transformation relationship between a first rotation matrix representing the conversion of a reference camera coordinate system to a current camera coordinate system and target interior point elements and a second transformation relationship between a first translation matrix representing the conversion of a reference camera coordinate system to a current camera coordinate system and the target interior point elements are constructed. Finally, based on the M matrix, the N matrix, the first transformation relationship, and the second transformation relationship, the first rotation matrix and the first translation matrix are determined so as to use the first rotation matrix and the first translation matrix as camera external parameters of the camera. The camera external parameters can be automatically determined by the above method without manual intervention, which is conducive to reducing the operation requirements when determining the camera external parameters.
[0053] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 A schematic diagram of a camera setting position provided in an embodiment of the present application;
[0056] Figure 2 A schematic flow chart of a method for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application;
[0057] Figure 3A schematic diagram of the conversion relationship of camera extrinsic parameters provided in an embodiment of the present application;
[0058] Figure 4 A schematic flow chart of another method for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application;
[0059] Figure 5 A schematic flow chart of another method for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application;
[0060] Figure 6 A schematic diagram of a pipe string movement range provided in an embodiment of the present application;
[0061] Figure 7 A schematic flow chart of another method for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application;
[0062] Figure 8 A schematic diagram of the structure of a device for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application;
[0063] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0065] Point in world coordinate system is a point in three-dimensional space, usually represented by ,in , and are the x, y, and z coordinates of the point in the world coordinate system.
[0066] The origin of the world coordinate system (usually denoted by ) is the reference point of this coordinate system, usually defined as . The position of the origin and the direction of the world coordinate system are defined by the user or system designer according to the specific application scenario. The definition of the world coordinate system can be arbitrary, but usually a reference point that is easy to describe and calculate is selected as the origin. For example: in indoor scenes, the origin of the world coordinate system may be defined in a corner or center of the room; in robot navigation, the origin may be defined at the initial position of the robot; in photogrammetry, the origin may be defined at the position of a known landmark; in short, the definition of the world coordinate system is relative and depends on the specific application requirements and scenarios. Choosing a suitable origin and coordinate system direction can simplify calculations and descriptions.
[0067] The camera coordinate system is a three-dimensional coordinate system with the optical center of the camera (i.e., the center of the camera lens) as the origin, which is used to describe the world seen by the camera. In the camera coordinate system, the horizontal axis of the camera image is usually taken as the X-axis, with the right direction as the positive direction, the horizontal and vertical axis of the camera image is taken as the Y-axis, with the downward direction as the positive direction, and the optical axis direction of the camera (the direction from the optical center of the camera to the object) is perpendicular to the camera image plane, the optical axis direction is the Z-axis, and the direction from the optical center of the camera to the object is the positive direction.
[0068] Camera extrinsics are parameters that describe the position and attitude of the camera in the world coordinate system. They define the transformation relationship from the world coordinate system to the camera coordinate system, usually including rotation matrix and translation matrix.
[0069] Rotation matrix (R): This is a A matrix that describes the rotation relationship between the camera coordinate system and the world coordinate system. The rotation matrix can rotate a point in the world coordinate system to the camera coordinate system.
[0070] Translation Matrix (T): This is a A matrix that describes the translation relationship between the camera coordinate system and the world coordinate system. The translation matrix can translate points in the world coordinate system to the camera coordinate system.
[0071] The role of the camera extrinsic parameter is to transform the point in the world coordinate system Transform the point into the camera coordinate system . The conversion relationship can be expressed as: , in order to facilitate calculation, we usually construct a matrix: , the matrix is the RT matrix, so the above conversion relationship can also be expressed as: .
[0072] In summary, a point in the world coordinate system can be transformed into the camera coordinate system through the RT matrix. This RT matrix is also called the camera extrinsic parameter.
[0073] The following is a detailed description of this application.
[0074] Figure 1 A schematic diagram of a camera setting position provided in an embodiment of the present application, such as Figure 1 As shown, a camera is arranged on the column of the steering wheel of the vehicle, and the position of the user in the camera coordinate system is determined by using the image captured by the camera and the tracking technology.
[0075] Figure 2 A flow chart of a method for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method comprises the following steps:
[0076] Step 201. When the trigger condition for redetermining the camera extrinsic parameters of the camera is met, determine the center point coordinates and perimeter of a figure formed by at least one target interior point in the first video frame according to the first video frame captured by the camera, wherein when the number of the target interior point is one, the center point coordinates are the pixel coordinates of the target interior point, and the perimeter is the horizontal coordinate of the target interior point.
[0077] Step 202, based on the first linear relationship between the center point coordinates and the RT matrix, the second linear relationship between the circumference and the RT matrix, and the third linear relationship between the center point coordinates and the circumference, construct a first transformation relationship between a first rotation matrix for representing the transformation of a reference camera coordinate system to a current camera coordinate system and a target interior point element, and a second transformation relationship between a first translation matrix for representing the transformation of a reference camera coordinate system to a current camera coordinate system and the target interior point element, wherein the target interior point element includes the center point coordinates and the circumference, and the RT matrix is composed of a rotation matrix and a translation matrix.
[0078] Step 203, determine the first rotation matrix and the first translation matrix according to the M matrix, the N matrix, the first transformation relationship and the second transformation relationship, so as to use the first rotation matrix and the first translation matrix as camera extrinsics of the camera, wherein the M matrix is a second translation matrix when transferring specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system, and the N matrix is a second rotation matrix when transferring the specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system.
[0079] Specifically, when the position of the camera moves, or other reasons (such as reaching the determination cycle of the camera extrinsic parameters) cause the need to redetermine the camera extrinsic parameters, the camera can be used to shoot the vehicle's cab to obtain a first video frame containing the cab scene, and then the center point coordinates and the perimeter of the figure formed by the target interior points are determined according to the pixel coordinates of the target interior points in the first video frame. For example, when the number of target interior points is one, the center point coordinates are the pixel coordinates of the target interior point, and the perimeter is the horizontal coordinate of the target interior point. When the number of target interior points is two, the target interior point constitutes The figure formed is a straight line, the center point coordinates are the midpoint of the straight line, and the perimeter is the length of the straight line. When the number of target interior decoration points is three and they are not on a straight line, the figure formed by the target interior decoration points is a triangle. The X value of the center point coordinates is determined by the average value of the X-axis pixel coordinates of the three vertices of the triangle, and the Y value of the center point coordinates is determined by the average value of the Y-axis pixel coordinates of the three vertices of the triangle, so as to obtain the center point coordinates. The perimeter of the triangle can be obtained by using the pixel coordinates of the three vertices of the triangle, and so on. The center point coordinates and perimeter of the figure formed by other numbers of target interior decoration points can be obtained.
[0080] Figure 3 A schematic diagram of the conversion relationship of a camera extrinsic parameter provided in an embodiment of the present application is shown in FIG. Figure 3 As shown in the figure, the vehicle has its reference camera coordinate system calibrated before leaving the factory. Therefore, the RT matrix for converting the world coordinate system to the reference camera coordinate system is known, which can be called the RT1 matrix. When the camera position changes, the current camera coordinate system is generated. When the RT2 matrix for converting the reference camera coordinate system to the current camera coordinate system is known, the camera extrinsics for converting from the world coordinate system to the current camera coordinate system can be obtained through the RT1 matrix and the RT2 matrix.
[0081] When calculating the RT2 matrix, if there is a calibration plate coordinate system of the calibration plate, after knowing the reference camera coordinate system and the current camera coordinate system, the RT3 matrix converted from the reference camera coordinate system to the calibration plate coordinate system and the RT4 matrix converted from the calibration plate coordinate system to the current camera coordinate system can be obtained, so that the RT2 matrix can be obtained based on the RT3 matrix and the RT4 matrix.
[0082] It is impossible for the calibration plate to always exist in the vehicle, and the role of the calibration plate is actually equivalent to that of a fixed point. Therefore, other fixed objects can be used to replace the calibration plate. Since the interior points in the vehicle will not change, the interior points can be used to replace the calibration plate to obtain the RT2 matrix.
[0083] Since the baseline camera coordinate system and the interior points will not change with the camera, the relationship between the two will not change when the camera position changes, but the relationship between the interior points and the current camera coordinate system will change. Therefore, the RT2 matrix can be obtained through the conversion relationship between the baseline camera coordinate system and the interior points (fixed), and the conversion relationship between the interior points and the current camera coordinate system (changing). In this conversion process, it can be found that the conversion relationship between the interior points and the current camera coordinate system is a linear relationship. At the same time, since the relationship between the pixel coordinates of the target interior points and the coordinate system where the interior points are located is unchanged, the conversion relationship between the interior points and the current camera coordinate system and the pixel coordinates of the target interior points can also form a linear relationship. The pixel coordinates of the target interior points can be used to obtain the center point and perimeter of the figure formed by the target interior points. Therefore, the center point coordinates and perimeter of the figure formed by the target interior points are consistent with the interior points and the current camera coordinate system. The conversion relationship between the machine coordinate systems also has a linear relationship. According to this linear relationship, the linear relationship between the center point coordinates of the figure composed of the target interior points and the RT2 matrix can be obtained, that is: the first linear relationship. The linear relationship between the perimeter of the figure composed of the target interior points and the RT2 matrix, that is: the second linear relationship. At the same time, the linear relationship between the center point coordinates and the perimeter of the figure composed of the target interior points can be obtained according to the analysis of different numbers of target interior points, that is: the third linear relationship. Therefore, after obtaining the center point coordinates and the perimeter of the figure composed of the target interior points corresponding to the first video frame captured by the camera at the current position, according to the above three linear relationships, a first transformation relationship for representing the relationship between the first rotation matrix converted from the base camera coordinate system to the current camera coordinate system and the target interior point elements can be constructed, as well as a second transformation relationship for representing the relationship between the first translation matrix converted from the base camera coordinate system to the current camera coordinate system and the target interior point elements.
[0084] Then, based on the pre-obtained M matrix used to characterize the transfer of specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system, and the M matrix used to characterize the transfer of the specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system, the above four data can be used to calculate the accurate first rotation matrix and first translation matrix, which can constitute the above-mentioned camera extrinsic parameters.
[0085] Through the above method, the camera extrinsic parameters can be obtained without using a calibration plate, and the above method can automatically determine the camera extrinsic parameters without manual intervention, which is beneficial to reducing the operation requirements when determining the camera extrinsic parameters.
[0086] The derivation process of the M matrix and the N matrix is as follows:
[0087] Through observation, the equation is modeled, and the relationship between RT (here represents the RT2 matrix) and y (the coordinates of the center point of the figure formed by the target interior points) and s (the perimeter of the figure formed by the target interior points) is: , after simplification , where A, B, C, and D represent the required coefficients.
[0088] Calculation:
[0089] ;
[0090] R can be represented by a quaternion, namely:
[0091] ;
[0092] After transformation, we get:
[0093] ;
[0094] in, is the matrix M.
[0095] Calculation:
[0096] ;
[0097] T is a 3x1 matrix, so we can get the following formula:
[0098] ;
[0099] Converting to matrix multiplication yields:
[0100] ;
[0101] in, Can be used as an N matrix.
[0102] By collecting different video frames, we can get multiple groups of corresponding data of y, s and RT. By formulating equations for n groups of y, s and R, T respectively, we can get the equation group about M matrix and the equation group about N matrix. Then, we use the least squares method to solve the n groups of data to get the usable M matrix and N matrix.
[0103] After obtaining the usable M matrix and N matrix, the camera extrinsic parameters can be obtained as long as the center point coordinates and the perimeter of the figure formed by the target interior points are obtained.
[0104] In one possible embodiment, Figure 4A flow chart of another method for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application is shown as follows: Figure 4 As shown, when executing step 201, it can be implemented by the following steps:
[0105] Step 401: input the first video frame into a trained interior decoration point positioning model to obtain pixel coordinates of at least one target interior decoration point.
[0106] Step 402: Determine the center point coordinates and the perimeter of a figure formed by at least one of the target interior points according to the pixel coordinates of at least one of the target interior points.
[0107] Specifically, after the interior decoration point positioning model is trained, the target interior decoration point in the input first video frame can be quickly positioned to determine the pixel coordinates of the target interior decoration point, thereby obtaining the corresponding center point coordinates and circumference, and then quickly obtaining the above-mentioned first rotation matrix and first translation matrix.
[0108] In one possible embodiment, Figure 5 A flow chart of another method for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application is shown as follows: Figure 5 As shown in the figure, when training the interior point positioning model, the following steps are performed:
[0109] Step 501: Acquire a plurality of first videos captured by the camera during the movement of the pipe string.
[0110] Step 502: Use each second video frame annotated in the first video to train the interior decoration point positioning model to be trained to obtain the trained interior decoration point positioning model, wherein when annotating each second video frame, the target interior decoration points in each second video frame are annotated.
[0111] Specifically, since the interior point positioning model is used to identify the pixel coordinates of interior points in the vehicle after training, in order to make the trained interior point positioning model have better results, the video frames in the first video captured by the camera set on the column can be used as samples for training. Since the samples used are real images inside the vehicle, the recognition accuracy of the interior point positioning model trained in this way is higher. In order to make the sample more comprehensive, the camera can be used to shoot the interior of the vehicle at different angles by moving the column.
[0112] It should be noted that the specific interior decoration point positioning model, the training method of the interior decoration point positioning model, and the movement method of the column can be set according to actual needs and are not specifically limited here.
[0113] In a feasible embodiment, during the process of moving the pipe string, the moving range of the pipe string is less than or equal to the area formed by the maximum stroke that the pipe string can reach when moving up and down and telescopically.
[0114] Specifically, Figure 6 A schematic diagram of the movement range of a column provided in an embodiment of the present application, wherein the column of the steering wheel can be adjusted telescopically, as well as up and down, such as Figure 6 As shown, the adjustment range of the column is Figure 6 The rectangular area formed by the four points A, B, C, and D, that is, the rectangular area is the area formed by the maximum stroke of the column. Since the camera is set on the column, the column will move with the camera when it moves. Therefore, the moving range of the column is the moving range of the camera. In other words, the camera can be set at any position in the above rectangular area by adjusting the column. Furthermore, the moving range of the camera is less than or equal to the above rectangular area. When the camera moves in the above rectangular area, the camera can shoot the interior of the vehicle at different angles as much as possible, so that the obtained samples are more diversified, which is conducive to improving the accuracy of the pixel coordinates of the target interior points of the trained interior point positioning model.
[0115] In a feasible implementation manner, each of the first videos includes a plurality of sub-videos shot at a plurality of discrete positions within the moving range.
[0116] Specifically, in order to ensure the diversity of samples, Figure 6 Sub-videos are shot at multiple positions within the rectangular range shown.
[0117] In a feasible embodiment, when moving the tubular column, it starts from a vertex of the trapezoid formed by the area and ends at a vertex on the side opposite to the side where the vertex is located. During the movement, it moves in an S shape. During the S-shaped movement, the distance between the crest and trough of the S shape and the maximum stroke that the tubular column can reach is less than a preset distance.
[0118] Specifically, in order to ensure the diversity of samples, Figure 6 As shown in the figure, you can start from any of the four vertices A, B, C, and D and move along an S-shaped path. Figure 6 Move within the rectangular range shown until it moves to the low point corresponding to the starting fixed vertex. During the movement, the distance between the S-shaped peaks and troughs and the AD side or the BC side is less than the preset distance, or the AD side and the BC side are the boundaries of the S-shaped peaks and troughs, or the AB side and the CD side are the boundaries of the S-shaped peaks and troughs.
[0119] It should be noted that the width of the crest or trough during the movement can be set according to actual needs and is not specifically limited here.
[0120] In a feasible implementation manner, different first videos are shot under different lighting environments.
[0121] Specifically, in order to ensure the diversity of samples, multiple first videos can be shot under different lighting environments. For example, when shooting the first video, multiple first videos can be shot in the morning, noon, afternoon, and evening respectively. This ensures that the lighting environments of the samples being trained are different, which is beneficial to improving the results of model training.
[0122] In a feasible implementation manner, the target interior decoration point includes a position in the second video frame where a pixel difference is greater than a preset pixel difference and / or an acute angle point formed by two edges in the second video frame.
[0123] Specifically, when marking the target interior decoration points, the boundaries of different materials are selected. The positions where the color steps can be clearly seen from the imaging are used as the target interior decoration points. Corner points can also be selected, that is, the points are located at the intersection of two edges. Sharp corners are given priority. The characteristics of such target interior decoration points are relatively obvious, which is conducive to the success rate of recognition.
[0124] In a feasible implementation manner, the number of target interior points marked in any second video frame is equal to the number of target interior points determined in the first video frame.
[0125] Specifically, when marking the target interior points in the second video frame, the number and position of the markings are based on actual needs. The number and position of the marked interior points in different second video frames are the same. After using such second video frames to train the interior point positioning model, the interior point positioning model can identify all interior points, thereby facilitating subsequent processing.
[0126] In a feasible implementation scheme, the trigger condition includes at least one of the following:
[0127] When the vehicle is started, when the position of the steering wheel moves, when the redetermination cycle of the camera external parameters is reached, and when the driving speed of the vehicle is greater than a preset speed.
[0128] Specifically, when the vehicle is started, the speed of the vehicle changes from 0 to moving, or when the vehicle switches from a stationary state to a moving state, the position of the camera may move, and at this time, the camera parameter 2 needs to be re-determined; or when the position of the steering wheel moves, when the redetermination cycle of the camera extrinsic parameter is reached, or when the driving speed of the vehicle is greater than the preset speed (that is, after the vehicle starts running), in order to ensure the accuracy of tracking the user's line of sight, the camera extrinsic parameter 2 needs to be re-determined.
[0129] When judging whether the position of the steering wheel has moved, since the camera in the present application can be used to track the user's line of sight, the camera will continuously shoot video during the use of the vehicle, and two video frames separated by a preset time in the continuous video can be compared, for example: the pixel coordinates of a certain interior point are compared to determine whether the steering wheel has moved; or when the vehicle is turned on, the last image frame taken before the vehicle is turned on and the first image frame taken after the vehicle is turned on are compared, for example: the pixel coordinates of a certain interior point are compared to determine whether the steering wheel has moved.
[0130] In one possible embodiment, Figure 7 A flow chart of another method for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application is shown as follows: Figure 7 As shown, after determining the camera external parameters, the following steps are also included:
[0131] Step 701: Determine a first position of a controllable component in the vehicle in the camera coordinate system based on the camera extrinsic parameters.
[0132] Step 702: When the camera captures a facial image of the user, use line of sight positioning to determine a second position of the user's line of sight in the camera coordinate system.
[0133] Step 703: Determine a target position overlapping with the second position from the first position.
[0134] Specifically, after determining the camera extrinsic parameters corresponding to the current camera position, the position of the controllable components in the vehicle in the camera coordinate system can be determined. After determining the position of the user's line of sight in the current camera coordinate system using line of sight positioning, it can be determined which controllable component the user is currently looking at, thereby allowing the user to perform gesture control on the controllable component.
[0135] It should be noted that the controllable components include: vehicle screen, sunroof, vehicle player, vehicle camera, cabin lights and other components in the vehicle that can be controlled by control controls.
[0136] Figure 8A schematic diagram of a structure of a device for determining external parameters of a camera inside a vehicle provided in an embodiment of the present application, such as Figure 8 As shown, the device comprises:
[0137] A first determination unit 81 is used to determine, when a trigger condition for re-determining the camera extrinsic parameter of the camera is met, the center point coordinates and the perimeter of a figure formed by at least one target interior point in the first video frame captured by the camera, wherein when the number of the target interior point is one, the center point coordinates are the pixel coordinates of the target interior point, and the perimeter is the horizontal coordinate of the target interior point, wherein the camera is arranged on a column of a steering wheel of a vehicle;
[0138] A construction unit 82 is used to construct a first transformation relationship for representing the relationship between a first rotation matrix for representing the conversion of a reference camera coordinate system to a current camera coordinate system and a target interior point element, and a second transformation relationship for representing the relationship between a first translation matrix for representing the conversion of a reference camera coordinate system to a current camera coordinate system and the target interior point element, based on a first linear relationship for representing the center point coordinates and an RT matrix, a second linear relationship for representing the perimeter and the RT matrix, and a third linear relationship for representing the center point coordinates and the perimeter, wherein the target interior point element includes the center point coordinates and the perimeter, and the RT matrix is composed of a rotation matrix and a translation matrix;
[0139] The second determination unit 83 is used to determine the first rotation matrix and the first translation matrix according to the M matrix, the N matrix, the first transformation relationship and the second transformation relationship, so as to use the first rotation matrix and the first translation matrix as camera extrinsics of the camera, wherein the M matrix is the second translation matrix when transferring the specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system, and the N matrix is the second rotation matrix when transferring the specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system.
[0140] In a feasible implementation manner, the first determining unit 81 is used to determine the center point coordinates and the perimeter of the figure formed by at least one target interior point in the first video frame according to the first video frame captured by the camera, including:
[0141] Inputting the first video frame into a trained interior decoration point positioning model to obtain pixel coordinates of at least one target interior decoration point;
[0142] According to the pixel coordinates of at least one of the target interior decoration points, the center point coordinates and the perimeter of the figure formed by at least one of the target interior decoration points are determined.
[0143] In a feasible embodiment, the device further comprises:
[0144] An acquisition unit, used for acquiring a plurality of first videos captured by the camera during the movement of the pipe string;
[0145] A training unit is used to train the interior decoration point positioning model to be trained using each second video frame annotated in the first video to obtain the trained interior decoration point positioning model, wherein when annotating each second video frame, the target interior decoration points in each second video frame are annotated.
[0146] In a feasible embodiment, the moving range of the pipe string is less than or equal to the area formed by the maximum stroke that the pipe string can reach when moving up and down and telescopically.
[0147] In a feasible implementation manner, each of the first videos includes a plurality of sub-videos shot at a plurality of discrete positions within the moving range.
[0148] In a feasible embodiment, when moving the tubular column, it starts from a vertex of the trapezoid formed by the area and ends at a vertex on the side opposite to the side where the vertex is located. During the movement, it moves in an S shape. During the S-shaped movement, the distance between the crest and trough of the S shape and the maximum stroke that the tubular column can reach is less than a preset distance.
[0149] In a feasible implementation manner, different first videos are shot under different lighting environments.
[0150] In a feasible implementation manner, the target interior decoration point includes a position in the second video frame where a pixel difference is greater than a preset pixel difference and / or an acute angle point formed by two edges in the second video frame.
[0151] In a feasible implementation manner, the number of target interior points marked in any second video frame is equal to the number of target interior points determined in the first video frame.
[0152] In a feasible implementation scheme, the trigger condition includes at least one of the following:
[0153] When the vehicle is started, when the position of the steering wheel moves, when the redetermination cycle of the camera external parameters is reached, and when the driving speed of the vehicle is greater than a preset speed.
[0154] In a feasible embodiment, the device further comprises:
[0155] A third determining unit, configured to determine a first position of a controllable component in the vehicle in the camera coordinate system according to the camera extrinsic parameter;
[0156] a positioning unit, configured to determine a second position of the user's line of sight in the camera coordinate system by using line of sight positioning when the camera captures a facial image of the user;
[0157] A fourth determining unit is used to determine a target position overlapping with the second position from the first position.
[0158] For the relevant description of the device for determining the external parameters of the camera inside the vehicle, please refer to the relevant explanation of the method for determining the external parameters of the camera inside the vehicle, which will not be described in detail here.
[0159] Fig. 9 A structural diagram of an electronic device provided in an embodiment of the present application includes: a processor 901, a storage medium 902 and a bus 903, wherein the storage medium 902 stores machine-readable instructions executable by the processor 901. When the electronic device runs a method for determining an external parameter of a camera inside a vehicle as in the embodiment, the processor 901 communicates with the storage medium 902 via the bus 903, and the processor 901 executes the machine-readable instructions to perform the steps in the embodiment.
[0160] In an embodiment, the storage medium 902 may also execute other machine-readable instructions to execute other methods described in the embodiment. For specific execution method steps and principles, please refer to the description of the embodiment, which will not be repeated here.
[0161] Embodiment 4 of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps shown in the above embodiment are executed.
[0162] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0164] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0165] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0166] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.
[0167] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for determining the external parameters of a camera inside a vehicle, characterized in that: A camera is arranged on a column of a steering wheel of a vehicle, and the method comprises: When a trigger condition for re-determining the camera extrinsic parameters of the camera is met, determining the center point coordinates and the perimeter of a figure formed by at least one target interior point in the first video frame according to the first video frame captured by the camera, wherein when the number of the target interior point is one, the center point coordinates are the pixel coordinates of the target interior point, and the perimeter is the horizontal coordinate of the target interior point; According to a first linear relationship between the center point coordinates and the RT matrix, a second linear relationship between the perimeter and the RT matrix, and a third linear relationship between the center point coordinates and the perimeter, a first transformation relationship between a first rotation matrix for representing the relationship between a reference camera coordinate system converted to a current camera coordinate system and a target interior point element and a second transformation relationship between a first translation matrix for representing the relationship between a reference camera coordinate system converted to a current camera coordinate system and the target interior point element are constructed, wherein the target interior point element includes the center point coordinates and the perimeter, the RT matrix is composed of a rotation matrix and a translation matrix, and the RT matrix is the RT matrix when the interior point is converted to the current camera coordinate system; According to the M matrix, the N matrix, the first transformation relationship and the second transformation relationship, the first rotation matrix and the first translation matrix are determined to use the first rotation matrix and the first translation matrix as camera extrinsics of the camera, wherein the M matrix is a second translation matrix when transferring specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system, and the N matrix is a second rotation matrix when transferring the specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system.
2. The method according to claim 1, characterized in that The determining, according to the first video frame captured by the camera, the center point coordinates and the perimeter of a figure formed by at least one target interior decoration point in the first video frame comprises: Inputting the first video frame into a trained interior decoration point positioning model to obtain pixel coordinates of at least one target interior decoration point; According to the pixel coordinates of at least one of the target interior decoration points, the center point coordinates and the perimeter of the figure formed by at least one of the target interior decoration points are determined.
3. The method according to claim 2, characterized in that The method further comprises: Acquire a plurality of first videos captured by the camera during the movement of the pipe string; The interior decoration point positioning model to be trained is trained using each second video frame annotated in the first video to obtain the trained interior decoration point positioning model, wherein when annotating each second video frame, the target interior decoration points in each second video frame are annotated.
4. The method according to claim 3, characterized in that The moving range of the pipe column is less than or equal to the area formed by the maximum stroke that the pipe column can reach when moving up and down and telescopically.
5. The method according to claim 4, characterized in that Each of the first videos includes a plurality of sub-videos shot at a plurality of discrete positions within the movement range.
6. The method according to claim 4, characterized in that When moving the tubular column, it starts from a vertex of the trapezoid formed by the area and ends at a vertex on the side opposite to the side where the vertex is located. During the movement, it moves in an S shape. During the S-shaped movement, the distance between the crest and trough of the S shape and the maximum stroke that the tubular column can reach is less than a preset distance.
7. The method according to claim 3, characterized in that Different first videos are shot under different lighting environments.
8. The method according to claim 3, characterized in that The target interior decoration point includes a position in the second video frame where a pixel difference is greater than a preset pixel difference and / or an acute angle point formed by two edges in the second video frame.
9. The method according to claim 3, characterized in that The number of target interior points marked in any of the second video frames is equal to the number of target interior points determined in the first video frame.
10. The method according to claim 1, characterized in that The triggering condition includes at least one of the following: When the vehicle is started, when the position of the steering wheel moves, when the redetermination cycle of the camera external parameters is reached, and when the driving speed of the vehicle is greater than a preset speed.
11. The method according to claim 1, characterized in that The method further comprises: Determining a first position of a controllable component in the vehicle in the camera coordinate system according to the camera extrinsic parameter; When a facial image of a user is captured by the camera, a second position of the user's sight line in the camera coordinate system is determined by using sight line positioning; A target position overlapping with the second position is determined from the first position.
12. A device for determining external parameters of a camera inside a vehicle, characterized in that: The device comprises: a first determination unit, for determining, when a trigger condition for re-determining a camera extrinsic parameter of a camera is met, a center point coordinate and a perimeter of a figure formed by at least one target interior point in a first video frame captured by the camera, wherein when the number of the target interior point is one, the center point coordinate is a pixel coordinate of the target interior point, and the perimeter is a horizontal coordinate of the target interior point, wherein the camera is disposed on a column of a steering wheel of a vehicle; A construction unit, for constructing a first transformation relationship for representing the relationship between a first rotation matrix for representing the transformation from a reference camera coordinate system to a current camera coordinate system and a target interior point element, and a second transformation relationship for representing the relationship between a first translation matrix for representing the transformation from a reference camera coordinate system to a current camera coordinate system and the target interior point element, based on a first linear relationship for representing the center point coordinates and an RT matrix, a second linear relationship for representing the perimeter and the RT matrix, and a third linear relationship for representing the center point coordinates and the perimeter, wherein the target interior point element includes the center point coordinates and the perimeter, the RT matrix is composed of a rotation matrix and a translation matrix, and the RT matrix is the RT matrix when the interior point is transformed to the current camera coordinate system; A second determination unit is used to determine the first rotation matrix and the first translation matrix according to the M matrix, the N matrix, the first transformation relationship and the second transformation relationship, so as to use the first rotation matrix and the first translation matrix as camera extrinsics of the camera, wherein the M matrix is a second translation matrix when transferring specified pixel points in the first video frame captured by the camera at a current position to the reference camera coordinate system, and the N matrix is a second rotation matrix when transferring the specified pixel points in the first video frame captured by the camera at the current position to the reference camera coordinate system.
13. An electronic device, characterized in that: It includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for determining the external parameters of a camera inside a vehicle according to any one of claims 1 to 11.
14. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt the processor to implement the method for determining the external parameters of a camera inside a vehicle according to any one of claims 1 to 11.
