A method and device for obtaining a reference image of a speckle structured light system

By adjusting the camera posture and position and using the speckle projector to obtain a reference map of a specified depth, the problem in the existing technology that posture and position errors affect the accuracy of the depth map is solved, and higher depth map estimation accuracy is achieved.

CN112529967BActive Publication Date: 2024-09-27TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011521808.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-21
Publication Date
2024-09-27
Estimated Expiration
2040-12-21

AI Technical Summary

Technical Problem

In the existing technology, depth map estimation methods based on monocular cameras and speckle projections have attitude errors and position errors when obtaining reference images, which affect the accuracy of the depth map.

Method used

By using the camera parameters, the coordinates of each corner point on the camera calibration plate and the coordinates on the camera calibration plate image, the attitude and position of the camera are adjusted to make it parallel to the reference plane, and the speckle projector is used to project the speckle pattern to obtain the specified depth. reference picture.

Benefits of technology

It improves the accuracy of the depth map, reduces the attitude and position errors, ensures the parallelism between the camera imaging plane and the reference plane, and enhances the accuracy of the depth map generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112529967B
    Figure CN112529967B
Patent Text Reader

Abstract

The present application provides a method and device for obtaining a reference image of a speckle structured light system, the method comprising: determining the relative posture and relative position of the camera relative to the camera calibration plate according to camera parameters, coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and coordinates of each corner point on the camera calibration plate image; adjusting the current posture and current position of the camera according to the relative posture and the relative position, so that the relative posture and the relative position meet preset conditions; at the current posture and current position of the adjusted camera, projecting a speckle pattern onto a reference plane fixedly connected to the camera calibration plate. The present application can adjust the posture and position of the camera according to camera parameters, coordinates of each corner point on the camera calibration plate, and coordinates of each corner point on the camera calibration plate image, and use a projector to project the speckle pattern onto the reference plane to obtain a reference image of a specified depth.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing and computer vision technology, and specifically to a method and device for obtaining a reference image of a speckle structured light system. Background Art

[0002] Depth map estimation technology is an important research direction in the field of computer vision technology, and is widely used in fields such as mobile robots, secure payments, augmented reality, and autonomous driving. In recent years, depth map estimation methods based on monocular cameras and speckle projection have gained widespread attention due to their high close-range estimation accuracy and good stability. This method can use a speckle projection module to project a fine speckle pattern onto the surface of a scene object, while using a camera to capture a scene image with a speckle pattern, and match the scene image with a pre-stored reference image with a known depth to obtain the pixel parallax between the two images, and finally restore the scene depth map based on the parallax. In the prior art, the principle of using a reference image to restore scene depth is as follows: Figure 1 As shown. Assume that the pixel position of point P1 on the surface of the scene object in the scene image is x R1 , obtain x through image matching R1 Matching point x in the reference image R0 , the disparity between the two points is d = x R0 -x R1 , the depth Z1 of point P1 can be calculated from d:

[0003]

[0004] Where b is the photographic baseline length, f is the focal length of the camera, and Z0 is the depth corresponding to the reference image. In this method, the reference plane corresponding to the reference image is required to be parallel to the imaging surface of the camera and the depth is fixed. In the process of obtaining the reference image, the posture deviation and position deviation of the reference plane will be reflected in the reference image, thereby affecting the accuracy of the depth map result. Therefore, how to obtain a reference image with accurate depth and good parallelism with the camera is crucial to the generation of the depth map. At present, the existing technology mostly uses mechanical alignment methods to ensure the parallelism of the reference plane and the imaging surface of the camera, which has large posture errors and position errors. Summary of the invention

[0005] In response to the problems in the prior art, the present application provides a method and device for obtaining a reference image of a speckle structured light system, which can adjust the posture and position of the camera according to camera parameters, the coordinates of each corner point on a camera calibration plate, and the coordinates of each corner point on the camera calibration plate image, and use a projector to project the speckle pattern onto a reference plane to obtain a reference image of a specified depth.

[0006] In order to solve the above technical problems, this application provides the following technical solutions:

[0007] In a first aspect, the present application provides a method for obtaining a reference image of a speckle structured light system, comprising:

[0008] Determine the relative posture and relative position of the camera relative to the camera calibration plate according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image; the camera parameters include: lens focal length, principal point coordinates, and distortion coefficient; two coordinate axes of the reference coordinate system are located in the plane where the camera calibration plate is located;

