Calibration method, device and equipment of line structured light detection system and medium
By using cameras and lasers in the online structured light detection system, the spatial transformation matrix and actual coordinates are determined, and the problem of low calibration accuracy of light planes in the prior art is solved, thereby achieving higher precision calibration and wider applicable scenarios.
Patent Information
- Application Number
- CN202510117255.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-06
AI Technical Summary
The existing linear structure light detection system has low light plane calibration accuracy and limited applicable scenarios.
By taking an image of the calibration device by the camera, determining the spatial transformation matrix between the camera imaging plane and the calibration device, obtaining the image formed by the laser line on the surface of the calibration device, obtaining the actual coordinates and pixel coordinates, adjusting the distance between the laser and the calibration device, repeatedly obtaining the coordinates, and finally performing light plane calibration based on these parameters.
The light plane calibration accuracy of the linear structure light detection system is improved, making it suitable for various scenarios.
Smart Images

Figure CN119935015A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of three-dimensional measurement technology, and in particular to a calibration method, device, equipment and medium for a line structured light detection system. Background Art
[0002] The line structured light detection system is a non-contact three-dimensional detection system composed of a camera and a laser. During the detection process, the laser projects a light beam onto the surface of the object to be measured to form a light strip. The undulating surface of the object to be measured causes the light strip to deform. The camera captures the light strip images at different positions, extracts the center of the light strip and performs perspective transformation to obtain the three-dimensional coordinates of the light strip position. Combined with the position information of the camera and the object to be measured, the complete three-dimensional information of the surface of the object to be measured is obtained. The line structured light detection system will calibrate its light plane before use, and the calibration result directly affects the final detection accuracy of the line structured light detection system.
[0003] In the related art, the "wire drawing method" is used to calibrate the light plane. This method uses multiple non-coplanar thin wires to intersect with the line structure light plane, and completes the calibration of the light plane through the coordinates of these intersection points. However, the calibration accuracy of this method is low and the applicable scenarios are also limited. Summary of the invention
[0004] In view of the above problems, the present invention is proposed to provide a calibration method, device, equipment and medium for a line structured light detection system that solves the above problems. The image of the calibration device can be photographed by a camera to obtain a spatial transformation matrix, and then the image of the laser line formed by the laser of the laser on the surface of the calibration device can be photographed by the camera to obtain a first actual coordinate and a first pixel coordinate. Finally, the second actual coordinate and the second pixel coordinate are obtained after adjusting the distance between the laser and the calibration device, thereby obtaining the parameters required for light plane calibration. Calibration based on these parameters makes the calibration more accurate and suitable for various scenarios.
[0005] In a first aspect, the present invention provides a calibration method for a line structured light detection system, the line structured light detection system comprising a camera and a laser, the method comprising:
[0006] Controlling the laser to be turned off, and taking an image of the calibration device through the camera, and determining, according to the image, a spatial transformation matrix from a first two-dimensional coordinate system where the camera imaging plane is located to a second two-dimensional coordinate system where the calibration device is located, wherein the plane where the first two-dimensional coordinate system is located and the plane where the second two-dimensional coordinate system is located are both parallel to a horizontal plane;
[0007] Control the laser to turn on and emit a line structure laser to the surface of the calibration device, obtain a first pixel coordinate of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and a first actual coordinate of the laser line in the second two-dimensional coordinate system, wherein the laser line is parallel to an axis of the second two-dimensional coordinate system;
[0008] After changing the distance between the calibration device and the camera, obtaining again the second pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the second actual coordinates of the laser line in the second two-dimensional coordinate system;
[0009] The light plane of the line structured light detection system is calibrated according to the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, and the second actual coordinate.
[0010] Optionally, calibrating the light plane of the line structured light detection system according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, and the second actual coordinate includes:
[0011] Calculate the angle between the laser line and the horizontal plane according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate and the second actual coordinate;
[0012] The light plane of the line structured light detection system is calibrated according to the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, the second actual coordinate and the angle.
[0013] Optionally, the calibration device includes calibration paper and two rulers, the two rulers are perpendicular to each other and the long sides are arranged parallel to two different sides of the calibration paper, and the two rulers are used to measure the coordinates of the laser line on the calibration paper.
[0014] Optionally, there are multiple circular calibration patterns on the calibration paper and they are evenly distributed on the calibration paper.
[0015] Optionally, the method further includes:
[0016] Acquire a calibration distance and a size of the calibration paper, wherein the calibration distance is a maximum distance between the calibration device and the camera during calibration;
[0017] The radius and number of the circular calibration patterns, and the ratio of the radius to the distance between the centers of two adjacent circular calibration patterns are determined according to the calibration distance and the size.
[0018] Optionally, if the laser is a horizontal line parallel laser, the laser line on the surface of the calibration device is parallel to the horizontal coordinate of the second two-dimensional coordinate system, the first actual coordinate includes a first actual vertical coordinate, the second actual coordinate includes a second actual vertical coordinate, the first pixel coordinate includes a first pixel vertical coordinate, and the second pixel coordinate includes a second pixel vertical coordinate.
[0019] Optionally, if the laser is a grid-type laser, the laser lines on the surface of the calibration device include horizontal laser lines and vertical laser lines that are perpendicular to each other, the horizontal laser lines are parallel to the horizontal coordinates of the second two-dimensional coordinate system, the vertical laser lines are parallel to the vertical coordinates of the second two-dimensional coordinate system, the first actual coordinates include a first actual vertical coordinate and a first actual horizontal coordinate, the second actual coordinates include a second actual vertical coordinate and a second actual horizontal coordinate, the first pixel coordinates include a first pixel vertical coordinate and a first pixel horizontal coordinate, and the second pixel coordinates include a second pixel vertical coordinate and a first pixel horizontal coordinate.
[0020] In a second aspect, the present invention provides a calibration device for a line structured light detection system, the line structured light detection system comprising a camera and a laser, the device comprising:
[0021] A first control module is used to control the laser to be turned off, and to capture an image of the calibration device through the camera, and to determine, according to the image, a spatial transformation matrix from a first two-dimensional coordinate system where the camera imaging plane is located to a second two-dimensional coordinate system where the calibration device is located, wherein the plane where the first two-dimensional coordinate system is located and the plane where the second two-dimensional coordinate system is located are both parallel to a horizontal plane;
[0022] a second control module, used for controlling the laser to turn on and emit a line structure laser to the surface of the calibration device, obtaining a first pixel coordinate of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and a first actual coordinate of the laser line in the second two-dimensional coordinate system, wherein the laser line is parallel to an axis of the second two-dimensional coordinate system;
[0023] an acquisition module, configured to acquire again the second pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the second actual coordinates of the laser line in the second two-dimensional coordinate system after changing the distance between the calibration device and the camera;
[0024] A calibration module is used to calibrate the light plane of the line structured light detection system according to the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate and the second actual coordinate.
[0025] In a third aspect, the present invention provides an electronic device comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method described in the first aspect by executing the computer instructions.
[0026] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0027] The technical solution provided in the embodiments of the present invention has at least the following technical effects or advantages:
[0028] An embodiment of the present invention provides a calibration method, device, equipment and medium for a line structured light detection system. The line structured light detection system includes a camera and a laser. The laser is controlled to be turned off, and an image of the calibration device is captured by the camera. According to the image, a spatial transformation matrix from a first two-dimensional coordinate system where the camera imaging plane is located to a second two-dimensional coordinate system where the calibration device is located is determined to obtain a first parameter required for calibrating the light plane of the line structured light detection system. The plane where the first two-dimensional coordinate system is located and the plane where the second two-dimensional coordinate system is located are both parallel to the horizontal plane to ensure that the captured image is positive. The laser is controlled to be turned on and to emit laser light to the surface of the calibration device to obtain a first parameter of the laser line on the surface of the calibration device in the first two-dimensional coordinate system. The pixel coordinates and the first actual coordinates of the laser line in the second two-dimensional coordinate system are used to obtain the second parameter required for calibrating the light plane. The laser line is parallel to the axis of the second two-dimensional coordinate system, which is conducive to better determining the actual coordinates. After changing the distance between the calibration device and the camera, the second pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the second actual coordinates of the laser line in the second two-dimensional coordinate system are obtained again to obtain the third parameter required for calibrating the light plane. According to the spatial variation matrix, the first actual coordinates, the first pixel coordinates, the second actual coordinates and the second actual coordinates, the light plane of the line structured light detection system is calibrated, so that the calibration accuracy is higher, and the calibration method can be applied to various scenarios.
[0029] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0031] Figure 1 is a flow chart of a calibration method for a line structured light detection system provided by an embodiment of the present invention;
[0032] Figure 2 is a structural schematic diagram of a calibration device provided by an embodiment of the present invention;
[0033] Figure 3 is a schematic diagram of the arrangement structure of a camera and a calibration device provided by an embodiment of the present invention;
[0034] Figure 4 It is a schematic diagram of the arrangement structure of a calibration device and a calibration plate provided by an embodiment of the present invention;
[0035] Figure 5 It is a structural block diagram of a calibration device for a line structured light detection system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of the present application clearer, the implementation mode of the present application will be further described in detail below in conjunction with the accompanying drawings. It should be understood that the embodiments of the present disclosure and the specific features in the embodiments are detailed descriptions of the technical solutions of the present application, rather than limitations on the technical solutions of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.
[0037] Figure 1 is a flow chart of a calibration method for a line structured light detection system provided by an embodiment of the present invention. Figure 1 As shown, the method includes:
[0038] Step S110, control the laser to be turned off, and use the camera to capture an image of the calibration device, and determine the spatial transformation matrix from the first two-dimensional coordinate system where the camera imaging plane is located to the second two-dimensional coordinate system where the calibration device is located according to the image.
[0039] The plane where the first two-dimensional coordinate system is located and the plane where the second two-dimensional coordinate system is located are both parallel to the horizontal plane.
[0040] In this embodiment, the line structured light detection system includes a camera and a laser, wherein the camera is used to capture images, and the laser is used to emit laser light of a multi-line structure. When calibrating the line structured light detection system, a calibration device is used, which is equivalent to a target, and a calibration plate is used to support the calibration device. The camera may be a CMOS camera, and the calibration plate may be an acrylic plate.
[0041] In this embodiment, before calibration, the calibration device is first placed on a calibration plate, which has a certain thickness, a flat surface, and a size greater than or equal to the calibration device, to ensure the straightness and stability of the calibration device without obvious bending.
[0042] Exemplarily, the calibration device is a square, and the calibration board is a larger square. In this case, the step of placing the calibration device on the calibration board includes:
[0043] A point near the upper left corner of the calibration plate is taken as the origin, and the origin is n millimeters away from the left and right sides of the calibration plate. The positive direction of the X axis is to the right along the origin, and the positive direction of the Y axis is to the downward along the origin. The second two-dimensional coordinate system O-XY of the calibration device is established. The size of the acrylic plate is m*m, and the size of the calibration device is also m*m. When arranging, the four corners of the calibration device are aligned with the four corners of the acrylic plate.
[0044] First, place the calibration board horizontally, and the calibration device on the calibration board will also be placed horizontally. The second two-dimensional coordinate system of the calibration device is parallel to the horizontal plane. The line structured light detection system is arranged directly above the calibration device, and the camera posture is adjusted so that the first two-dimensional coordinate system of the camera is also parallel to the horizontal plane.
[0045] Next, start calibration, first control the laser to turn off, then use the camera to shoot the calibration device to obtain an image of the calibration device. Halcon software outputs parameters such as the spatial rotation angle and translation of the X-axis and Y-axis based on the image, and then determines the spatial transformation matrix M from the first two-dimensional coordinate system of the camera to the second two-dimensional coordinate system of the calibration device based on these parameters.
[0046] Step S120, control the laser to turn on and emit line structure laser to the surface of the calibration device, obtain the first pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the first actual coordinates of the laser line in the second two-dimensional coordinate system.
[0047] The laser line is parallel to the axis of the second two-dimensional coordinate system.
[0048] In this embodiment, the laser is controlled to emit a line structure laser toward the surface of the calibration device. The line structure laser forms a laser line on the surface of the calibration device. The first actual coordinate of each laser line on the calibration device in the second two-dimensional coordinate system is recorded. Then, an image of the calibration device with the laser line is taken, and the first pixel coordinate of the laser line in the first two-dimensional coordinate system is obtained based on the image.
[0049] Step S130, after changing the distance between the calibration device and the camera, obtaining again the second pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the second actual coordinates of the laser line in the second two-dimensional coordinate system.
[0050] In this embodiment, the distance between the calibration device and the camera is changed, for example, in step S120, the distance between the calibration device and the camera is the first distance, and the distance between the calibration device and the camera is reduced to the second distance. Then, the second actual coordinates of each laser line on the calibration device in the second two-dimensional coordinate system are recorded, and then an image of the calibration device with the laser line after the distance is changed is captured, and the second pixel coordinates of the laser line in the first two-dimensional coordinate system are obtained according to the image.
[0051] Here, it is necessary to try to ensure that all the line structure lasers emitted by the laser fall on the calibration device, so as to obtain more coordinate data and improve the calibration accuracy.
[0052] Step S140 , calibrating the light plane of the line structured light detection system according to the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, and the second actual coordinate.
[0053] Finally, the parameters required for calibration are obtained, namely, the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, and the second actual coordinate. According to the parameters required for calibration, the light plane of the line structured light detection system is calibrated, so that the calibration result has higher accuracy, and the calibration method is not limited by the scene.
[0054] Optionally, step S140 includes:
[0055] The angle between the laser line and the horizontal plane is calculated according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, and the second actual coordinate; the light plane of the line structured light detection system is calibrated according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, the second actual coordinate, and the angle.
[0056] In this embodiment, the angle between the laser line and the horizontal plane is calculated by software according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate and the second actual coordinate. Since the angle is added during calibration, the calibration result has a higher accuracy.
[0057] Optionally, the calibration device includes calibration paper and two rulers, the two rulers are perpendicular to each other and the long sides are arranged parallel to two different sides of the calibration paper, and the two rulers are used to measure the coordinates of the laser line on the calibration paper.
[0058] In this embodiment, the calibration device adopts a new design, which includes calibration paper and two rulers. The long sides of the two rulers are respectively aligned with two mutually perpendicular sides of the calibration paper, and the calibration paper and the two rulers do not overlap. The horizontal and vertical coordinates of the laser line on the calibration paper are measured by the two rulers, so that the first actual coordinate and the second actual coordinate are more accurate.
[0059] For example, the size of the acrylic plate is m*m, the size of the calibration device is also m*m, the width of the ruler is n and the length is (mn), the size of the calibration paper is (mn, mn), and the origin of the second two-dimensional coordinate system is at the upper left corner of the calibration plate and is n millimeters away from the left and right sides of the calibration plate. One ruler is placed along the X-axis, and the coordinates of its upper left and lower right corners in the second two-dimensional coordinate system are (0, -n) and (mn, 0) respectively. Another ruler is placed along the Y-axis, and the coordinates of its upper left and lower right corners in the second two-dimensional coordinate system are (-n, 0) and (0, mn) respectively. The upper left corner of the calibration paper is aligned with the origin, and the coordinates of the lower right corner are (mn, mn). The values of the first actual coordinate and the second actual coordinate can be read according to the scale of the ruler.
[0060] Figure 2 is a schematic diagram of the structure of a calibration device provided by an embodiment of the present invention, such as Figure 2 As shown, the calibration device includes a calibration paper 1 and two rulers 2. The calibration paper 1 has a plurality of circular calibration patterns that are evenly distributed on the calibration paper 1.
[0061] In this embodiment, the circular calibration pattern can achieve a better calibration effect, and the calibration paper 1 with the circular calibration pattern is suitable for the Halcon software.
[0062] Figure 3 is a schematic diagram of the arrangement structure of a camera and a calibration device provided by an embodiment of the present invention, such as Figure 3 As shown, the camera 3 is arranged directly above the calibration device 4 .
[0063] Figure 4 is a schematic diagram of the arrangement structure of a calibration device and a calibration plate provided by an embodiment of the present invention, such as Figure 4 As shown, the calibration device 4 is placed on the calibration plate 5, and the four corners are aligned.
[0064] Optionally, the method further includes:
[0065] Obtain the size of the calibration paper for the calibration distance; determine the radius and number of circular calibration patterns, and the ratio of the radius to the distance between the centers of two adjacent circular calibration patterns according to the calibration distance and the size.
[0066] In this embodiment, the radius, number, and ratio of the radius to the center distance of the circular calibration pattern are adjustable, where the center distance is the distance between the centers of two adjacent circular calibration patterns. The radius, number, and ratio of the radius to the center distance are affected by the calibration distance, which is the maximum distance between the calibration device and the camera during calibration.
[0067] In this embodiment, the radius, number, and ratio of radius to center distance can be generated according to the calibration distance and size by the gen_caltab function of the Halcon software. The larger the calibration distance, the larger the radius and the smaller the number.
[0068] Optionally, if the laser is a horizontal line parallel laser, the laser line on the surface of the calibration device is parallel to the horizontal coordinate of the second two-dimensional coordinate system, the first actual coordinate includes the first actual vertical coordinate, the second actual coordinate includes the second actual vertical coordinate, the first pixel coordinate includes the first pixel vertical coordinate, and the second pixel coordinate includes the second pixel vertical coordinate.
[0069] In this embodiment, if the laser is a horizontal line parallel laser, mutually parallel horizontal laser lines will be formed on the surface of the calibration device, and the mutually parallel horizontal laser lines will be parallel to the X axis of the second two-dimensional coordinate system. The average first pixel ordinate V of each horizontal laser line in the first two-dimensional coordinate system is output through the Halcon software. j and the second pixel ordinate V H j At the same time, read the value of the scale corresponding to the horizontal laser line to obtain the first actual vertical coordinate Y of each horizontal laser line in the second two-dimensional coordinate system j and the second actual ordinate Y H j . Where H represents the changed distance between the calibration device and the camera.
[0070] Optionally, if the laser is a grid-type laser, the laser lines on the surface of the calibration device include horizontal laser lines and vertical laser lines that are perpendicular to each other, the horizontal laser lines are parallel to the horizontal coordinates of the second two-dimensional coordinate system, the vertical laser lines are parallel to the vertical coordinates of the second two-dimensional coordinate system, the first actual coordinates include a first actual vertical coordinate and a first actual horizontal coordinate, the second actual coordinates include a second actual vertical coordinate and a second actual horizontal coordinate, the first pixel coordinates include a first pixel vertical coordinate and a first pixel horizontal coordinate, and the second pixel coordinates include a second pixel vertical coordinate and a first pixel horizontal coordinate.
[0071] In this embodiment, if the laser is a grid-type laser, mutually perpendicular laser lines will be formed on the surface of the calibration device, which are recorded as horizontal laser lines and vertical laser lines respectively. The horizontal laser line is parallel to the horizontal coordinate of the second two-dimensional coordinate system, and the vertical laser line is parallel to the vertical coordinate of the second two-dimensional coordinate system. At this time, the first pixel vertical coordinate V of each horizontal laser line can be output through the Halcon software. j and the second pixel ordinate V H j , and the first pixel horizontal coordinate U of each longitudinal laser line i and the second pixel horizontal coordinate U H i , read the values of the scales corresponding to the horizontal laser line and the vertical laser line at the same time, and record the first actual vertical coordinate Y of each horizontal laser line j and the second actual ordinate Y H j , and the first actual horizontal coordinate X of each longitudinal laser line i and the second actual horizontal coordinate X H i .
[0072] In this embodiment, the calibration device can be used to calibrate the parameters of each laser line in various complex line structured light detection systems, which has certain applicability and improves the calibration efficiency of the line structured light detection system.
[0073] In order to better understand the content of this embodiment, a specific example is given below for illustration.
[0074] Example: In the line structured light detection system, an area array camera with a pixel level of 1000W or above is selected, the image resolution is 4096*2460, an acrylic plate with a size of 1200*1200*10mm is selected as the calibration plate, and a ruler with a width of 40mm and a length of 11600mm is selected. The coordinate system O-XY is established, the horizontal right is the positive direction of the X axis, the vertical downward is the positive direction of the Y axis, and the coordinate of the upper left corner of the acrylic plate is (-40, -40) mm. The upper edge of one ruler coincides with the upper edge of the acrylic plate, and the coordinates of the upper left and lower right corners are (0, -40) and (1160, 0) respectively. The upper edge of the other ruler coincides with the left edge of the acrylic plate, and the coordinates of the upper left and lower right corners are (-40, 0) and (0, 1160) respectively.
[0075] Among them, through the design of gen_caltab function, the number of circular calibration patterns on the calibration paper is 7×7=49, the distance between the centers of the circles is 145mm, and the ratio of the circle diameter to the distance between the centers of the circles is 0.6. The size of the calibration paper finally produced is 1160*1160mm. The upper and left edges of the calibration paper coincide with the long sides of the two rulers respectively, and the coordinates of the upper left and lower right corners of the calibration paper are (0, 0) and (1160, 1160) respectively.
[0076] A grid-type laser is selected, with 10 horizontal and vertical laser lines. The calibration method includes:
[0077] In the first step, place the calibration device horizontally, turn off the grid laser, turn on the area array camera and adjust the camera posture to ensure that the plane of the camera's first two-dimensional coordinate system is parallel to the plane of the calibration device's second two-dimensional coordinate system, that is, the U axis of the camera's imaging plane is parallel to the X axis of the calibration device, and the V axis of the imaging plane is parallel to the Y axis of the calibration device. Then, the Halcon software is used to calibrate the spatial transformation matrix M from the camera coordinate system to the calibration device coordinate system. The spatial transformation matrix M is:
[0078]
[0079] In the second step, the distance between the calibration device and the camera is the same as in step 1, and then the grid laser is turned on to ensure that all lasers are projected on the calibration device. By adjusting the grid laser posture, ensure that the horizontal laser line on the calibration device is parallel to the X axis and the vertical laser line is parallel to the Y axis. Record the first pixel vertical coordinate V of each horizontal laser line in the first two-dimensional coordinate system j , the first actual vertical coordinate Y of each horizontal laser line in the second two-dimensional coordinate system j , the first pixel horizontal coordinate U of each longitudinal laser line in the first two-dimensional coordinate system i , the first actual horizontal coordinate X of each horizontal laser line in the second two-dimensional coordinate system i , the coordinate values are shown in Table 1:
[0080] Table 1
[0081] <![CDATA[Y j (mm)]]> <![CDATA[V j ]]> <![CDATA[X i (mm)]]> <![CDATA[U i ]]> 1 923.1421 688 1002.8848 1926.3 2 810.2855 890.4 899.2288 1919.8 3 699.4621 1092.9 794.2905 1913.7 4 591.73456 1293.4 689.1563 1908.1 5 487.128952 1491.6 584.0176 1901.8 6 386.6866 1685.3 479.32289 1896.2 7 290.8885 1873.2 375.9616 1891 8 199.1003 2056.2 274.6746 1885.9 9 112.0494 2232.5 175.9488 1881.1 10 28.9244 2403.4 79.9756 1876.4
[0082] The third step is to raise the calibration device by 10 mm and then turn on the grid laser again to ensure that all lasers are projected on the calibration device. Record the average v-axis pixel coordinate of each transverse laser line spot and the corresponding value of each transverse laser line on the longitudinal scale. Record the first pixel ordinate V of each transverse laser line in the first two-dimensional coordinate system. H j , the first actual vertical coordinate Y of each horizontal laser line in the second two-dimensional coordinate system H j, the first pixel horizontal coordinate U of each longitudinal laser line in the first two-dimensional coordinate system H i , the first actual horizontal coordinate X of each horizontal laser line in the second two-dimensional coordinate system H i , the coordinate values are shown in Table 2:
[0083] Table 2
[0084] <![CDATA[Y H j (mm)]]> <![CDATA[v H j ]]> <![CDATA[X H i (mm)]]> <![CDATA[u H i ]]> 1 920.1673 688.9 998.958 1926.2 2 808.2166 891.3 895.4673 1919.9 3 698.3872 1093.6 791.9762 1913.7 4 591.46127 1294.2 687.5043 1907.7 5 487.808132 1492.2 582.90942 1902 6 387.6563 1686.9 479.25758 1896.4 7 292.2254 1875.6 376.7112 1890.8 8 201.0405 2058.9 276.0742 1886 9 114.504 2235.6 178.187 1881 10 32.2063 2406.2 83.0335 1876.5
[0085] The fourth step is to calculate the angle θ between each laser line and the horizontal plane according to the previous space transformation matrix M and various coordinate values. The angles θ are shown in Table 3:
[0086] Table 3
[0087] <![CDATA[θ i (°)]]> <![CDATA[θ j (°)]]> 1 73.4333111 68.56105673 2 78.3109908 69.38620993 3 83.86483307 76.96944336 4 88.43455329 80.61945981 5 -86.11455225 83.67639801 6 -84.46134527 89.62580658 7 -82.38527903 -85.71312569 8 -79.01989392 -82.03263739 9 -76.20883834 -77.38398399 10 -71.83068131 -72.99689187
[0088] Among them, θ i Represents the angle between the horizontal laser line and the horizontal plane, θ j Represents the angle between the vertical laser line and the horizontal plane. The obtained coordinate values, space transformation matrix M and θ are the parameters required for calibrating the light plane of the line structured light detection system.
[0089] Based on the same inventive concept, an embodiment of the present invention further provides a calibration device for a line structured light detection system, wherein the line structured light detection system includes a camera and a laser. Figure 5 is a structural block diagram of a calibration device for a line structured light detection system provided by an embodiment of the present invention, such as Figure 5 As shown, the device 500 includes a first control module 501 , a second control module 502 , an acquisition module 503 and a calibration module 504 .
[0090] The first control module 501 is used to control the laser to be turned off, and to capture an image of the calibration device through a camera, and to determine, based on the image, a spatial transformation matrix from a first two-dimensional coordinate system where the camera imaging plane is located to a second two-dimensional coordinate system where the calibration device is located, wherein the plane where the first two-dimensional coordinate system is located and the plane where the second two-dimensional coordinate system is located are both parallel to the horizontal plane;
[0091] The second control module 502 is used to control the laser to start and emit a line structure laser to the surface of the calibration device, obtain a first pixel coordinate of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and a first actual coordinate of the laser line in the second two-dimensional coordinate system, and the laser line is parallel to the axis of the second two-dimensional coordinate system;
[0092] An acquisition module 503 is used to acquire again the second pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the second actual coordinates of the laser line in the second two-dimensional coordinate system after changing the distance between the calibration device and the camera;
[0093] The calibration module 504 is used to calibrate the light plane of the line structured light detection system according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate and the second actual coordinate.
[0094] Optionally, the calibration module 504 is further used for:
[0095] Calculate the angle between the laser line and the horizontal plane according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, and the second actual coordinate;
[0096] The light plane of the line structured light detection system is calibrated according to the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, the second actual coordinate and the angle.
[0097] Optionally, the calibration device includes calibration paper and two rulers, the two rulers are perpendicular to each other and the long sides are arranged parallel to two different sides of the calibration paper, and the two rulers are used to measure the coordinates of the laser line on the calibration paper.
[0098] Optionally, there are multiple circular calibration patterns on the calibration paper and they are evenly distributed on the calibration paper.
[0099] Optionally, the apparatus 500 further includes a determining module, configured to:
[0100] Get the calibration distance and the size of the calibration paper, where the calibration distance is the maximum distance between the calibration device and the camera during calibration;
[0101] According to the calibration distance and size, the radius and number of the circular calibration patterns, as well as the ratio of the radius to the distance between the centers of two adjacent circular calibration patterns are determined.
[0102] Optionally, if the laser is a horizontal line parallel laser, the laser line on the surface of the calibration device is parallel to the horizontal coordinate of the second two-dimensional coordinate system, the first actual coordinate includes the first actual vertical coordinate, the second actual coordinate includes the second actual vertical coordinate, the first pixel coordinate includes the first pixel vertical coordinate, and the second pixel coordinate includes the second pixel vertical coordinate.
[0103] Optionally, if the laser is a grid-type laser, the laser lines on the surface of the calibration device include horizontal laser lines and vertical laser lines that are perpendicular to each other, the horizontal laser lines are parallel to the horizontal coordinates of the second two-dimensional coordinate system, the vertical laser lines are parallel to the vertical coordinates of the second two-dimensional coordinate system, the first actual coordinates include a first actual vertical coordinate and a first actual horizontal coordinate, the second actual coordinates include a second actual vertical coordinate and a second actual horizontal coordinate, the first pixel coordinates include a first pixel vertical coordinate and a first pixel horizontal coordinate, and the second pixel coordinates include a second pixel vertical coordinate and a first pixel horizontal coordinate.
[0104] It can be understood that the device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0105] An embodiment of the present invention further provides an electronic device, which may include a processor and a memory, wherein the processor and the memory may be communicatively connected to each other via a bus or other means.
[0106] The processor may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application, or may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components and other chips, or a combination of the above-mentioned chips.
[0107] The memory may include a large capacity memory for data or instructions. By way of example and not limitation, the memory may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory may include a removable or non-removable (or fixed) medium. Where appropriate, the memory may be inside or outside the electronic device. In a particular embodiment, the memory may be a non-volatile solid-state memory.
[0108] In one example, the memory may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.
[0109] The processor implements any one of the calibration methods for the line structured light detection system in the above embodiments by reading and executing the computer program instructions stored in the memory.
[0110] In one example, the electronic device may further include a communication interface and a bus. Among them, the processor, memory, and communication interface are connected through a bus and communicate with each other. The communication interface is mainly used to realize the communication between the modules, devices, units and / or devices in the embodiment of the present application. Where appropriate, the bus may include one or more buses.
[0111] In addition, in combination with the calibration method of the line structured light detection system in the above embodiments, the embodiment of the present invention can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any calibration method of the line structured light detection system in the above embodiments is implemented.
[0112] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0113] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages:
[0114] An embodiment of the present invention provides a calibration method, device, equipment and medium for a line structured light detection system. The line structured light detection system includes a camera and a laser. The laser is controlled to be turned off, and an image of the calibration device is captured by the camera. According to the image, a spatial transformation matrix from a first two-dimensional coordinate system where the camera imaging plane is located to a second two-dimensional coordinate system where the calibration device is located is determined to obtain a first parameter required for calibrating the light plane of the line structured light detection system. The plane where the first two-dimensional coordinate system is located and the plane where the second two-dimensional coordinate system is located are both parallel to the horizontal plane to ensure that the captured image is positive. The laser is controlled to be turned on and to emit laser light to the surface of the calibration device to obtain a first parameter of the laser line on the surface of the calibration device in the first two-dimensional coordinate system. The pixel coordinates and the first actual coordinates of the laser line in the second two-dimensional coordinate system are used to obtain the second parameter required for calibrating the light plane. The laser line is parallel to the axis of the second two-dimensional coordinate system, which is conducive to better determining the actual coordinates. After changing the distance between the calibration device and the camera, the second pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the second actual coordinates of the laser line in the second two-dimensional coordinate system are obtained again to obtain the third parameter required for calibrating the light plane. According to the spatial variation matrix, the first actual coordinates, the first pixel coordinates, the second actual coordinates and the second actual coordinates, the light plane of the line structured light detection system is calibrated, so that the calibration accuracy is higher, and the calibration method can be applied to various scenarios.
[0115] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0116] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0117] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "one" or "an" preceding a component does not exclude the presence of a plurality of such components. The present invention may be implemented by means of hardware comprising a number of different components and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
Claims
1. A calibration method for a line structured light detection system, characterized in that: The line structured light detection system includes a camera and a laser, and the method includes: Controlling the laser to be turned off, and taking an image of the calibration device through the camera, and determining, according to the image, a spatial transformation matrix from a first two-dimensional coordinate system where the camera imaging plane is located to a second two-dimensional coordinate system where the calibration device is located, wherein the plane where the first two-dimensional coordinate system is located and the plane where the second two-dimensional coordinate system is located are both parallel to a horizontal plane; Control the laser to turn on and emit a line structure laser to the surface of the calibration device, obtain a first pixel coordinate of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and a first actual coordinate of the laser line in the second two-dimensional coordinate system, wherein the laser line is parallel to an axis of the second two-dimensional coordinate system; After changing the distance between the calibration device and the camera, obtaining again the second pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the second actual coordinates of the laser line in the second two-dimensional coordinate system; The light plane of the line structured light detection system is calibrated according to the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, and the second actual coordinate.
2. The calibration method of the line structured light detection system according to claim 1, characterized in that: Calibrate the light plane of the line structured light detection system according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, and the second actual coordinate, including: Calculate the angle between the laser line and the horizontal plane according to the spatial variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate and the second actual coordinate; The light plane of the line structured light detection system is calibrated according to the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate, the second actual coordinate and the angle.
3. The calibration method of the line structured light detection system according to claim 1, characterized in that: The calibration device comprises a calibration paper and two rulers, wherein the two rulers are perpendicular to each other and the long sides are arranged parallel to two different sides of the calibration paper respectively, and the two rulers are used to measure the coordinates of the laser line on the calibration paper.
4. The calibration method of the line structured light detection system according to claim 3, characterized in that: The calibration paper has a plurality of circular calibration patterns which are evenly distributed on the calibration paper.
5. The calibration method of the line structured light detection system according to claim 4, characterized in that: The method further comprises: Acquire a calibration distance and a size of the calibration paper, wherein the calibration distance is a maximum distance between the calibration device and the camera during calibration; The radius and number of the circular calibration patterns, and the ratio of the radius to the distance between the centers of two adjacent circular calibration patterns are determined according to the calibration distance and the size.
6. The calibration method of the line structured light detection system according to claim 1, characterized in that: If the laser is a horizontal line parallel laser, the laser line on the surface of the calibration device is parallel to the horizontal coordinate of the second two-dimensional coordinate system, the first actual coordinate includes the first actual vertical coordinate, the second actual coordinate includes the second actual vertical coordinate, the first pixel coordinate includes the first pixel vertical coordinate, and the second pixel coordinate includes the second pixel vertical coordinate.
7. The calibration method of the line structured light detection system according to claim 1, characterized in that: If the laser is a grid-type laser, the laser lines on the surface of the calibration device include horizontal laser lines and vertical laser lines that are perpendicular to each other, the horizontal laser lines are parallel to the horizontal coordinates of the second two-dimensional coordinate system, the vertical laser lines are parallel to the vertical coordinates of the second two-dimensional coordinate system, the first actual coordinates include a first actual vertical coordinate and a first actual horizontal coordinate, the second actual coordinates include a second actual vertical coordinate and a second actual horizontal coordinate, the first pixel coordinates include a first pixel vertical coordinate and a first pixel horizontal coordinate, and the second pixel coordinates include a second pixel vertical coordinate and a first pixel horizontal coordinate.
8. A calibration device for a line structured light detection system, characterized in that: The line structured light detection system includes a camera and a laser, and the device includes: A first control module is used to control the laser to be turned off, and to capture an image of the calibration device through the camera, and to determine, according to the image, a spatial transformation matrix from a first two-dimensional coordinate system where the camera imaging plane is located to a second two-dimensional coordinate system where the calibration device is located, wherein the plane where the first two-dimensional coordinate system is located and the plane where the second two-dimensional coordinate system is located are both parallel to a horizontal plane; a second control module, used for controlling the laser to turn on and emit a line structure laser to the surface of the calibration device, obtaining a first pixel coordinate of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and a first actual coordinate of the laser line in the second two-dimensional coordinate system, wherein the laser line is parallel to an axis of the second two-dimensional coordinate system; an acquisition module, configured to acquire again the second pixel coordinates of the laser line on the surface of the calibration device in the first two-dimensional coordinate system and the second actual coordinates of the laser line in the second two-dimensional coordinate system after changing the distance between the calibration device and the camera; A calibration module is used to calibrate the light plane of the line structured light detection system according to the space variation matrix, the first actual coordinate, the first pixel coordinate, the second actual coordinate and the second actual coordinate.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.