Method and device for extracting center line of light strip of single-line laser, and three-dimensional reconstruction method of object

By processing the images to be processed in segments and filtering candidate points, the problem of inaccurate extraction of the center position of the laser light bar in high-reflection scenes is solved, and high-precision, real-time and robust laser light bar centerline extraction is achieved.

CN119478022APending Publication Date: 2025-02-18SHENZHEN ANHUA OPTOELECTRONICS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411450415.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The prior art extracts the central position of a single-line laser strip in high-reflection scenarios, and lacks real-time and robustness, making it difficult to meet the high requirements of industrial measurement for accuracy and speed.

Method used

The image to be processed is processed in a segmented manner, and the candidate points are filtered in each column through a sliding window, and whether the candidate points are located in the center area of ​​the sub-image is determined, and the center line of the laser bar is determined based on the grayscale value of the candidate points.

Benefits of technology

It improves the accuracy and real-time performance of laser light bar centerline extraction, enhances robustness, and is particularly outstanding in industrial measurements in high-reflection scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478022A_ABST
    Figure CN119478022A_ABST
Patent Text Reader

Abstract

The invention provides a method and a device for extracting a center line of a single-line laser strip, an object three-dimensional reconstruction method and system, electronic equipment and a computer readable storage medium, and the method for extracting the center line comprises the steps: firstly screening candidate points, moving a sliding window to enable the sliding window to traverse a to-be-processed image, and carrying out the extraction of all sub-images corresponding to the sliding window, extracting a central point of the sub-image and judging whether the central point is located in a central area if the pixel with the gray value larger than the gray threshold exists, if yes, judging whether the number of candidate points in the column where the current central point is located is equal to a preset number, and if not, taking the current central point as the candidate point of the column; if yes, whether the gray value of the current center point is larger than the gray value of the last candidate point corresponding to the column or not is judged, and if yes, the current center point serves as the last candidate point of the corresponding column; and determining the center line of the laser light bar of the image to be processed according to the candidate points. The center line extraction speed is high, the precision is high, and the robustness is good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of three-dimensional reconstruction in computer vision, and in particular to a method and device for extracting the center of a single-line laser light strip, a method and system for three-dimensional reconstruction of an object, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the development of laser technology, line laser 3D scanning has been applied to many industries, such as industrial measurement and positioning, cultural relics protection, entertainment industry, etc., especially in industrial measurement, optical measurement has been more widely used due to its high measurement accuracy, fast measurement speed, good adaptability and other characteristics. With the deepening of industrial digitalization and intelligent transformation, and the gradual advancement of intelligent manufacturing, industrial machine vision has gradually formed a large-scale industry, and with the implementation of artificial intelligence technology in the industrial field, it has gradually penetrated into various scenarios of industrial production. With the increasing requirements of industrial control for accuracy and automation, 3D machine vision will be demonstrated in many "pain point application scenarios" and become one of the hottest technologies in current intelligent manufacturing. Among them, the line laser 3D profiler is a typical representative of this type of 3D machine vision.

[0003] The line laser 3D profiler uses the principle of laser triangulation: a line laser beam is projected onto the surface of the object to be measured, and then imaged on the photosensitive component through the optical system. The distance Z from the sensor to the surface to be measured and the position information along the laser line (X axis) are calculated by the algorithm using the calibrated system parameters. The object to be measured or the profiler probe is then moved by a precision motion platform to obtain the entire three-dimensional scanning data. Among them, in the line laser 3D profiler, the extraction of the center position of the line laser is very important, because it is a key step in generating three-dimensional point cloud data of the object surface, which affects the captured tiny details of the object surface, such as texture, bumps and curvature, affecting the quality of the point cloud, and thus affecting the accuracy of the measurement.

[0004] In the prior art, the centerline extraction algorithms for single-line laser light strips can be divided into extreme value method, geometric center method, grayscale centroid method and Steger algorithm. However, when dealing with stray light, the center position of the extracted line laser is not accurate enough or even wrong, and the real-time performance and robustness are not high. However, in the industrial field, there are many scenes with high reflection. Therefore, there is an urgent need for a line laser center extraction algorithm that is fast, robust and good. Summary of the invention

[0005] Based on the above situation, the main purpose of the present invention is to provide a method and device for extracting the center of a single-line laser light strip, a method and system for reconstructing a three-dimensional object, an electronic device and a computer-readable storage medium. When applied to highly reflective objects to be measured, the extracted center line of the light strip can still be guaranteed to have high accuracy, good real-time performance, high robustness, etc.

[0006] To achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0007] A first aspect of the present invention provides a method for extracting a center line of a single-line laser light strip, comprising:

[0008] Candidate point screening step S20: setting a sliding window according to the width of the laser light strip on the image to be processed, moving the sliding window in sequence to traverse the image to be processed, and performing the following steps at each position of the sliding window;

[0009] S21: taking the area of ​​the image to be processed corresponding to the sliding window as a sub-image, determining whether there is a pixel with a grayscale value greater than a grayscale threshold in the sub-image, if so, extracting the center point of the sub-image, and determining whether the center point is located in the central area of ​​the sub-image, if so, executing step S22;

[0010] S22: Determine whether the number of candidate points in the column where the current center point is located is equal to the preset number. If not, take the current center point as the candidate point of the column; if so, execute step S23;