[0009] Adjusting the current posture and the current position of the camera according to the relative posture and the relative position so that the relative posture and the relative position meet preset conditions;

[0010] At the current posture and current position of the adjusted camera, the speckle pattern is projected onto a reference plane fixedly connected to the camera calibration plate.

[0011] Further, according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system and the coordinates of each corner point on the camera calibration plate image, the relative posture and relative position of the camera relative to the camera calibration plate are determined, including:

[0012] Calculating a rotation matrix of a pre-established camera coordinate system relative to the reference coordinate system according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image; one of the coordinate axes of the camera coordinate system coincides with the principal optical axis of the camera;

[0013] Calculate the heading angle deviation and the pitch angle deviation according to the rotation matrix;

[0014] The relative posture of the camera with respect to the camera calibration plate is determined according to the heading angle deviation and the pitch angle deviation.

[0015] Further, according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system and the coordinates of each corner point on the camera calibration plate image, the relative posture and relative position of the camera relative to the camera calibration plate are determined, including:

[0016] Calculate the translation vector of the camera coordinate system relative to the reference coordinate system according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image;

[0017] The relative position of the camera with respect to the camera calibration plate is determined according to the translation vector.

[0018] Further, the adjusting the current posture and the current position of the camera according to the relative posture and the relative position so that the relative posture and the relative position meet preset conditions includes:

[0019] Adjusting the current posture and current position of the camera according to the relative posture and the relative position, and re-determining the relative posture and relative position of the camera relative to the camera calibration plate;

[0020] Determining whether the re-determined relative posture and relative position meet the preset conditions;

[0021] If yes, determining the current attitude and current position of the camera;

[0022] If not, continue to adjust the current posture and current position of the camera according to the relative posture and the relative position.

[0023] In a second aspect, the present application provides a device for acquiring a reference image of a speckle structured light system, comprising:

[0024] A posture and position determination unit, used to determine the relative posture and relative position of the camera relative to the camera calibration plate according to camera parameters, coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and coordinates of each corner point on the camera calibration plate image; the camera parameters include: lens focal length, principal point coordinates, and radial distortion coefficient; one of the coordinate axes of the reference coordinate system coincides with the principal optical axis of the camera;

[0025] A posture and position adjustment unit, used for adjusting the current posture and current position of the camera according to the relative posture and the relative position, so that the relative posture and the relative position meet preset conditions;

[0026] The speckle projection unit is used to project the speckle pattern onto a reference plane fixedly connected to the camera calibration plate at the current posture and current position of the adjusted camera.

[0027] Furthermore, the posture position determination unit includes:

[0028] A rotation matrix calculation module, used to calculate the rotation matrix of the pre-established camera coordinate system relative to the reference coordinate system according to the camera parameters, the coordinates of each corner point on the camera calibration plate in the pre-established reference coordinate system and the coordinates of each corner point on the camera calibration plate image; one of the coordinate axes of the camera coordinate system coincides with the main optical axis of the camera;

[0029] A deviation calculation module, used to calculate the heading angle deviation and the pitch angle deviation according to the rotation matrix;

[0030] A relative attitude determination module is used to determine the relative attitude of the camera relative to the camera calibration plate according to the heading angle deviation and the pitch angle deviation.

[0031] Furthermore, the posture position determination unit further includes:

[0032] A translation vector calculation module, used to calculate the translation vector of the camera coordinate system relative to the reference coordinate system according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image;

[0033] A relative position determination module is used to determine the relative position of the camera with respect to the camera calibration plate according to the translation vector.

[0034] Furthermore, the posture position adjustment unit comprises:

[0035] A posture and position adjustment module, used for adjusting the current posture and current position of the camera according to the relative posture and the relative position, and re-determining the relative posture and relative position of the camera relative to the camera calibration plate;

[0036] The posture and position judgment module is used to judge whether the re-determined relative posture and relative position meet the preset conditions; if so, determine the current posture and current position of the camera; if not, continue to adjust the current posture and current position of the camera according to the relative posture and the relative position.

[0037] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the reference image acquisition method of the speckle structured light system are implemented.

[0038] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the reference image acquisition method of the speckle structured light system.

[0039] In response to the problems in the prior art, the present application provides a method and device for obtaining a reference image of a speckle structured light system. By using a speckle light system, the attitude and position of the camera can be adjusted according to the camera parameters, the coordinates of each corner point on a camera calibration plate, and the coordinates of each corner point on the camera calibration plate image. The speckle pattern is projected onto a reference plane using a projector to obtain a reference image of a specified depth, which has high accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 A schematic diagram of the principle of restoring a scene depth map using a reference image in the prior art;

