Multi-laser-line matching method and device, computer equipment and storage medium
By performing laser line coding, fusion and ROI area segmentation on multi-frame laser line images, combining the Steger algorithm to extract the center line of the light bar, and calculating the epipolar constraint equation for matching, the problem of difficult distinction and matching in multiple laser line matching is solved. , improves the matching speed and stability, and provides better light bar center point information for three-dimensional reconstruction.
Patent Information
- Application Number
- CN202410706710.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2024-08-30
AI Technical Summary
Existing laser line matching methods cannot accurately distinguish each laser line when matching multiple laser lines, resulting in reduced matching speed and instability.
By acquiring multi-frame laser line images from at least two cameras, perform image preprocessing, including laser line encoding, image fusion, ROI area segmentation and light strip center line extraction, calculate the epipolar constraint equation and fit a straight line to match the light strip center point .
It achieves accurate distinction and matching of multiple laser lines, improves the matching speed and stability, and provides better light strip center point information for subsequent three-dimensional reconstruction.
Smart Images

Figure CN118570509A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision technology, and in particular, relates to a method, device, computer equipment and storage medium for matching multiple laser lines. Background Art
[0002] The laser line matching method is one of the most important processes in achieving 3D reconstruction. When the correspondence between the laser line and the image is determined, the parallax needs to be calculated. The correspondence between the laser line on the left and right images must be known. This is the purpose of laser line matching. Through the laser line matching technology, the correspondence between the center points of the light strips in the left and right images can be clarified, thereby obtaining the parallax and restoring the information of the center point of the light strip.
[0003] Based on the above laser line matching method, the matching speed of the laser line matching method is acceptable for the matching of a single laser line. However, for the matching of multiple laser lines, the laser line matching method cannot accurately distinguish each laser line, which causes the binocular matching method to reduce the matching speed and fail to ensure stability. Summary of the invention
[0004] In order to make up for the above shortcomings, the present invention provides a method, device, computer equipment and storage medium for matching multiple laser lines, aiming to solve the problem that the existing laser line matching method cannot accurately distinguish multiple laser lines.
[0005] The present invention is specifically achieved in this way:
[0006] In a first aspect, a method for matching multiple laser lines comprises:
[0007] Acquire multiple frames of laser line images from at least two cameras respectively;
[0008] Image preprocessing is performed on the multi-frame laser line images of the two cameras respectively to obtain multiple first light bar center lines and multiple second light bar center lines, the image preprocessing includes laser line encoding and image fusion, ROI area segmentation and light bar center line extraction, the first light bar center line is composed of multiple first light bar center points, and the second light bar center line is composed of multiple second light bar center points; for the same laser line, each of the first light bar center points is matched with the corresponding second light bar center point one by one to obtain the matched light bar center point.
[0009] Furthermore, the laser line coding and image fusion method is:
[0010] Binarizing and segmenting the laser line image to obtain a plurality of image pixel values;
[0011] The pixel flags of the image whose pixel values are greater than the binarization threshold are assigned to the first character, and the pixel flags of the image whose pixel values are less than the binarization threshold are assigned to the second character;
[0012] A plurality of frames of the laser line images are fused to obtain a fused image, wherein the fused image includes the coding values of each of the laser lines.
[0013] Furthermore, the ROI region segmentation method is: segmenting the ROI region corresponding to the laser line in the fused image according to each of the coding values.
[0014] Furthermore, the method for extracting the center line of the light stripe is: using Steger algorithm to determine the center line of the light stripe of each ROI area.
[0015] Furthermore, for the same laser line, matching each of the first light bar center points with the corresponding second light bar center points one by one to obtain the matching light bar center points includes:
[0016] For the same laser line, calculating the epipolar constraint equations of the center points of each first light strip and the corresponding center points of the second light strip;
[0017] For each of the first light strip center points, a straight line is fitted to the N second light strip center points closest to the epipolar constraint equation, and the intersection of the straight line and the epipolar constraint equation is taken as the matching light strip center point.
[0018] Furthermore, the calculation formula of the polar constraint equation is:
[0019]
[0020] Where: u l is the pixel coordinate value of the X-axis of the center point of the first light strip;
[0021] v l is the pixel coordinate value of the Y axis of the center point of the first light strip;
[0022] F is the basic matrix of the camera;
[0023] u r is the pixel coordinate value of the X-axis of the center point of the second light strip;
[0024] v r The pixel coordinate value of the Y axis of the center point of the second light bar.
[0025] In a second aspect, a multiple laser matching device is provided, the device comprising:
[0026] An acquisition module is configured to respectively acquire multiple frames of laser line images from at least two cameras;
[0027] A preprocessing module is configured to perform image preprocessing on the multiple frames of laser line images of the two cameras respectively to obtain multiple first light bar center lines and multiple second light bar center lines, wherein the image preprocessing includes laser line encoding and image fusion, ROI area segmentation, and light bar center line extraction, wherein the first light bar center line is composed of multiple first light bar center points, and the second light bar center line is composed of multiple second light bar center points;
[0028] The matching module is configured to match the center points of each of the first light strips with the corresponding center points of the second light strips one by one for the same laser line, so as to obtain the matching center points of the light strips.
[0029] According to a third aspect, a computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to the first aspect when executing the computer program.
[0030] In a fourth aspect, a computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in the first aspect.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] (1) The present invention encodes the laser lines in advance, which facilitates accurate distinction of different laser lines and helps to obtain the center line of the light strip.
[0033] (2) The present invention can obtain better matching light strip center points by matching the center points of each first light strip with the corresponding center points of the second light strip, which is convenient for subsequent three-dimensional reconstruction. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 is a schematic diagram of the structure of a laser sensor in an embodiment of the present invention;
[0036] Figure 2 is a schematic flow chart of a method for matching multiple laser lines in an embodiment of the present invention;
[0037] Figure 3 Schematic diagram of the structure of ROI area segmentation and light strip centerline extraction in an embodiment of the present invention;
[0038] Figure 4 is a flow chart of step S30 in an embodiment of the present invention;
[0039] Figure 5 is a matching schematic diagram of step S30 in an embodiment of the present invention;
[0040] Figure 6 Schematic diagram of the structure of a plurality of laser line matching devices in an embodiment of the present invention.
[0041] Explanation of reference numerals: 1. camera; 2. laser transmitter; 3. laser line; 100. acquisition module; 200. preprocessing module; 300. matching module. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0045] Please refer to Figure 1 As shown, the method of the present invention can be applied to a laser sensor, which includes at least two cameras 1, a laser emitter 2 and a plurality of laser lines 3 (i.e., laser light sources), wherein the laser emitter 2 is located between the two cameras 1, and the plurality of laser lines 3 are arranged relative to each camera 1 and the laser emitter 2.
[0046] For example, the present invention expands and explains the laser line 3 into seven.
[0047] When taking pictures, the camera 1 of the present invention obtains the laser line 3 image in a three-frame exposure mode. The three-frame exposures are sequentially short exposure of the first frame image, long exposure of the second frame image, and short exposure of the third frame image. That is, one frame of the laser line 3 image will be obtained for each exposure.
[0048] For example, when the laser intensity is fixed at I, the long exposure time of the second frame image can be D seconds, and the short exposure time of the first frame image and the short exposure time of the third frame image can be D / M seconds. I is generally [46%, 85%], D is generally [1 / 1350, 1 / 530], and M is generally [3, 5].
[0049] Combined with the three-frame exposure method of the camera 1 when taking pictures, the control method of the laser line 3 of the present invention is:
[0050] When the first frame image is short-exposed, laser lines 4, 5, 6 and 7 are turned on.
[0051] When the second frame image is exposed for a long time, laser lines 2, 3, 4 and 5 are turned on.
[0052] When the third frame image is short-exposed, laser lines 3 of No. 1, No. 2, No. 5 and No. 6 are turned on.
[0053] Before acquiring multiple frames of laser line 3 images, camera 1 calibration may be performed and the intrinsic parameters and basic matrices of the two cameras 1 may be acquired.
[0054] For example, the intrinsic parameters of a camera 1 are: The internal parameters of another camera 1 are: The basic matrix is:
[0055]
[0056] Please refer to Figure 2 As shown, the present invention provides a method for matching multiple laser lines, comprising the following steps:
[0057] S10, acquiring multiple frames of laser line images from at least two cameras 1 respectively.
[0058] S20, performing image preprocessing on the multi-frame laser line images of the two cameras 1 respectively to obtain multiple first light stripe center lines and multiple second light stripe center lines, wherein the image preprocessing includes laser line encoding and image fusion, ROI area segmentation, and light stripe center line extraction, wherein the first light stripe center line is composed of multiple first light stripe center points, and the second light stripe center line is composed of multiple second light stripe center points.
[0059] It should be noted that the ROI area, or region of interest, is an area to be processed that is outlined in the image being processed in the form of a box, circle, ellipse, irregular polygon, etc. in machine vision and image processing.
[0060] Specifically, multiple first light strip center lines correspond to seven laser lines 3 photographed by one camera 1, and multiple second light strip center lines correspond to seven laser lines 3 photographed by another camera 1; based on the pixel encoding of each first light strip center line and each second light strip center line, the second light strip center line corresponds one-to-one to the first light strip center line.
[0061] S30, for the same laser line 3, matching each of the first light strip center points with the corresponding second light strip center points one by one to obtain matching light strip center points.
[0062] Specifically, for the same laser line 3, by matching the center points of each first light strip with the corresponding center point of the second light strip, a better matching center point of the light strip can be obtained, which is convenient for subsequent three-dimensional reconstruction.
[0063] In a possible implementation, the laser line coding and image fusion method is:
[0064] The laser line image is binarized and segmented to obtain a plurality of image pixel values.
[0065] Specifically, the binary segmentation can adopt the OTSU algorithm.
[0066] The pixel flags of the image whose pixel values are greater than the binarization threshold are assigned to the first character, and the pixel flags of the image whose pixel values are less than the binarization threshold are assigned to the second character.
[0067] For example, the first character is 1 and the second character is 0.
[0068] A plurality of frames of the laser line images are fused to obtain a fused image, wherein the fused image includes the coding values of each of the laser lines 3 .
[0069] Table: Control methods and coding values of each laser line 3
[0070]
[0071] In a possible implementation manner, the ROI region segmentation method is: segmenting the ROI region corresponding to the laser line 3 in the fused image according to each of the coding values.
[0072] Specifically, based on the above table, take laser line 3 No. 1 as an example. The ROI area of laser line 3 No. 1 is segmented in the fused image by the coding value 001. Similarly, the ROI areas of laser lines 3 No. 2 to 3 No. 7 can be obtained respectively. By segmenting the ROI area, the position of each laser line 3 can be quickly determined, which is convenient for subsequent identification of each laser line 3.
[0073] In a possible implementation, the method for extracting the light strip center line is: using a Steger algorithm to determine the light strip center line of each ROI region.
[0074] Specifically, in each of the ROI regions, the brightness of the laser line 3 gradually decreases from the middle to the edge. By determining the center of the light bar in each ROI region, it is easier to identify the center point of each light bar center line.
[0075] Please refer to Figure 3 and 4 As shown, in a possible implementation manner, S30 includes S31 - S32.
[0076] S31, for the same laser line 3, calculating the epipolar constraint equations of the center points of each first light strip and the corresponding center points of the second light strip.
[0077] The calculation formula of the polar constraint equation is:
[0078]
[0079] Where: u l is the pixel coordinate value of the X-axis of the center point of the first light strip;
[0080] v l is the pixel coordinate value of the Y axis of the center point of the first light strip;
[0081] F is the basic matrix of camera 1;
[0082] u r is the pixel coordinate value of the X-axis of the center point of the second light strip;
[0083] v r The pixel coordinate value of the Y axis of the center point of the second light bar.
[0084] S32, for each of the first light bar center points, fitting a straight line to the N second light bar center points closest to the epipolar constraint equation, and taking the intersection of the straight line and the epipolar constraint equation as the matching light bar center point.
[0085] Specifically, take the first light strip center line and the second light strip center line corresponding to laser line 3 No. 1 as an example. Assume that a first light strip center point in the first light strip center line is obtained as (421.91, 172.10, 1), substitute the first light strip center point into the epipolar constraint equation, and get 0.0229×u+0.1412×v-35.946=0. Assume that N is 3, take the three second light strip center points closest to the epipolar constraint equation in the second light strip center line to fit the straight line. Assume that the three second light strip center points are (250.12, 214.32), (251.09, 214.29) and (252.11, 214.25) respectively. After fitting the straight line with the three second light strip center points, get 0.0352×u+v-223.1282=0. By combining the two polar constraint equations, we get the intersection point (247.65,214.41).
[0086] By calculating the remaining first light strip center points of the first light strip center line in this way, the first light strip center line corresponding to laser line 3 No. 1 and the second light strip center line can be matched. Similarly, the first light strip center line corresponding to laser line 3 No. 2 to laser line 3 No. 7 and the second light strip center line can be matched.
[0087] Please refer to Figure 5 As shown, the present invention provides a multi-laser matching device, the device comprising:
[0088] An acquisition module 100 is configured to respectively acquire multiple frames of laser line images from at least two cameras 1;
[0089] The preprocessing module 200 is configured to perform image preprocessing on the multiple frames of laser line images of the two cameras 1 respectively to obtain multiple first light stripe center lines and multiple second light stripe center lines, wherein the image preprocessing includes laser line encoding and image fusion, ROI area segmentation, and light stripe center line extraction, wherein the first light stripe center line is composed of multiple first light stripe center points, and the second light stripe center line is composed of multiple second light stripe center points;
[0090] The matching module 300 is configured to match each of the first light bar center points with the corresponding second light bar center points one by one for the same laser line 3 to obtain matching light bar center points.
[0091] The present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0092] The present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0093] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0094] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for matching multiple laser lines, characterized in that: The method comprises: Acquire multiple frames of laser line images from at least two cameras respectively; Performing image preprocessing on the multi-frame laser line images of the two cameras respectively to obtain a plurality of first light bar center lines and a plurality of second light bar center lines, wherein the image preprocessing includes laser line encoding and image fusion, ROI area segmentation, and light bar center line extraction, wherein the first light bar center line is composed of a plurality of first light bar center points, and the second light bar center line is composed of a plurality of second light bar center points; For the same laser line, each center point of the first light strip is matched with the corresponding center point of the second light strip one by one to obtain the matching center point of the light strip.
2. The method for matching multiple laser lines according to claim 1, characterized in that: The method of laser line coding and image fusion is: Binarizing and segmenting the laser line image to obtain a plurality of image pixel values; The pixel flags of the image whose pixel values are greater than the binarization threshold are assigned to the first character, and the pixel flags of the image whose pixel values are less than the binarization threshold are assigned to the second character; A plurality of frames of the laser line images are fused to obtain a fused image, wherein the fused image includes the coding values of each of the laser lines.
3. The method for matching multiple laser lines according to claim 2, characterized in that: The method for segmenting the ROI region is: segmenting the ROI region corresponding to the laser line in the fused image according to each of the coding values.
4. The method for matching multiple laser lines according to claim 3, characterized in that: The method for extracting the light strip center line is: using the Steger algorithm to determine the light strip center line of each ROI area.
5. The method for matching multiple laser lines according to claim 1, characterized in that: For the same laser line, matching each of the first light bar center points with the corresponding second light bar center points one by one to obtain the matching light bar center points includes: For the same laser line, calculating the epipolar constraint equations of the center points of each first light strip and the corresponding center points of the second light strip; For each of the first light strip center points, a straight line is fitted to the N second light strip center points closest to the epipolar constraint equation, and the intersection of the straight line and the epipolar constraint equation is taken as the matching light strip center point.
6. The method for matching multiple laser lines according to claim 5, characterized in that: The calculation formula of the polar constraint equation is: Where: u l is the pixel coordinate value of the X-axis of the center point of the first light strip; v l is the pixel coordinate value of the Y axis of the center point of the first light strip; F is the basic matrix of the camera; u r is the pixel coordinate value of the X-axis of the center point of the second light strip; v r The pixel coordinate value of the Y axis of the center point of the second light bar.
7. A multi-laser matching device, characterized in that: The device comprises: An acquisition module is configured to respectively acquire multiple frames of laser line images from at least two cameras; A preprocessing module is configured to perform image preprocessing on the multiple frames of laser line images of the two cameras respectively to obtain multiple first light bar center lines and multiple second light bar center lines, wherein the image preprocessing includes laser line encoding and image fusion, ROI area segmentation, and light bar center line extraction, wherein the first light bar center line is composed of multiple first light bar center points, and the second light bar center line is composed of multiple second light bar center points; The matching module is configured to match the center points of each of the first light strips with the corresponding center points of the second light strips one by one for the same laser line, so as to obtain the matching center points of the light strips.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. 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 according to any one of claims 1 to 6 are implemented.