[0011] S23: Determine whether the grayscale value of the current center point is greater than the grayscale value of the last candidate point corresponding to the column. If so, take the current center point as the last candidate point of its corresponding column.

[0012] Wherein, it is assumed that the laser light strip on the image to be processed extends in the row direction; the length of the sliding window is 1 pixel;

[0013] Centerline determination step S40: determining the centerline of the laser light stripe of the image to be processed according to the positions of all candidate points in the image to be processed and their grayscale values.

[0014] Preferably, before step S20, step S10 is also included: setting a candidate matrix according to the image to be processed, the number of columns of the candidate matrix is ​​equal to the number of columns of the image to be processed, the number of rows is the preset number, and a default value is set for each element in the candidate matrix;

[0015] In the step S20, the sliding window traverses the image to be processed by columns, and in the same column, the elements of the corresponding column of the candidate matrix are updated in sequence starting from the first element using the determined position coordinates of the candidate points.

[0016] Preferably, in step S20, the preset number is greater than or equal to 5.

[0017] Preferably, in step S20, the width of the sliding window is 1 to 2 times the width of the laser light strip on the image to be processed.

[0018] Preferably, in step S21, a weighted grayscale centroid method is used to extract the center point of the sub-image.

[0019] Preferably, the step S40 comprises the steps of:

[0020] Among the candidate points in the first column, the candidate point with the largest gray value is used as the first connection point of the center line;

[0021] For the remaining columns, the candidate point closest to the connection point of the previous column among all the candidate points in the column is used as the connection point of the column;

[0022] The center line is obtained by connecting the connection points.

[0023] Preferably, the step S20 further includes the following steps:

[0024] S00: acquiring an original image projected by a single-line laser onto the object to be measured, and performing Gaussian filtering on the original image to obtain the image to be processed.

[0025] A second aspect of the present invention provides a device for extracting the center line of a single-line laser light strip, comprising:

[0026] a candidate point determination unit, for setting a sliding window according to the width of the laser light strip on the image to be processed, moving the sliding window in sequence to traverse the image to be processed, and at each position of the sliding window, taking the area on the image to be processed corresponding to the sliding window as a sub-image, and judging whether there are pixels in the sub-image whose grayscale value is greater than the grayscale threshold value; if so, extracting the center point of the sub-image, and judging whether the center point is located in the central area of ​​the sub-image; if so, judging whether the number of candidate points in the column where the current center point is located is equal to a preset number; if not, taking the current center point as the candidate point of the column; if so, judging whether the grayscale value of the current center point is greater than the grayscale value of the last candidate point corresponding to the column; if so, taking the current center point as the last candidate point of its corresponding column;

[0027] Wherein, it is assumed that the laser light strip on the image to be processed extends in the row direction; the length of the sliding window is 1 pixel;

[0028] The center line determination unit is used to determine the center line of the laser light strip of the image to be processed according to the positions of all candidate points in the image to be processed and their grayscale values.

[0029] A third aspect of the present invention provides a method for three-dimensional reconstruction of an object, comprising the steps of:

[0030] Acquire the original image of the single-line laser light strip projected onto the object to be measured;

[0031] Processing the original image using any of the above-mentioned methods for extracting the center line of the single-line laser light stripe to extract the center line of the laser light stripe;

[0032] The object to be measured is three-dimensionally reconstructed based on the obtained center line of the laser light strip.

[0033] A fourth aspect of the present invention provides a system for three-dimensional reconstruction of an object, comprising:

[0034] An acquisition module, used for acquiring an original image of a single-line laser light strip projected onto the object to be measured;

[0035] A centerline extraction module, used to process the original image using any of the above-mentioned single-line laser light strip centerline extraction methods to extract the centerline of the laser light strip;

[0036] The three-dimensional reconstruction module is used to perform three-dimensional reconstruction of the object to be measured based on the obtained center line of the laser light strip.

[0037] A fifth aspect of the present invention provides an electronic device, comprising:

[0038] A single-line laser is used to project a laser light strip onto the object to be measured;

[0039] A collection device for collecting images of the laser light strips on the object to be measured;

[0040] A processor, comprising the above-mentioned object three-dimensional reconstruction system;

[0041] Wherein, the acquisition device is connected to the processor signal.

[0042] Preferably, the electronic device is a 3D profile scanner.

[0043] The sixth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it implements the method for extracting the center line of a single-line laser light strip as described in any one of the above items, or implements the method for three-dimensional reconstruction of an object as described above.

[0044] The present invention processes the image to be processed in a segmented manner, and uses a sliding window to divide each column of the image to be processed into multiple sub-images, first extracting candidate points of each column, thereby screening out possible positions of the center line of the laser light strip in each column, and then determining the center line of the laser light strip according to the position of the candidate points of each column in the processed image and their grayscale values. In the extraction of candidate points of each column, if there are pixels greater than the grayscale threshold in the sub-images corresponding to each sliding position, it is determined whether the center point is located in the central area of ​​the sub-image, so as to avoid the situation where the candidate points obtained are only the boundary points of the laser light strip, so that the pixel points that may be the center line of the laser light strip in each column of pixels can be extracted, thereby improving the final determination of the center point according to the candidate points. line accuracy; and in order to avoid too much stray light in each column affecting the extraction speed, the number of candidate points in each column is set in the present invention, and the one with the larger grayscale value of the two is used as the last candidate point by judging whether the grayscale value of the newly added possible candidate point is greater than the grayscale value of the last candidate point, because the point with the larger grayscale value may be the point at the center line of the laser light strip. Therefore, this method not only ensures various possible points on or near the center line, but also reduces the amount of calculation in determining the center line through candidate points in the later stage, thereby improving the efficiency of the entire algorithm, and improving the extraction efficiency of the entire center line. It has the advantages of high real-time performance and good robustness, especially in industrial measurement of highly reflective objects to be measured.