[0041] Figure 2 A flowchart of a method for obtaining a reference image of a speckle structured light system in an embodiment of the present application;

[0042] Figure 3 Schematic diagram of the speckle structured light system in the embodiment of the present application;

[0043] Figure 4 Schematic diagram of camera angle adjustment in the embodiment of the present application;

[0044] Figure 5 A flowchart of determining the relative posture of a camera relative to a camera calibration plate in an embodiment of the present application;

[0045] Figure 6 A flowchart for determining the relative position of a camera relative to a camera calibration plate in an embodiment of the present application;

[0046] Figure 7 A flowchart of adjusting the current posture and current position of the camera in an embodiment of the present application;

[0047] Figure 8 A structural diagram of a device for acquiring a reference image of a speckle structured light system in an embodiment of the present application;

[0048] Fig. 9 One of the structural diagrams of the posture position determination unit in the embodiment of the present application;

[0049] Fig.10 The second structural diagram of the posture position determination unit in the embodiment of the present application;

[0050] Fig.11 A structural diagram of a posture position adjustment unit in an embodiment of the present application;

[0051] Fig.12 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0053] See also Figure 2 In order to adjust the attitude and position of the camera according to the camera parameters, the coordinates of each corner point on the camera calibration plate and the coordinates of each corner point on the camera calibration plate image, and use a projector to project the speckle pattern onto a reference plane to obtain a reference map of a specified depth, the present application provides a method for obtaining a reference map of a speckle structured light system, including:

[0054] S201: determining the relative posture and relative position of the camera with respect to the camera calibration plate according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the image of the camera calibration plate;

[0055] It is understandable that the parameters of the camera in the speckle structured light system may include: lens focal length, principal point coordinates and distortion coefficient. Figure 3 , the camera calibration plate can be a checkerboard calibration plate, and the checkerboard calibration plate has a number of squares, each square has four corner points, and each corner point of each square has corresponding coordinates in a pre-established reference coordinate system. The reference coordinate system can be established on the camera calibration plate so that the two coordinate axes of the reference coordinate system (usually the X-axis and the Y-axis) are located on the plane where the camera calibration plate is located, and the other coordinate axis Z is perpendicular to the plane of the camera calibration plate. In this reference coordinate system, the relative posture and relative position of the camera relative to the camera calibration plate can be calculated based on the camera parameters. The camera calibration plate image refers to the image formed by shooting the camera calibration plate using the camera in the embodiment of the present application.

[0056] S202: adjusting the current posture and current position of the camera according to the relative posture and relative position so that the relative posture and relative position meet preset conditions;

[0057] It can be understood that the preset condition for determining the relative posture can be a threshold range. When the relative posture exceeds the threshold range, it can be understood that the imaging plane of the camera (referring to the plane where the image sensor of the camera calibration plate is located) is not parallel to the plane where the camera calibration plate is located; otherwise, it is understood that the imaging plane of the camera is parallel to the plane where the camera calibration plate is located, or even if it is not absolutely parallel, the error is within an acceptable range in practical applications. The preset condition for determining the relative position can be another threshold range. When the relative position exceeds the threshold range, it can be understood that the distance between the center of the camera and the plane where the camera calibration plate is located does not match the specified depth value, and the reference image of the specified depth cannot be obtained; otherwise, it is understood that the distance between the center of the camera and the plane where the camera calibration plate is located meets the specified depth value, or even if it is not absolutely consistent, the error is within an acceptable range in practical applications.

[0058] According to the above, if the preset condition is met, the current posture and current position of the camera can be determined to be suitable for obtaining the reference image; otherwise, the current posture and current position of the camera continue to be adjusted until the preset condition is met.

[0059] S203: At the current posture and current position of the adjusted camera, project the speckle pattern onto a reference plane fixedly connected to a camera calibration plate.

[0060] It can be understood that, when the current posture and current position of the camera are determined, the speckle projector (hereinafter referred to as the projector) fixedly placed together with the camera in the speckle structured light system can be used to project the speckle pattern onto a reference plane fixedly connected to the camera calibration plate to form a speckle reference map (hereinafter referred to as the reference map). The reference map can be used for stereo scene recognition and depth measurement of the monocular speckle structured light system.

[0061] From the above description, it can be seen that the reference image acquisition method of the speckle structured light system provided in the present application, using the speckle light system, can adjust the posture and position of the camera according to the camera parameters, the coordinates of each corner point on the camera calibration plate, and the coordinates of each corner point on the camera calibration plate image, and use a projector to project the speckle pattern onto the reference plane to obtain a reference image of a specified depth, which has high accuracy.

[0062] The above reference image acquisition method can be based on Figure 3 The system implementation shown in the figure includes a speckle structured light module, a 6-DOF rotation stage, a reference plane and a camera calibration plate with a known thickness. The speckle structured light module is composed of a camera and a speckle projector fixed together. The camera and the projector are facing the same direction, the optical axes are parallel, and the relative position has been calibrated, that is, the line connecting the center of the camera and the center of the projector is parallel to the X-axis of the image sensor.

[0063] In one embodiment of the present application, before determining the relative posture and relative position of the camera relative to the camera calibration plate, a camera calibration plate needs to be selected to assist in the camera calibration process. Preferably, a checkerboard calibration plate with a thickness of Δz=5 mm can be selected.

[0064] In order to determine the relative posture of the camera with respect to the camera calibration plate, the speckle structured light module needs to be fixed on a 6-DOF rotation stage, facing the reference plane, so that the distance between the speckle structured light module and the reference plane is near the preset depth value d0. Preferably, the depth value d0 can generally be 1 meter (m). The reference plane can be a matte white board with a flatness of less than 0.1 millimeters (mm), and its size can cover the entire field of view of the camera. Among them, the relative position of the camera and the speckle projector is fixed. In addition, the camera calibration plate is placed close to the reference plane, and the corresponding edges of the camera calibration plate and the reference plane are parallel to each other.

[0065] See also Figure 5 , according to the camera parameters, the coordinates of each corner point on the camera calibration plate in the pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image, determine the relative posture of the camera relative to the camera calibration plate, including:

[0066] S501: Calculate the rotation matrix of the pre-established camera coordinate system relative to the reference coordinate system according to the camera parameters and coordinates;

[0067] It is understandable that one of the coordinate axes of the camera coordinate system coincides with the main optical axis of the camera. Preferably, after the camera parameters, the coordinates of each corner point on the camera calibration plate in the reference coordinate system, and the coordinates of each corner point on the camera calibration plate image are known, the Zhang Zhengyou calibration method or the PnP (Pespective-n-Point) method can be used to calculate the rotation matrix R of the camera coordinate system relative to the reference coordinate system. Among them, the corner point refers to the point corresponding to the four corners of each chessboard on the camera calibration plate. For the establishment of the camera coordinate system, see Figure 3 The X and Y axes of the camera coordinate system are parallel to the plane where the image sensor is located, and the other coordinate axis Z coincides with the main optical axis of the camera.

[0068] R can be expressed in the form of a row vector as:

[0069]

[0070] Among them, row vectors r1, r2, r3 are the representations of the basis vectors of the camera coordinate system in the reference coordinate system.

[0071] S502: Calculate the heading angle deviation and the pitch angle deviation according to the rotation matrix;

[0072] It is understandable that when the camera has a heading angle deviation and a pitch angle deviation relative to the camera calibration plate, the plane where the camera's imaging surface is located is not parallel to the plane where the camera calibration plate is located. The heading angle deviation and the pitch angle deviation can be calculated based on the rotation matrix, and then it can be determined whether the plane where the camera's imaging surface is located is parallel to the plane where the camera calibration plate is located.

[0073] Specifically, in Figure 3 In the coordinate system definition shown, when the Z of the camera coordinate system c When the axis is perpendicular to the plane of the camera calibration plate, r3=(0,0,-1) T , when the two are not perpendicular, Figure 4 The α and β shown define the angular deviation of the camera. Among them, α is the angle between the vector r3 and the reference coordinate system X r O r Z r The angle between the planes represents the deviation of the heading angle, and β is the difference between vector r3 and the reference coordinate system Y r O r Z r The angle between the planes represents the deviation of the pitch angle. α and β are calculated by the following formula:

[0074]

[0075] Among them, r 31 、r 32and r 33 They represent the three components of vector r3 respectively.

[0076] S503: Determine the relative posture of the camera with respect to the camera calibration plate according to the heading angle deviation and the pitch angle deviation.

[0077] It can be understood that the relative attitude refers to the heading angle deviation and pitch angle deviation of the camera relative to the camera calibration plate.