[0045] Other beneficial effects of the present invention will be explained in the specific implementation manner through the introduction of specific technical features and technical solutions. Through the introduction of these technical features and technical solutions, those skilled in the art should be able to understand the beneficial technical effects brought about by the technical features and technical solutions. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Preferred embodiments of the present invention will be described below with reference to the accompanying drawings.

[0047] Figure 1 A schematic flow chart of a preferred embodiment of a method for extracting the center line of a single-line laser light strip provided by the present invention;

[0048] Figure 2 Schematic diagram of light intensity distribution in the cross section of the laser light strip;

[0049] Figure 3-Figure 6 are respectively an image to be processed and the center line extraction method, the Steger algorithm and the grayscale centroid method of the present invention are respectively used for Figure 3 The center line of the image to be processed is obtained by performing center line analysis;

[0050] Figure 7-Figure 10 are another image to be processed and the center line extraction method, Steger algorithm and grayscale centroid method of the present invention are respectively used for Figure 7The center line of the image to be processed is obtained by performing center line analysis;

[0051] Fig.11 A schematic flow chart of a preferred implementation of the method for three-dimensional reconstruction of an object provided by the present invention;

[0052] Fig.12 It is a diagram of a specific embodiment after the object to be measured is three-dimensionally reconstructed using the object three-dimensional reconstruction method of the present invention. DETAILED DESCRIPTION

[0053] The present invention is described below based on embodiments, but the present invention is not limited to these embodiments. In the following detailed description of the present invention, some specific details are described in detail. In order to avoid confusing the essence of the present invention, known methods, processes, procedures, and components are not described in detail.

[0054] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.

[0055] Unless the context clearly requires otherwise, throughout the specification and claims, the words "include", "comprising" and similar words should be interpreted in an inclusive sense rather than an exclusive or exhaustive sense; that is, in the sense of "including but not limited to".

[0056] In the description of the present invention, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, "plurality" means two or more.

[0057] The present invention provides a method for extracting the center line of a single-line laser light strip, which can be applied to reverse engineering, medical assistance, defect detection, industrial measurement and positioning, cultural relic protection, entertainment and other fields. It can be applied to electronic equipment in these fields and can be used in conjunction with lasers, cameras and the like to perform three-dimensional reconstruction of objects. For example, it can be applied to scanners in multiple fields, especially 3D contour scanners, which can detect the contours of devices such as energy storage batteries and mobile phones, as well as their components, metal models such as dental molds and the like.

[0058] In practical applications, a single-line laser projects a single-line laser light strip onto the object to be measured, and a collection device collects the image of the laser light strip on the object to be measured, such as Figure 3 , Figure 7As shown in the figure, in these images, not only a single-line laser light strip is displayed, but also stray light images may be displayed. Especially when a highly reflective object to be tested is detected, stray light often exists in the image. Even if the method for extracting the center line of the laser light strip of the present invention processes these images containing stray light, it can ensure that the extraction method has the advantages of high robustness, high precision and real-time performance. In the image captured by the acquisition device, the approximate extension direction of the laser light strip is either along the row direction of the image (i.e. Figure 3 , Figure 7 ), or along the column direction of the image (i.e. Figure 3 , Figure 7 In any case, the centerline can be extracted by the extraction method of the present invention. It should be noted that the "rows" and "columns" in the text are only for the convenience of description and are two directions in the set image. In practice, the "rows" and "columns" in the text can be adjusted according to the state of the image presentation and the extension direction of the laser light strip in the image.

[0059] like Figure 1 As shown, the method for extracting the center line of a single-line laser light strip includes:

[0060] Candidate point screening step S20: setting a sliding window according to the width of the laser light strip on the image to be processed, moving the sliding window in sequence to traverse the image to be processed, determining the candidate points of each column on the image to be processed, and performing the following steps at each position of the sliding window;

[0061] S21: taking the area corresponding to the sliding window on the image to be processed as a sub-image, determining whether there is a pixel with a gray value greater than the gray threshold in the sub-image, if so, extracting the center point of the sub-image, and determining whether the center point is located in the central area of ​​the sub-image, if so, executing step S22;

[0062] S22: Determine whether the number of candidate points in the column where the current center point is located is equal to the preset number. If not, take the current center point as the candidate point of the column; if so, execute step S23;

[0063] S23: Determine whether the grayscale value of the current center point is greater than the grayscale value of the last candidate point corresponding to the column. If so, take the current center point as the last candidate point of its corresponding column.

[0064] In which, it is assumed that the laser light strip on the image to be processed is along the row direction ( Figure 3 , Figure 7 As shown, that is, the horizontal direction in the figure), the width of the sliding window is in the column direction ( Figure 3 , Figure 7As shown, the number of pixels in the vertical direction (i.e., the number of pixels in the vertical direction in the figure) is determined according to the width of the laser light strip, i.e., 2W, and the length, i.e., the number of pixels in the row direction, is set to 1, that is, the size of the sliding window is 2W×1.

[0065] In step S20, by moving the sliding window, the points in each column of the image to be processed that may be the center point of the laser light stripe or its vicinity are screened out, so that at least one candidate point can be screened out for each column where the laser light stripe is located. Specifically, whether each sub-image has a possible candidate point needs to meet the following candidate conditions:

[0066] (1) The pixels in the sub-image have grayscale values ​​greater than the grayscale threshold;

[0067] (2) The center point of the sub-image is located in the central area of ​​the sub-image, which can be the central position or a certain area centered on the central position (such as extending a number of pixels in four directions with the central position as the center). The center point of the sub-image refers to the gray center of the image, which can be calculated by the gray centroid method.

[0068] In each column, the first several possible candidate points are directly used as candidate points of the column. However, considering that the pixels on the stray light may also be used as candidate points, if all possible candidate points are used as candidate points when there are many stray light points, there will be too many stray light points included, which may affect the subsequent centerline extraction speed. In order to avoid too many candidate points being screened out and the amount of calculation for extracting the centerline according to the candidate points being too large, thus affecting the extraction efficiency, the present invention limits the number of candidate points in each column, that is, sets a preset number. When processing the same column of sub-images on the image to be processed, the subsequent Although the center point of a sub-image also meets the above conditions for being a possible candidate point, it is still necessary to determine whether the number of candidate points in the corresponding column of the possible candidate point is equal to the preset number. If not, the possible candidate point is directly used as the candidate point of the corresponding column; if so, the grayscale value of the possible candidate point is compared with the grayscale value of the last candidate point in the preset number. If it is greater than the grayscale value of the last candidate point, the center point of the subsequent sub-image (i.e., the backup candidate point) is used to replace the last candidate point in the preset number. Otherwise, the center point of the subsequent sub-image is not used as a candidate point in the column.

[0069] Centerline determination step S40: determining the centerline of the laser light stripe of the image to be processed according to the positions of all candidate points in the image to be processed and their grayscale values.

[0070] The candidate points of the same column are points or stray light points on the segment of the laser light strip on the corresponding column of the image to be processed. In this step, an ideal center line of the laser light strip is determined based on these points of each column.

[0071] In the above embodiment, it is assumed that the extension of the laser light strip in the image to be processed is roughly along the row direction, that is, the number of pixels occupied by the laser light strip in the image to be processed in the row direction is greater than the number in the column direction. In the present invention, the laser light strip is divided into a plurality of small segments in the row direction, each column includes a small segment of the laser light strip, and the center of the laser light strip is processed in a segmented manner. Specifically, first, the width of the sliding window (i.e., the number of pixels along the row direction) is set to one pixel, and the height (i.e., the number of pixels along the column direction) is set to 2W according to the width of the laser light strip. The sliding window is used to slide each column of the image to be processed to form multiple sub-images (i.e., the part of the image to be processed corresponding to each position when the sliding window slides). The local image is processed. For each sub-image, if there are pixels with gray values ​​greater than the gray threshold, it means that there may be points on the laser light strip in the sub-image (of course, there may also be points of stray light). At this time, if the center point of the sub-image is located in the central area of ​​the sub-image, it means that the center point is at least not a boundary point on the laser light strip. Therefore, it is used as a candidate point. In this way, by judging whether the center point of the sub-image is located in the central area, it is possible to avoid missing any point in each column that may be on the center line of the laser light strip, and avoid the problem of increasing the amount of calculation in the subsequent center line extraction by using the boundary point of the laser light strip as a candidate point, thereby improving the center line extraction efficiency and increasing the real-time performance of three-dimensional reconstruction.

[0072] The present invention processes the image to be processed in a segmented manner, and uses a sliding window to divide each column of the image to be processed into multiple sub-images, first extracting candidate points of each column, thereby screening out possible positions of the center line of the laser light strip in each column, and then determining the center line of the laser light strip according to the position of the candidate points of each column in the processed image and their grayscale values. In the extraction of candidate points of each column, if there are pixels greater than the grayscale threshold in the sub-images corresponding to each sliding position, it is determined whether the center point is located in the central area of ​​the sub-image, so as to avoid the situation where the candidate points obtained are only the boundary points of the laser light strip, so that the pixel points that may be the center line of the laser light strip in each column of pixels can be extracted, thereby improving the final determination of the center point according to the candidate points. line accuracy; and in order to avoid too much stray light in each column affecting the extraction speed, the number of candidate points in each column is set in the present invention, and the one with the larger grayscale value of the two is used as the last candidate point by judging whether the grayscale value of the newly added possible candidate point is greater than the grayscale value of the last candidate point, because the point with the larger grayscale value may be the point at the center line of the laser light strip. Therefore, this method not only ensures various possible points on or near the center line, but also reduces the amount of calculation in determining the center line through candidate points in the later stage, thereby improving the efficiency of the entire algorithm, and improving the extraction efficiency of the entire center line. It has the advantages of high real-time performance and good robustness, especially in industrial measurement of highly reflective objects to be measured.

[0073] In step S20, when the sliding window traverses the rows, it may be executed for each row, that is, except for the first several rows and the last several rows of the image to be processed, the center of the sliding window will traverse other rows; it may also be executed according to alternate rows, that is, even except for the first several rows and the last several rows of the image to be processed, the center of the sliding window will not traverse other rows, but will traverse each row at intervals of a preset number of rows, such as half of the width of the sliding window, that is, W rows. In order to avoid missing stray light points, preferably, except for the first several rows and the last several rows of the image to be processed, the center of the sliding window will traverse other rows.

[0074] When the sliding window is traversing, the sliding window can first traverse each column of the image to be processed by row, such as starting from the first row of the image to be processed, traversing each column of the first row first, and then moving to the next preset row to repeat; the sliding window can also traverse each row of the sliding window by column, such as starting from the first column of the image to be processed, traversing each row of the first column first (if the row is traversed in an alternate row manner, the required traversal rows are traversed in the alternate row manner), after traversing each row of the first column, moving to the second column.

[0075] Regardless of which traversal method is selected, in step S20, the preset number of candidate points in each column may be equal or unequal. In a preferred embodiment, the preset number of candidate points in each column is equal. In this embodiment, the candidate points can be stored in a matrix for easy processing. The number of columns of the candidate matrix can be set equal to the number of columns of the candidate points. In order to reduce the calculation of the space occupied by the laser light strip in the row direction in advance and further improve the extraction efficiency of the center line, it is preferred to set the number of columns of the candidate matrix equal to the number of columns of the image to be processed. In this way, each column of the candidate matrix corresponds to each column on the image to be processed one by one, which can also make the logic of subsequent steps simpler and reduce the probability of errors during program editing. In the candidate matrix, only the position coordinates of each candidate point, that is, the row coordinates and column coordinates in the image to be processed, can be stored, or its position coordinates and grayscale values ​​can be stored together.

[0076] In a preferred embodiment, in order to save storage space occupied by the system, the candidate matrix only stores the position coordinates of each candidate point. Specifically, before step S20, the following steps are also included:

[0077] Candidate matrix setting step S10: Set the candidate matrix according to the image to be processed, the number of columns of the candidate matrix is ​​equal to the number of columns of the image to be processed, the number of rows is the preset number, and a default value is set for each element in the candidate matrix. That is, in this embodiment, the preset number of candidate points in each column is the same, wherein the default value of each element in the candidate matrix is ​​mainly used to distinguish from the coordinate value of the candidate point, such as when implemented in the program, it can be set to NAN or inf.

[0078] In step S20, the sliding window traverses the image to be processed column by column, and in the same column, the elements of the corresponding column of the candidate matrix are updated in sequence starting from the first element using the determined position coordinates of each candidate point.

[0079] In this embodiment, in the candidate point screening step S20, after the sliding window is determined, the sliding window is first used to traverse the first column of the image to be processed, so that the center of the sliding window traverses each row of the first column (that is, except for the first and last rows), that is, the sliding window is first moved to be located in the upper left corner of the image to be processed, and the sub-image corresponding to the sliding window at this position is judged whether it has a possible candidate point and whether it can be used as a candidate point; then the sliding window is moved downward so that the center of the sliding window moves to the next row of the row just located, and the rows of the first column are traversed in this way. After the first column is traversed, it is transferred to the second column, and then the traversal and judgment of possible candidate points and candidate points are performed in the same way as the traversal of the first column. This cycle is repeated until all columns of the image to be processed are traversed. When executed in the program, after the sliding window is set in step S20, each column in the image to be processed can be processed according to the following steps:

[0080] S201: Move the sliding window to the top of the current column, and set the candidate row index value corresponding to the column in the candidate matrix to 1;

[0081] S202: taking the area of ​​the sliding window at the current position on the image to be processed as the current sub-image, determining whether there is a pixel with a gray value greater than the gray threshold in the current sub-image, if so, extracting the center point of the current sub-image, and determining whether the center point is located in the central area of ​​the current sub-image, if so, executing step S203;

[0082] S203: Determine whether the number of candidate points in the candidate matrix corresponding to the current center point is equal to the preset number. If not, take the current center point as the candidate point at the current index value position in the corresponding column of the candidate matrix, and add 1 to the candidate row. If yes, execute step S204;

[0083] S204: Determine whether the gray value of the current center point is greater than the gray value of the last candidate point in the corresponding column of the candidate matrix. If so, update the last candidate point with the current center point.

[0084] S205: Determine whether the current sliding window has traversed the current column of the image to be processed. If so, the column ends; if not, move the sliding window down one row and go to step S202.

[0085] The above preset number is generally selected to be greater than or equal to 3, representing the upper, middle and lower positions centered on the laser light strip. Preferably, the preset number is greater than or equal to 5, such as the preset number is 5, 6, 7, etc. More preferably, the preset number is 5, representing the upper, middle upper, middle, middle lower and lower positions centered on the laser light strip in the column direction. In this way, the center of the laser light strip and the points near the upper and lower sides thereof can be basically covered, thereby further improving the accuracy of subsequent centerline extraction. Of course, in the case where there are no stray light spots on the image to be processed, the preset number can also be selected to be 1.

[0086] The width 2W of the sliding window is generally at least greater than or equal to the width of the laser light stripe, that is, the width 2W of the sliding window is selected to be at least the number of pixels occupied by the laser light stripe in the column direction. Preferably, the width of the sliding window is 1 to 2 times, such as 1.5 times or 2 times, of the width of the laser light stripe on the image to be processed. In this way, the laser light stripe can be processed without omission and the calculation efficiency can be improved. Of course, the sliding window can also be more times the width of the laser light stripe.

[0087] In step S20, the central area of ​​the sub-image is not limited to the middle position of the sub-image, that is, the position is not limited to one pixel, but refers to the sub-image extending a certain number of pixels in four directions with the middle point, such as the area where 3×3, 4×4, or 4×6 pixels are located in the middle of the sub-image.

[0088] The center point of the sub-image can be extracted by using the center point extraction method in the prior art, such as a non-weighted grayscale centroid method or a weighted grayscale centroid method. In a preferred embodiment of the present invention, in step S21, a weighted grayscale centroid method is used to extract the center point of the sub-image, specifically a Gaussian weighted grayscale centroid method, to improve the extraction accuracy of the sub-image center point, thereby improving the accuracy of the candidate points, and ultimately increasing the extraction accuracy of the center line.

[0089] Specifically, the Gaussian weighted grayscale centroid method is used to extract the center points of the laser line segments in the filter sub-images. Specifically, the following formulas (1) and (2) can be used to sequentially extract the X coordinates x of the center points of the laser line segments according to the X coordinate index: cen , Y coordinate y cen , where the X coordinate x cen The column coordinates of the sub-image.

[0090]

[0091] Where I(x,y) is the grayscale value of the pixel at position (x,y); w(I(x,y)) is the Gaussian weight function; M and N are the length and width of the sub-image, which are equal to the length and width of the sliding window, that is, 1 and 2W, respectively; j is the index of the X coordinate, that is, the column index value of the filtered sub-image, which is 1, 2, ..., N, respectively.

[0092] In the above embodiments, when processing each sub-image, that is, in step S21, if there is no pixel with a grayscale value greater than the grayscale threshold in the sub-image, the processing of the sub-image is terminated directly, and then the next sub-image can be processed.

[0093] The grayscale threshold in step S21 can be determined according to the grayscale values ​​of the laser light strip and the background, and can usually be selected to be 30-50 to take into account the pixels of stray light as much as possible.

[0094] In step S40, some columns may include only one candidate point, which means that there is no stray light point in the column, and the only candidate point is the point on the center line of the laser light strip in the column; some columns may include multiple candidate points. In this case, how to determine the point on the center line of the laser light strip in the column can adopt various methods in the prior art, such as selecting the candidate points of each column determined in the previous sequence and the multiple candidate points of the column by curve fitting. Of course, in the embodiment where a candidate matrix equal to the number of columns of the image to be processed is set, there may be no candidate point in some columns, indicating that the laser light strip is not located on the column.

[0095] In a preferred embodiment of the present invention, it is considered that, on the one hand, the stray light area is usually darker than the actual laser light strip area, and for the gray value of the center point calculated by the sub-image, the natural stray light area is usually smaller than the actual laser light strip area, and the line width at the stray light is also uneven; on the other hand, the actual laser light strip is a stripe of a continuous light strip, and the center position interval of the sub-images of adjacent columns is theoretically very small, while the stray light area deviates from the laser light strip, so the candidate point extracted in the stray light area must be far away from the center position of the laser light strip in the previous column. Therefore, the present invention provides a simple and high-precision center line extraction method, that is, firstly selecting the candidate point with the largest gray value among the candidate points in the first column where the laser light strip is located as the point on the center line of the laser light strip in the column, that is, the starting point of the center line, and then for each subsequent column, if the column has multiple candidate points, the one closest to the connection point (or starting point) of the previous column is selected as the connection point on the center line of the laser light strip, and if there is only one candidate point, it is directly used as the connection point on the center line of the laser light strip in the column. Specifically, step S40 includes the steps of:

[0096] S41: The candidate point with the largest gray value in the first column of candidate points is used as the first connection point of the center line. That is to say, if there is only one candidate point in the first column of candidate points, it is directly used as the connection point, which is also the starting point of the center line; if there are multiple candidate points in the first column of candidate points, the candidate point with the largest gray value is selected as the connection point. In the above embodiment in which a candidate matrix equal to the number of columns of the image to be processed is set, the first column here refers to the first column with candidates in the candidate matrix.

[0097] S42: For the remaining columns, the candidate point closest to the connection point of the previous column among all the candidate points in the column is used as the connection point of the column, that is, the connection point of each column is determined in turn according to the index size of the column, that is, the position of the center line of the laser light strip on each column;

[0098] S43: Connect the connection points to obtain the center line of the laser light strip.

[0099] This method of determining the center line based on candidate points greatly saves the calculation time of the connection points and further improves the efficiency of center line extraction. In addition, the center line extraction method of this method is highly robust.

[0100] In the above embodiments, the step S20 further includes the following steps:

[0101] S00: Obtain the original image projected by the single-line laser onto the object to be measured, and perform Gaussian filtering or median filtering on the original image to obtain the image to be processed. Gaussian filtering is preferred to make the cross-sectional light intensity distribution at the laser light strip of the image to be processed more consistent with the Gaussian distribution, such as Figure 2 The Gaussian kernel used for Gaussian filtering can be determined according to the image area occupied by the width of the laser light strip in the original image. In the present invention, a Gaussian kernel of size 5*5 is used for Gaussian filtering, which can better remove Gaussian noise and smooth the protruding edge of the laser light strip.

[0102] In order to more intuitively see the above advantages of the centerline extraction method of the present invention, refer to Figure 3-Figure 10 ,in, Figure 3-Figure 6 are respectively an image to be processed and the center line extraction method, the Steger algorithm and the grayscale centroid method of the present invention are respectively used for Figure 3 The center line of the image to be processed is obtained by performing center line analysis; Figure 7-Figure 10 are another image to be processed and the center line extraction method, Steger algorithm and grayscale centroid method of the present invention are respectively used for Figure 7The center line of the image to be processed is obtained by performing center line extraction. As can be seen from the figure, the center line obtained by the center line extraction method of the present invention can remove the interference of various stray lights, and the accuracy of the extracted center line is higher, which is significantly better than the accuracy of the center line extracted by the Steger algorithm and the grayscale centroid method.

[0103] The present invention further provides a device for extracting the center line of a single-line laser light strip, which can be used to extract the center line of the single-line laser light strip in the above embodiments. The device comprises:

[0104] The candidate point determination unit is used to perform the above step S20, that is, to set a sliding window according to the width of the laser light strip on the image to be processed, to move the sliding window in sequence to traverse the image to be processed, and at each position of the sliding window, to use the area on the image to be processed corresponding to the sliding window as a sub-image, to determine whether there is a pixel with a gray value greater than a gray threshold in the sub-image, and if so, to extract the center point of the sub-image, and to determine whether the center point is located in the central area of ​​the sub-image, and if so, to determine whether the number of candidate points in the column where the current center point is located is equal to a preset number, and if not, to use the current center point as the candidate point of the column; if so, to determine whether the gray value of the current center point is greater than the gray value of the last candidate point corresponding to the column, and if so, to use the current center point as the last candidate point of its corresponding column;

[0105] In which, it is assumed that the laser light strip on the image to be processed extends along the row direction; the length of the sliding window is 1 pixel;

[0106] The center line determination unit is used to perform the above step S40, that is, to determine the center line of the laser light strip of the image to be processed according to the positions of all candidate points in the image to be processed and their gray values.

[0107] The specific implementation methods of the above-mentioned units can refer to the embodiments corresponding to the above-mentioned extraction method, which will not be repeated here.

[0108] The present invention also provides a method for three-dimensional reconstruction of an object, such as Fig.11 As shown, the object three-dimensional reconstruction method includes the steps of:

[0109] S100: Acquire an original image of a single-line laser light strip projected onto the object to be measured, such as acquiring the original image from a collection device;

[0110] S200: Processing the original image using the method for extracting the center line of the single-line laser light stripe described in any of the above embodiments to extract the center line of the laser light stripe;

[0111] S300: Perform three-dimensional reconstruction of the object to be measured based on the obtained center line of the laser light strip.

[0112] refer to Fig.12 , Fig.12 The left side of the figure is the object to be measured, and the right side is the model obtained by reconstructing the object in three dimensions using the method of the present invention for the image in the red frame area in the left figure. It can be seen from the figure that the three-dimensional model obtained by the three-dimensional reconstruction of the object according to the present invention is basically consistent with the physical model. It can be seen that the three-dimensional model that is more consistent with the actual situation can be obtained by using the three-dimensional reconstruction of the object according to the present invention, thereby providing a more accurate model basis for subsequent measurement such as contour measurement, thereby improving the measurement accuracy.

[0113] The present invention also provides a three-dimensional object reconstruction system, which can be used to execute the above-mentioned three-dimensional object reconstruction method. The three-dimensional object reconstruction system includes:

[0114] An acquisition module, used to execute the above step S100, that is, to acquire an original image of a single-line laser light strip projected onto the object to be measured;

[0115] A centerline extraction module, used to execute the above step S200, that is, to process the original image using the single-line laser light strip centerline extraction method described in any of the above embodiments to extract the centerline of the laser light strip;

[0116] The three-dimensional reconstruction module is used to execute the above step S300, that is, to perform three-dimensional reconstruction of the object to be measured based on the obtained center line of the laser light strip.

[0117] The present invention also provides an electronic device, comprising:

[0118] A single-line laser is used to project a laser light strip onto the object to be measured;

[0119] A collection device, such as a camera, is used to collect an image of the laser light strip on the object to be measured;

[0120] A processor, comprising the above-mentioned object three-dimensional reconstruction system;

[0121] Wherein, the acquisition device is connected with the processor signal.

[0122] The electronic device may be a laser scanner, and specifically a 3D profile scanner.

[0123] The electronic device may further include a filter, which is disposed in front of the lens of the acquisition device to filter out interference from non-blue light in the background, thereby improving the accuracy of subsequent extraction of the center of each light strip.

[0124] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it implements the method for extracting the center of a single-line laser light strip as described in any of the above embodiments, or implements the method for three-dimensional reconstruction of an object as described above.

[0125] It should be noted that the computer-readable storage medium described in the embodiments of the present disclosure is not limited to the above-mentioned embodiments, and may also be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.

[0126] It will be appreciated by those skilled in the art that, under the premise of no conflict, the above-mentioned preferred solutions can be freely combined and superimposed. Among them, the flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings, for example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. The numbering of each step in this article is only for the convenience of description and reference, and is not used to limit the order of execution. The specific execution order is determined by the technology itself, and those skilled in the art can determine various allowable and reasonable orders based on the technology itself.

[0127] It should be understood that the above-mentioned embodiments are merely illustrative and not restrictive. Without departing from the basic principles of the present invention, various obvious or equivalent modifications or substitutions that can be made by those skilled in the art to the above-mentioned details will be included in the scope of the claims of the present invention.

Claims

1. A method for extracting the center line of a single-line laser light strip, characterized in that: include: Candidate point screening step S20: setting a sliding window according to the width of the laser light strip on the image to be processed, moving the sliding window in sequence to traverse the image to be processed, and performing the following steps at each position of the sliding window; S21: taking the area of ​​the image to be processed corresponding to the sliding window as a sub-image, determining whether there is a pixel with a grayscale value greater than a grayscale threshold in the sub-image, if so, extracting the center point of the sub-image, and determining whether the center point is located in the central area of ​​the sub-image, if so, executing step S22; S22: Determine whether the number of candidate points in the column where the current center point is located is equal to the preset number. If not, take the current center point as the candidate point of the column; if so, execute step S23; S23: Determine whether the grayscale value of the current center point is greater than the grayscale value of the last candidate point corresponding to the column. If so, take the current center point as the last candidate point of its corresponding column. Wherein, it is assumed that the laser light strip on the image to be processed extends in the row direction; the length of the sliding window is 1 pixel; Centerline determination step S40: determining the centerline of the laser light stripe of the image to be processed according to the positions of all candidate points in the image to be processed and their grayscale values.

2. The extraction method according to claim 1, characterized in that The step S20 also includes step S10: setting a candidate matrix according to the image to be processed, the number of columns of the candidate matrix is ​​equal to the number of columns of the image to be processed, the number of rows is the preset number, and a default value is set for each element in the candidate matrix; In the step S20, the sliding window traverses the image to be processed by columns, and in the same column, the elements of the corresponding column of the candidate matrix are updated in sequence starting from the first element using the determined position coordinates of the candidate points.

3. The extraction method according to claim 1, characterized in that In step S20, the preset number is greater than or equal to 5.

4. The extraction method according to claim 1, characterized in that In the step S20, the width of the sliding window is 1 to 2 times the width of the laser light strip on the image to be processed.

5. The extraction method according to claim 1, characterized in that In the step S21, a weighted grayscale centroid method is used to extract the center point of the sub-image.

6. The extraction method according to claim 1, characterized in that The step S40 comprises the steps of: Among the candidate points in the first column, the candidate point with the largest gray value is used as the first connection point of the center line; For the remaining columns, the candidate point closest to the connection point of the previous column among all the candidate points in the column is used as the connection point of the column; The center line is obtained by connecting the connection points.

7. The extraction method according to claim 1, characterized in that The step S20 also includes the following steps: S00: acquiring an original image projected by a single-line laser onto the object to be measured, and performing Gaussian filtering on the original image to obtain the image to be processed.

8. A device for extracting the center line of a single-line laser light strip, characterized in that: include: a candidate point determination unit, for setting a sliding window according to the width of the laser light strip on the image to be processed, moving the sliding window in sequence to traverse the image to be processed, and at each position of the sliding window, taking the area on the image to be processed corresponding to the sliding window as a sub-image, and judging whether there are pixels in the sub-image whose grayscale value is greater than the grayscale threshold value; if so, extracting the center point of the sub-image, and judging whether the center point is located in the central area of ​​the sub-image; if so, judging whether the number of candidate points in the column where the current center point is located is equal to a preset number; if not, taking the current center point as the candidate point of the column; if so, judging whether the grayscale value of the current center point is greater than the grayscale value of the last candidate point corresponding to the column; if so, taking the current center point as the last candidate point of its corresponding column; Wherein, it is assumed that the laser light strip on the image to be processed extends in the row direction; the length of the sliding window is 1 pixel; The center line determination unit is used to determine the center line of the laser light strip of the image to be processed according to the positions of all candidate points in the image to be processed and their grayscale values.

9. A method for three-dimensional reconstruction of an object, characterized in that: Includes steps: Acquire the original image of the single-line laser light strip projected onto the object to be measured; The original image is processed using the method for extracting the center line of a single-line laser light strip as described in any one of claims 1 to 7 to extract the center line of the laser light strip; The object to be measured is three-dimensionally reconstructed based on the obtained center line of the laser light strip.

10. A three-dimensional object reconstruction system, characterized in that: include: An acquisition module, used for acquiring an original image of a single-line laser light strip projected onto the object to be measured; A centerline extraction module, used to process the original image using the single-line laser light strip centerline extraction method according to any one of claims 1 to 7 to extract the centerline of the laser light strip; The three-dimensional reconstruction module is used to perform three-dimensional reconstruction of the object to be measured based on the obtained center line of the laser light strip.

11. An electronic device, characterized in that: include: A single-line laser is used to project a laser light strip onto the object to be measured; A collection device for collecting images of the laser light strips on the object to be measured; A processor, comprising the object three-dimensional reconstruction system according to claim 10; Wherein, the acquisition device is connected to the processor signal.

12. The electronic device according to claim 11, characterized in that: The electronic device is a 3D profile scanner.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for extracting the center line of a single-line laser light strip as described in any one of claims 1 to 7 is implemented, or the method for three-dimensional reconstruction of an object as described in claim 9 is implemented.