[0078] From the above description, it can be seen that the reference image acquisition method of the speckle structured light system provided in the present application can determine the relative posture of the camera relative to the camera calibration plate according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image.

[0079] See also Figure 6 , according to the camera parameters, the coordinates of each corner point on the camera calibration plate in the pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image, determine the relative position of the camera relative to the camera calibration plate, including:

[0080] S601: Calculate the translation vector of the camera coordinate system relative to the reference coordinate system according to the camera parameters and coordinates;

[0081] It can be understood that when the distance between the camera and the camera calibration plate deviates too much from the specified depth value, it is impossible to obtain a reference image of the specified depth value. Therefore, it is necessary to determine whether the distance between the center of the camera and the plane where the camera calibration plate is located is equal to the specified depth value or is within an acceptable threshold range based on the z coordinate value in the translation vector.

[0082] Specifically, the camera calibration method used in the embodiment of the present application can calculate the position of the camera center in the reference coordinate system, thereby obtaining the distance between the camera and the plane of the camera calibration plate. Specifically, after the internal parameters of the camera, the coordinates of each corner point on the camera calibration plate in the reference coordinate system, and the coordinates of each corner point on the camera calibration plate image are known, the Zhang Zhengyou calibration method or the PnP method can be used to calculate the translation vector t of the camera coordinate system relative to the reference coordinate system. Among them, the position p of the camera center in the reference coordinate system can be expressed as:

[0083] p=-R T t

[0084] S602: Determine the relative position of the camera with respect to the camera calibration plate according to the translation vector.

[0085] It can be understood that p is expressed as p = (x, y, z) T ,exist Figure 3In the coordinate system definition shown in FIG, z is the distance from the camera to the calibration plate plane, that is, the relative position of the camera relative to the camera calibration plate.

[0086] From the above description, it can be seen that the reference image acquisition method of the speckle structured light system provided in the present application can determine the relative position of the camera relative to the camera calibration plate according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image.

[0087] See also Figure 7 , adjust the current posture and current position of the camera according to the relative posture and relative position, so that the relative posture and relative position meet the preset conditions, including:

[0088] S701: adjusting the current posture and current position of the camera according to the relative posture and relative position, and re-determining the relative posture and relative position of the camera relative to the camera calibration plate;

[0089] It is understandable that in an embodiment of the present application, the angle of the 6-DOF rotation stage can be adjusted according to the relative postures α and β. Specifically, in the embodiment of the present application, the heading angle α can be adjusted first: if α is positive, the heading angle is adjusted to rotate the camera to the left by α; if α is negative, the heading angle is adjusted to rotate the camera to the right by -α. Then the pitch angle β is adjusted: if β is positive, the pitch angle is adjusted to rotate the camera upward by β; if β is negative, the pitch angle is adjusted to rotate the camera downward by -β.

[0090] After the adjustment is completed, the relative posture of the camera relative to the camera calibration plate is re-determined using steps S501 to S503. Then, the current posture of the camera is adjusted according to the relative posture until the optical axis of the camera (at Figure 3 The Z coordinate system of the camera is c The optical axis of the camera is perpendicular to the plane where the camera calibration plate is located, or the angle deviation is less than a given threshold. Specifically, the threshold can be set to 0.1°. When -0.1°<α<0.1° and -0.1°<β<0.1°, it can be considered that the optical axis of the camera is perpendicular to the plane where the camera calibration plate is located. It can also be understood that the imaging plane of the camera is parallel to the plane where the camera calibration plate is located, and the angle adjustment is completed. The adjustment process can be performed manually or automatically by a machine. Whether it is completed manually or automatically by a machine does not affect the implementation of the reference image acquisition method of the speckle structured light system of the present application.

[0091] In one embodiment of the present application, when calculating the distance between the camera and the reference plane, the thickness of the calibration plate needs to be considered. Specifically, the distance between the camera and the reference plane is d=z+Δz=z+0.5mm. Wherein, Δz is the thickness of the calibration plate, and preferably, Δz can be 0.5mm. Compare d with the preset depth value d0 to obtain the position deviation Δd=d-d0. Adjust the displacement of the 6-DOF rotation stage according to the position deviation. Specifically, if Δd>0, adjust the rotation stage to move the camera forward by Δd; if Δd<0, adjust the 6-DOF rotation stage to move the camera backward by -Δd.

[0092] After the adjustment is completed, use steps S601 to S602 to redetermine the relative position of the camera with respect to the camera calibration plate until the distance d between the camera and the reference plane is equal to the preset depth value d0 or the absolute value of the difference between the camera and the preset depth value d0 is less than a given threshold. Specifically, the threshold can be set to 0.1mm. When |d-d0|<0.1mm, it can be considered that the distance between the camera and the reference plane meets the preset requirements and the displacement adjustment is completed. The adjustment process can be performed manually or automatically by a machine. Whether it is completed manually or automatically by a machine does not affect the implementation of the reference image acquisition method of the speckle structured light system of the present application.

[0093] S702: Determine whether the re-determined relative posture and relative position meet the preset conditions;

[0094] It is understandable that the preset condition in this step is consistent with that described in S202. The embodiment of the present application can re-judge the relative posture and relative position according to the preset condition.

[0095] S703: If yes, determine the current posture and current position of the camera;

[0096] S704: If not, continue to adjust the current posture and current position of the camera according to the relative posture and relative position.

[0097] It is understandable that after the above posture and position adjustment is completed, the camera calibration plate can be removed, the speckle can be projected onto the reference plane using a projector, and the speckle image can be collected and stored using a camera as a reference image for a preset depth value.

[0098] From the above description, it can be seen that the reference image acquisition method of the speckle structured light system provided in the present application can adjust the current posture and current position of the camera according to the relative posture and relative position, so that the relative posture and relative position meet the preset conditions.

[0099] Based on the same inventive concept, the embodiments of the present application also provide a device for acquiring a reference image of a speckle structured light system, which can be used to implement the method described in the above embodiments, as described in the following embodiments. Since the principle of solving the problem by the device for acquiring a reference image of a speckle structured light system is similar to that of the method for acquiring a reference image of a speckle structured light system, the implementation of the device for acquiring a reference image of a speckle structured light system can refer to the implementation of the method for determining a software performance benchmark, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0100] See also Figure 8 In order to adjust the attitude and position of the camera according to the camera parameters, the coordinates of each corner point on the camera calibration plate and the coordinates of each corner point on the camera calibration plate image, and use a projector to project the speckle pattern onto a reference plane to obtain a reference map of a specified depth, the present application provides a device for obtaining a reference map of a speckle structured light system, including: an attitude and position determining unit 801, an attitude and position adjusting unit 802 and a speckle projecting unit 803.

[0101] The attitude and position determination unit 801 is used to determine the relative attitude and relative position of the camera relative to the camera calibration plate according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image; the camera parameters include: lens focal length, principal point coordinates, and distortion coefficient; two coordinate axes of the reference coordinate system are located in the plane where the camera calibration plate is located;

[0102] The posture and position adjustment unit 802 is used to adjust the current posture and current position of the camera according to the relative posture and relative position so that the relative posture and relative position meet the preset conditions;

[0103] The speckle projection unit 803 is used to project the speckle pattern onto a reference plane fixedly connected to the camera calibration plate at the current posture and current position of the adjusted camera.

[0104] See also Fig. 9 The posture position determination unit 801 includes: a rotation matrix calculation module 901, a deviation calculation module 902 and a relative posture determination module 903.

[0105] The rotation matrix calculation module 901 is used to calculate the rotation matrix of the pre-established camera coordinate system relative to the reference coordinate system according to the camera parameters and coordinates; one of the coordinate axes of the camera coordinate system coincides with the main optical axis of the camera;

[0106] Deviation calculation module 902, used for calculating heading angle deviation and pitch angle deviation according to the rotation matrix;

[0107] The relative attitude determination module 903 is used to determine the relative attitude of the camera with respect to the camera calibration plate according to the heading angle deviation and the pitch angle deviation.

[0108] See also Fig.10 , the posture position determination unit 801 also includes: a translation vector calculation module 1001 and a relative position determination module 1002.

[0109] A translation vector calculation module 1001 is used to calculate the translation vector of the camera coordinate system relative to the reference coordinate system according to the camera parameters and coordinates;

[0110] The relative position determination module 1002 is used to determine the relative position of the camera with respect to the camera calibration plate according to the translation vector.

[0111] See also Fig.11 The posture position adjustment unit 802 includes: a posture position adjustment module 1101 and a posture position judgment module 1102.

[0112] The posture and position adjustment module 1101 is used to adjust the current posture and current position of the camera according to the relative posture and the relative position, and to re-determine the relative posture and relative position of the camera relative to the camera calibration plate;

[0113] The posture and position judgment module 1102 is used to judge whether the re-determined relative posture and relative position meet the preset conditions; if so, determine the current posture and current position of the camera; if not, continue to adjust the current posture and current position of the camera according to the relative posture and relative position.

[0114] From the hardware level, in order to adjust the posture and position of the camera according to the camera parameters, the coordinates of each corner point on the camera calibration plate and the coordinates of each corner point on the camera calibration plate image, and use a projector to project the speckle pattern onto the reference plane to obtain a reference map of a specified depth, the present application provides an embodiment of an electronic device for implementing all or part of the contents of the reference map acquisition method of the speckle structured light system, and the electronic device specifically includes the following contents:

[0115] Processor, memory, communication interface and bus; wherein the processor, memory and communication interface communicate with each other through the bus; the communication interface is used to realize information transmission between the device for obtaining the reference image of the speckle structured light system and related devices such as the core business system, user terminal and related database; the logic controller can be a desktop computer, a tablet computer and a mobile terminal, etc., and the present embodiment is not limited thereto. In the present embodiment, the logic controller can be implemented with reference to the embodiment of the method for obtaining the reference image of the speckle structured light system and the embodiment of the device for obtaining the reference image of the speckle structured light system in the embodiment, and the contents thereof are incorporated herein, and the repeated parts are not repeated.

[0116] It is understandable that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.

[0117] In practical applications, part of the reference image acquisition method of the speckle structured light system can be executed on the electronic device side as described above, or all operations can be completed in the client device. The specific selection can be based on the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor.

[0118] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.

[0119] Fig.12 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Fig.12 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig.12 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.

[0120] In one embodiment, the reference image acquisition method function of the speckle structured light system may be integrated into the central processor 9100. The central processor 9100 may be configured to perform the following control:

[0121] S201: Determine the relative posture and relative position of the camera relative to the camera calibration plate according to camera parameters, coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and coordinates of each corner point on the camera calibration plate image; the camera parameters include: lens focal length, principal point coordinates, and distortion coefficient; two coordinate axes of the reference coordinate system are located in the plane where the camera calibration plate is located;

[0122] S202: adjusting the current posture and the current position of the camera according to the relative posture and the relative position, so that the relative posture and the relative position meet a preset condition;

[0123] S203: At the current posture and current position of the adjusted camera, projecting the speckle pattern onto a reference plane fixedly connected to the camera calibration plate.

[0124] From the above description, it can be seen that the reference image acquisition method of the speckle structured light system provided in the present application can adjust the posture and position of the camera according to the camera parameters, the coordinates of each corner point on the camera calibration plate and the coordinates of each corner point on the camera calibration plate image by using the speckle light system, and use a projector to project the speckle pattern onto the reference plane to obtain a reference image of a specified depth, which has high accuracy.

[0125] In another embodiment, the device for acquiring the reference image of the speckle structured light system may be configured separately from the central processing unit 9100. For example, the device for acquiring the reference image of the speckle structured light system of the data composite transmission device may be configured as a chip connected to the central processing unit 9100, and the function of the method for acquiring the reference image of the speckle structured light system is realized under the control of the central processing unit.

[0126] like Fig.12 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig.12 In addition, the electronic device 9600 may also include Fig.12 For components not shown, reference may be made to the prior art.

[0127] like Fig.12As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.

[0128] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.

[0129] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.

[0130] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.

[0131] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0132] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.

[0133] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.

[0134] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the reference image acquisition method for a speckle structured light system in the above embodiments, where the execution subject is a server or a client. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, all the steps of the reference image acquisition method for a speckle structured light system in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0135] S201: Determine the relative posture and relative position of the camera relative to the camera calibration plate according to camera parameters, coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and coordinates of each corner point on the camera calibration plate image; the camera parameters include: lens focal length, principal point coordinates, and distortion coefficient; two coordinate axes of the reference coordinate system are located in the plane where the camera calibration plate is located;

[0136] S202: adjusting the current posture and the current position of the camera according to the relative posture and the relative position, so that the relative posture and the relative position meet a preset condition;

[0137] S203: At the current posture and current position of the adjusted camera, projecting the speckle pattern onto a reference plane fixedly connected to the camera calibration plate.

[0138] From the above description, it can be seen that the reference image acquisition method of the speckle structured light system provided in the present application can adjust the posture and position of the camera according to the camera parameters, the coordinates of each corner point on the camera calibration plate and the coordinates of each corner point on the camera calibration plate image by using the speckle light system, and use a projector to project the speckle pattern onto the reference plane to obtain a reference image of a specified depth, which has high accuracy.

[0139] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0140] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0141] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0142] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0143] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for obtaining a reference image of a speckle structured light system, characterized in that: include: Determine the relative posture and relative position of the camera relative to the camera calibration plate according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image; the camera parameters include: lens focal length, principal point coordinates, and distortion coefficient; two coordinate axes of the reference coordinate system are located in the plane where the camera calibration plate is located; Adjusting the current posture and the current position of the camera according to the relative posture and the relative position so that the relative posture and the relative position meet preset conditions; At the current posture and current position of the adjusted camera, projecting the speckle pattern onto a reference plane fixedly connected to the camera calibration plate; Wherein, determining the relative posture and relative position of the camera relative to the camera calibration plate according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image includes: Calculating a rotation matrix of a pre-established camera coordinate system relative to the reference coordinate system according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image; one of the coordinate axes of the camera coordinate system coincides with the principal optical axis of the camera; Calculate the heading angle deviation and the pitch angle deviation according to the rotation matrix; Determining a relative posture of the camera with respect to the camera calibration plate according to the heading angle deviation and the pitch angle deviation; Calculate the translation vector of the camera coordinate system relative to the reference coordinate system according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image; The relative position of the camera with respect to the camera calibration plate is determined according to the translation vector.

2. The method for obtaining a reference image of a speckle structured light system according to claim 1, characterized in that: The adjusting the current posture and the current position of the camera according to the relative posture and the relative position so that the relative posture and the relative position meet a preset condition includes: Adjusting the current posture and current position of the camera according to the relative posture and the relative position, and re-determining the relative posture and relative position of the camera relative to the camera calibration plate; Determining whether the re-determined relative posture and relative position meet the preset conditions; If yes, determining the current attitude and current position of the camera; If not, continue to adjust the current posture and current position of the camera according to the relative posture and the relative position.

3. A device for acquiring a reference image of a speckle structured light system, characterized in that: include: A posture and position determination unit, used to determine the relative posture and relative position of the camera relative to the camera calibration plate according to camera parameters, coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and coordinates of each corner point on the camera calibration plate image; the camera parameters include: lens focal length, principal point coordinates, and radial distortion coefficient; one of the coordinate axes of the reference coordinate system coincides with the principal optical axis of the camera; A posture and position adjustment unit, used for adjusting the current posture and current position of the camera according to the relative posture and the relative position, so that the relative posture and the relative position meet preset conditions; A speckle projection unit, used to project a speckle pattern onto a reference plane fixedly connected to the camera calibration plate at the current posture and current position of the adjusted camera; Wherein, the posture position determination unit includes: A rotation matrix calculation module, used to calculate the rotation matrix of the pre-established camera coordinate system relative to the reference coordinate system according to the camera parameters, the coordinates of each corner point on the camera calibration plate in the pre-established reference coordinate system and the coordinates of each corner point on the camera calibration plate image; one of the coordinate axes of the camera coordinate system coincides with the main optical axis of the camera; A deviation calculation module, used to calculate the heading angle deviation and the pitch angle deviation according to the rotation matrix; A relative attitude determination module, used to determine the relative attitude of the camera with respect to the camera calibration plate according to the heading angle deviation and the pitch angle deviation; A translation vector calculation module, used to calculate the translation vector of the camera coordinate system relative to the reference coordinate system according to the camera parameters, the coordinates of each corner point on the camera calibration plate in a pre-established reference coordinate system, and the coordinates of each corner point on the camera calibration plate image; A relative position determination module is used to determine the relative position of the camera with respect to the camera calibration plate according to the translation vector.

4. The device for acquiring a reference image of a speckle structured light system according to claim 3, characterized in that: The posture position adjustment unit comprises: A posture and position adjustment module, used for adjusting the current posture and current position of the camera according to the relative posture and the relative position, and re-determining the relative posture and relative position of the camera relative to the camera calibration plate; The posture and position judgment module is used to judge whether the re-determined relative posture and relative position meet the preset conditions; if so, determine the current posture and current position of the camera; if not, continue to adjust the current posture and current position of the camera according to the relative posture and the relative position.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method for acquiring a reference image for a speckle structured light system according to any one of claims 1 to 2 are implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for acquiring a reference image of a speckle structured light system according to any one of claims 1 to 2 are implemented.