A sub-pixel centerline extraction method for multi-line structured light based on local centroid
Through the multi-line structured light sub-pixel-level centerline extraction method based on local center of mass, using median filtering, maximum inter-class variance method and rotary shell method, the polygon center of mass is calculated to extract the centerline of the multi-line structured light stripe, and the current solution is to solve the problem of median filtering, maximum inter-class variance method and rotary shell method. There are technical accuracy and real-time problems, and high precision and robust subpixel-level centerline extraction is achieved.
Patent Information
- Application Number
- CN202411034862.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-31
AI Technical Summary
The existing multi-line structured light stripe centerline extraction method has low accuracy under complex backgrounds and is sensitive to noise and light stripe width, which cannot meet the needs of high accuracy and real-time.
The centerline extraction method of multi-line structured light based on local center of mass is calculated as the linear structured light by median filtering, maximum inter-class variance method threshold segmentation, rotary shell method and Gaussian area theorem. The center line of the stripe is removed and the multi-line structured light is disassembled into single-line structured light for processing.
The centerline extraction of multi-line structured light stripes with high accuracy and robustness in complex backgrounds is achieved, avoiding the impact on grayscale distribution and width inhomogeneity, and meeting the subpixel-level accuracy and real-time requirements.
Smart Images

Figure CN118570286B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image processing, and in particular relates to a method for extracting sub-pixel center lines of multi-line structured light based on local centroid. Background Art
[0002] Multi-line structured light 3D reconstruction technology is widely used in industrial manufacturing, medical imaging, cultural heritage protection, game development and other fields due to its suitability for complex backgrounds, low cost, easy operation, and high real-time performance. High-precision extraction of the center line of multi-line structured light stripes is an important part of 3D reconstruction and one of the key indicators to ensure reconstruction accuracy. However, due to the influence of the surface roughness and refractive index of the object being measured, the local cross-sectional grayscale distribution of the line structured light often does not present a Gaussian distribution state. At this time, the extracted center line will no longer be accurate. Therefore, it is of utmost importance to study the sub-pixel level extraction method of the center line of line structured light stripes suitable for complex background conditions.
[0003] There are roughly the following methods for extracting the center line of line structured light stripes. The first is the geometric center method. This method only needs to calculate the center point coordinates of each row (column) of the line structured light stripes to extract the center line, but it is sensitive to noise and light stripe width, resulting in deviations in the center line extraction; the second is the grayscale centroid method. This method extracts the center line by calculating the centroid of the grayscale value of each row (column) of the line structured light stripes, but this method does not consider the direction of the line structured light stripes and has poor effect on low-contrast images; the third is the Steger method based on the Hession matrix. This method uses the eigenvector corresponding to the eigenvalue with the largest absolute value of the Hession matrix to obtain the normal direction of each point, and performs a second-order Taylor expansion along the normal direction of each point to obtain the center line of the line structured light stripes. This algorithm has high extraction accuracy and good robustness, but it has a large amount of calculation and cannot meet real-time requirements. Summary of the invention
[0004] The object of the present invention is to provide a sub-pixel centerline extraction method for multi-line structured light based on local centroid, which is suitable for complex backgrounds and can maintain high precision and good robustness.
[0005] The technical solution adopted by the present invention is as follows:
[0006] In a first aspect, the present invention provides a method for extracting sub-pixel centerlines of multi-line structured light based on local centroids, the method comprising the following steps:
[0007] S1. Collecting the original image containing multi-line structured light stripes under complex background conditions;
[0008] S2, performing median filtering and maximum inter-class variance method threshold segmentation on the original image to obtain a binary image;
[0009] S3. Based on the geometric characteristics of the circle, by calculating the area-to-circumference ratio of all contours in the binary image and comparing it with the theoretical radius function relationship of the circle, the circular marker points can be automatically identified and removed. By analyzing the average width difference between the line structured light stripes and the interference stripes, the interference stripe area can be effectively removed to obtain the ROI image.
[0010] S4, using the rotating caliper method in the ROI image to calculate the minimum circumscribed rectangle of the single line structured light stripe in turn and record the maximum and minimum row and column values of the rectangle, copy the single line structured light stripe area to a new image with the same size as the ROI image and all pixel values are zero, and decompose the multi-line structured light into several single-line structured lights for processing;
[0011] S5. In the new image, the maximum and minimum row and column values of the minimum circumscribed rectangle are used as the traversal area. K lines of line structured light stripe areas are selected each time along the traversal direction of the single-line structured light stripe. The area of the polygon is calculated using the Gaussian area theorem. The centroid of the triangle formed by each edge of the polygon and the coordinate origin is calculated. The area of each triangle is used as the weight, and the centroids of all triangles are weighted averaged. Finally, the centroid of the polygon is calculated based on the area of the polygon, and the set of local centroid points is used as the center line of the line structured light stripe.
[0012] Following the above technical solution, in step S2, for each pixel in the image, the median of the pixel values in the local window is used to replace the pixel, that is: ,in is the pixel value after median filtering, is the pixel value in the image, and the local window size is , the image denoised by median filtering is segmented by the maximum inter-class variance method to obtain a binary image.
[0013] Following the above technical solution, in step S3, based on the geometric characteristics of the circle, by calculating the area-to-circumference ratio of all contours in the binary image and comparing it with the theoretical radius function relationship of the circle, the circular marking points are automatically identified and removed, and the interference stripe area is effectively removed by analyzing the average width difference between the line structured light stripes and the interference stripes to obtain the ROI image.
[0014] Following the above technical solution, in step S4, the minimum circumscribed rectangle of the single-line structured light stripe is calculated in the ROI image using the rotating caliper method and the maximum and minimum row and column values of the rectangle are recorded. The single-line structured light stripe area is copied to a new image with the same size as the ROI image and all pixel values are zero, and the multi-line structured light is decomposed into several single-line structured lights for processing.
[0015] Following the above technical solution, in step S5, the maximum and minimum row and column values of the minimum circumscribed rectangle in the new image are used as the traversal area, and k-row line structured light stripe areas are selected each time along the traversal direction of the single-line structured light stripe. The area of the polygon is calculated using the Gaussian area theorem, and the centroid of the triangle formed by each edge of the polygon and the coordinate origin is calculated. The area of each triangle is used as the weight, and the centroids of all triangles are weighted averaged. Finally, the centroid of the polygon is calculated, and the set of local centroid points is used as the center line of the line structured light stripe. Assume that the non-self-intersecting closed polygon has Vertices, the specific steps are:
[0016] Step 1: Select a vertex of the polygon as the starting point, and add other vertices clockwise or counterclockwise to form the vertex set of the polygon. ;
[0017] Step 2: Use Gauss's area theorem to calculate the area of the polygon ;
[0018]
[0019] in, , Vertex , The coordinates of Indicates that the polygon is closed;
[0020] Step 3: Vertex Collection Any two adjacent vertices , It forms a triangle with the coordinate origin (0, 0) and calculates the area of the triangle , Centroid ;
[0021]
[0022] )
[0023] Step 4: Using the area of each triangle as the weight, perform a weighted average of the centroids of all triangles to calculate the centroid of the non-self-intersecting closed polygon ;
[0024]
[0025]
[0026] Thus, the centroid of the polygon can be obtained, and the set of centroid points of all traversed polygons is used as the center line of the line structured light stripe, that is, the center line of the line structured light stripe is extracted.
[0027] In a second aspect, the present invention further provides a local centroid-based multi-line structured light sub-pixel centerline extraction system for implementing any one of the above-mentioned local centroid-based multi-line structured light sub-pixel centerline extraction methods, comprising:
[0028] Image acquisition module, which can acquire images containing multi-line structured light stripes under complex background conditions;
[0029] The image filtering and threshold segmentation module is used to filter, denoise and perform threshold segmentation on the image to obtain a binary image;
[0030] The image segmentation module, based on the geometric characteristics of the circle, calculates the area-to-perimeter ratio of all contours in the binary image and compares it with the theoretical radius function relationship of the circle to automatically identify and remove circular markers. The interference stripe area is effectively removed by analyzing the average width difference between the line structured light stripes and the interference stripes to obtain the ROI image.
[0031] The multi-line structured light decomposition module uses the rotating caliper method to calculate the minimum circumscribed rectangle of a single line structured light stripe in the ROI image and records the maximum and minimum row and column values of the rectangle, copies the single line structured light stripe area to a new image with the same size as the ROI image and all pixel values are zero, and decomposes the multi-line structured light into several single line structured lights for processing;
[0032] The local centroid point extraction module uses the maximum and minimum row and column values of the minimum circumscribed rectangle as the traversal area in the new image, and selects k-row line structured light stripe areas each time along the traversal direction of the single-line structured light stripe. The area of the polygon is calculated using the Gaussian area theorem, and the centroid of the triangle formed by each edge of the polygon and the coordinate origin is calculated. The area of each triangle is used as the weight, and the centroids of all triangles are weighted averaged. Finally, the centroid of the polygon is calculated, and the set of local centroid points is used as the center line of the line structured light stripe.
[0033] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0034] The present invention proposes a sub-pixel centerline extraction method for multi-line structured light based on local centroid. The method can meet the situation of extracting centerlines of multiple line structured lights. By calculating the centroid of non-self-intersecting closed polygons as the center point of the line structured light stripes, the method is not affected by the grayscale distribution of the cross-section of the line structured light stripes, and is not easily affected by the uneven width of the line structured light stripes. This ensures both the extraction accuracy and the robustness.
[0035] In addition, the present invention utilizes the minimum circumscribed rectangle to process the multi-line structured light to solve the problem of multi-line structured light extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a flow chart of a method for extracting sub-pixel center lines of multi-line structured light based on local centroids according to an embodiment of the present invention;
[0037] Figure 2 A schematic diagram of collecting an original image containing multi-line structured light stripes according to an embodiment of the present invention;
[0038] Figure 3 This is a schematic diagram of an image after median filtering according to an embodiment of the present invention;
[0039] Figure 4 This is a schematic diagram of a binary image after image maximum inter-class variance method threshold segmentation according to an embodiment of the present invention;
[0040] Figure 5 This is a schematic diagram of an image after the circular marking points are removed according to an embodiment of the present invention;
[0041] Figure 6 This is a schematic diagram of a region of interest after removing interference stripe regions according to an embodiment of the present invention;
[0042] Figure 7 A schematic diagram of calculating the minimum circumscribed rectangle of multi-line structured light stripes according to an embodiment of the present invention;
[0043] Figure 8 This is a schematic diagram of extracting the center line of multi-line structured light according to an embodiment of the present invention;
[0044] Fig. 9 Schematic diagram of local details of the center line of multi-line structured light extraction in different postures according to an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0046] Most current methods use grayscale values to extract sub-pixel center lines. Methods that do not use grayscale values require fitting, interpolation, and other methods to extract sub-pixel center lines, which increases the time overhead of the algorithm. The present invention calculates the centroid of the local line structured light stripe area as the center point to extract the center line, and can extract sub-pixel center lines without using grayscale values; and since grayscale values are not required, it can be applied to complex backgrounds. Secondly, the present invention uses the minimum circumscribed rectangle to handle multi-line structured light, thereby solving the problem of multi-line structured light extraction.
[0047] Embodiment 1
[0048] After collecting the original image containing multi-line structured light stripes under a complex background, due to the influence of the surface roughness and refractive index of the measured object, the local cross-sectional grayscale distribution of the line structured light often does not present a Gaussian distribution state. At this time, the extracted center line will no longer be accurate. Therefore, it becomes of utmost importance to study the sub-pixel level extraction method of the center line of line structured light stripes suitable for complex background conditions.
[0049] like Figure 1 As shown, the method for extracting sub-pixel center lines of multi-line structured light based on local centroid in an embodiment of the present invention includes the following steps:
[0050] S1. Collecting the original image containing multi-line structured light stripes under complex background conditions;
[0051] S2, performing median filtering and maximum inter-class variance method threshold segmentation on the original image to obtain a binary image;
[0052] S3. Based on the geometric characteristics of the circle, by calculating the area-to-circumference ratio of all contours in the binary image and comparing it with the theoretical radius function relationship of the circle, the circular marker points can be automatically identified and removed. By analyzing the average width difference between the line structured light stripes and the interference stripes, the interference stripe area can be effectively removed to obtain the ROI image.
[0053] S4, using the rotating caliper method in the ROI image to calculate the minimum circumscribed rectangle of the single line structured light stripe in turn and record the maximum and minimum row and column values of the rectangle, copy the single line structured light stripe area to a new image with the same size as the ROI image and all pixel values are zero, and decompose the multi-line structured light into several single-line structured lights for processing;
[0054] S5. In the new image, the maximum and minimum row and column values of the minimum circumscribed rectangle are used as the traversal area. K lines of line structured light stripes are selected each time along the traversal direction of the single-line structured light stripe. The area of the polygon is calculated using the Gaussian area theorem. The centroid of the triangle formed by each edge of the polygon and the coordinate origin is calculated. The area of each triangle is used as the weight, and the centroids of all triangles are weighted averaged. Finally, the centroid of the polygon is calculated, and the set of local centroid points is used as the center line of the line structured light stripe.
[0055] The multi-line structured light sub-pixel centerline extraction method based on local centroid of the embodiment of the present invention is built using Visual Studio 2017 and Qt 5.12.0 in a 64-bit Windows 10 operating system. It is understandable that the algorithm of the present invention can also be transplanted to other programming languages or hardware devices.
[0056] Embodiment 2
[0057] The inventive concept of this embodiment is the same as that of the first embodiment, except that each step is implemented by a preferred algorithm or example.
[0058] like Figure 1 As shown, the method for extracting sub-pixel center lines of multi-line structured light based on local centroid in this embodiment mainly includes the following steps:
[0059] In step S1, an original image containing multi-line structured light stripes is collected under complex background conditions. The collected original image is as follows: Figure 2 shown.
[0060] In step S2, for each pixel in the image, the median of the pixel values in the local window is used to replace the pixel, that is: ,in is the pixel value after median filtering, is the pixel value in the image, and the local window size is , the effect of median filtering is as follows Figure 3 shown.
[0061] In order to obtain the line structured light stripe area, the maximum inter-class variance method is used to perform threshold segmentation to obtain a preliminary effective area. Image , it is divided into background and foreground, the segmentation threshold is denoted as T (0~255), and the number of foreground pixels in the image is The ratio is , the number of background pixels accounts for the image The ratio is , the average grayscale of the foreground area is , the average grayscale of the background area is ,image The average grayscale is , the between-class variance is recorded as ,image The gray value is less than the threshold The number of pixels is , greater than the threshold The number of pixels is , then:
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068] Threshold Traverse from 0 to 255 to make the between-class variance The largest threshold is the optimal segmentation threshold.
[0069] The binary image obtained by threshold segmentation using the maximum inter-class variance method on the median filtered image is as follows: Figure 4 As shown in the figure, there are still circular marking points and interference stripe areas (line structured light stripe areas that are outside the object being measured and have not been removed) in the binary image. The binary image needs to be further processed to accurately extract the line structured light stripe areas.
[0070] Step S3 calculates the area and perimeter of all contours in the binary image, based on the relationship between the ratio of the area to the perimeter of a circle and the radius, that is, , calculation error , the error error is less than the set threshold The contours are considered as circular markers and removed. Calculate the average width of the stripe area ,in is the number of pixels in the stripe area, is the number of rows in the stripe area. According to the difference between the average width of the effective line structured light stripe area and the average width of the interference stripe area, the average width Less than the set threshold The area is regarded as the interference stripe area and removed, and finally the precise line structured light stripe area of interest is obtained. Figure 5 To remove the circular markers, Figure 6 This is the region of interest (ROI) image after accurate extraction.
[0071] It should be noted that the circular markers in the image are used for the subsequent multi-view 3D reconstruction, but they need to be removed when extracting the center line of the line structured light to obtain the line structured light stripe area of interest. When the radius It can be obtained based on the area or perimeter of the contour.
[0072] In step S4, the minimum circumscribed rectangle of a single line structured light stripe is calculated in the ROI image using the rotating caliper method. Assuming the contour point set of the single line structured light stripe is P, the specific steps are as follows:
[0073] Step 1: Find the leftmost, rightmost, topmost and bottommost boundary points on the contour point set P, and construct four tangent lines through the four boundary points;
[0074]
[0075]
[0076]
[0077]
[0078] Step 2: For each edge of the contour ,in , yes The two endpoints of Direction vector , the reverse direction vector ;
[0079] Step 3: Rotate the tangents clockwise (counterclockwise) until one of the tangents is aligned with one edge of the contour. overlap, with As the base of the outline;
[0080] Step 4: Find the bottom edge The relative top , leftmost point and the rightmost point , is the distance from the bottom The farthest point, the vertex, for To the bottom Distance:
[0081]
[0082] is The point with the farthest projection in the reverse direction is the leftmost point. for exist Projection distance on:
[0083]
[0084] is The farthest point in the projection direction is the rightmost point. for exist Projection distance on:
[0085]
[0086] Step 5: Calculate the area s of the rectangle enclosed by the four tangent lines after rotation, where the width of the rectangle is w and the height is h;
[0087]
[0088]
[0089]
[0090]
[0091] Step 6: Repeat steps 3 to 5 until all edges of the contour are traversed. The rectangle with the smallest area is the minimum circumscribed rectangle of the contour.
[0092] The maximum and minimum row and column values of the minimum circumscribed rectangle are recorded, the line structured light stripes are extracted from the ROI image one by one, and copied to a new image with the same size as the ROI image and all pixel values are zero, and the multi-line structured light is disassembled into several single-line structured lights for processing. Figure 7 Schematic diagram of the minimum bounding rectangle calculated for multi-line structured light stripes.
[0093] The specific method of step S5 is: in the new image, the maximum and minimum row and column values of the minimum circumscribed rectangle are used as the traversal area, and k-row line structured light stripe areas are selected each time along the traversal direction of the single-line structured light stripe. The area of the polygon can be regarded as a non-self-intersecting closed polygon, and the Gaussian area theorem is used to calculate the area of the polygon. The centroid of the triangle formed by each edge of the polygon and the coordinate origin is calculated, and the area of each triangle is used as the weight to perform weighted average on the centroids of all triangles. Finally, the centroid of the polygon is calculated, and the set of local centroid points is used as the center line of the line structured light stripe. Assume that the non-self-intersecting closed polygon has Vertices, the specific steps are:
[0094] Step 1: Select a vertex of the polygon as the starting point, and add other vertices clockwise or counterclockwise to form the vertex set of the polygon. ;
[0095] Step 2: Use Gauss's area theorem to calculate the area of the polygon ;
[0096]
[0097] in, , Vertex , The coordinates of Indicates that the polygon is closed;
[0098] Step 3: Vertex Collection Any two adjacent vertices , It forms a triangle with the coordinate origin (0, 0) and calculates the area of the triangle , Centroid ;
[0099]
[0100] )
[0101] Step 4: Using the area of each triangle as the weight, perform a weighted average of the centroids of all triangles to calculate the centroid of the non-self-intersecting closed polygon ;
[0102]
[0103]
[0104] Figure 8 This is the center line image of the multi-line structured light extracted in this embodiment.
[0105] It should be noted that each slide needs to be along the traversal direction of the single-line structured light stripe to prevent the sliding window from directly including the entire single-line structured light stripe. The method for determining the traversal direction of the single-line structured light stripe is as follows: establish an image coordinate system in the single-line structured light image, with the origin of the coordinate system located in the upper left corner of the image, the u axis parallel to the horizontal direction of the image, and the v axis parallel to the vertical direction of the image; determine the direction of the single-line structured light stripe according to the long side of the minimum circumscribed rectangle of the single-line structured light stripe; determine the traversal direction of the single-line structured light stripe by comparing the angle between the direction of the single-line structured light stripe and the u and v axes of the image coordinate system. If the angle between the direction of the single-line structured light stripe and the u axis is smaller, the traversal direction of the single-line structured light stripe is the u axis direction; otherwise, it is the v axis direction. Fig. 9 (a) to (d) are schematic diagrams of local details of the center line extracted by multi-line structured light in different positions. The line in the middle of the light stripes in the figure is the extracted center line.
[0106] In addition, the centroid coordinates of the polygon calculated by the present invention are accurate to a scale smaller than one pixel, and thus are at a sub-pixel level.
[0107] Embodiment 3
[0108] The local centroid-based multi-line structured light sub-pixel centerline extraction system of the embodiment of the present invention is mainly used to implement the above method embodiment, specifically including:
[0109] Image acquisition module, which can acquire images containing multi-line structured light stripes under complex background conditions;
[0110] The image filtering and threshold segmentation module is used to filter, denoise and perform threshold segmentation on the image to obtain a binary image;
[0111] The image segmentation module, based on the geometric characteristics of the circle, calculates the area-to-perimeter ratio of all contours in the binary image and compares it with the theoretical radius function relationship of the circle to automatically identify and remove circular markers. The interference stripe area is effectively removed by analyzing the average width difference between the line structured light stripes and the interference stripes to obtain the ROI image.
[0112] The multi-line structured light decomposition module uses the rotating caliper method to calculate the minimum circumscribed rectangle of a single line structured light stripe in the ROI image and records the maximum and minimum row and column values of the rectangle, copies the single line structured light stripe area to a new image with the same size as the ROI image and all pixel values are zero, and decomposes the multi-line structured light into several single line structured lights for processing;
[0113] The local centroid point extraction module uses the maximum and minimum row and column values of the minimum circumscribed rectangle as the traversal area in the new image, and selects k-row line structured light stripe areas each time along the traversal direction of the single-line structured light stripe. The area of the polygon is calculated using the Gaussian area theorem, and the centroid of the triangle formed by each edge of the polygon and the coordinate origin is calculated. The area of each triangle is used as the weight, and the centroids of all triangles are weighted averaged. Finally, the centroid of the polygon is calculated, and the set of local centroid points is used as the center line of the line structured light stripe.
[0114] Each module is specifically used to implement the specific methods in the above-mentioned method embodiments, which will not be repeated here.
[0115] In summary, the present invention calculates the center line of the multi-line structured light stripes based on the local centroid, is not affected by the grayscale distribution of the cross-section of the line structured light stripes, is not easily affected by the uneven width of the line structured light stripes, and can accurately extract the sub-pixel center line of the multi-line structured light.
[0116] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0117] It should be pointed out that, according to the needs of implementation, the various steps / components described in this application can be split into more steps / components, and two or more steps / components or partial operations of steps / components can be combined into new steps / components to achieve the purpose of the present invention.
[0118] It will be easily understood by those skilled in the art that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for extracting sub-pixel centerline of multi-line structured light based on local centroid, characterized in that: The method includes: S1, collecting the original image containing multi-line structured light stripes; S2, obtaining a binary image of the original image; S3, removing the interference mark points and interference stripe areas in the binary image to obtain a ROI image; S4, calculating the minimum circumscribed rectangle of a single line structured light stripe in the ROI image, and using the minimum circumscribed rectangle to decompose the multi-line structured light into a plurality of single-line structured lights to obtain a plurality of single-line structured light images; S5. In the single-line structured light image, k lines of line structured light stripe regions are selected each time along the traversal direction of the single-line structured light stripe, the centroid of each selected local region is calculated, and the set of centroid points of all local regions is used as the center line of the line structured light stripe; including: In a single-line structured light image, the maximum and minimum row and column values of the minimum circumscribed rectangle of the single-line structured light stripe are used as the traversal area. K lines of line structured light stripe areas are selected each time along the traversal direction of the single-line structured light stripe. Each selected local area is regarded as a non-self-intersecting closed polygon. The area of the polygon is calculated using the Gaussian area theorem, and the centroid of the triangle formed by each edge of the polygon and the coordinate origin is calculated. The area of each triangle is used as the weight, and the centroids of all triangles are weighted averaged. Finally, the centroid of the polygon is calculated in combination with the area of the polygon, and the set of centroid points of all local areas is used as the center line of the line structured light stripe. Among them, the centroid calculation method of non-self-intersecting closed polygons is as follows: Step 1: Assume that the non-self-intersecting closed polygon has Vertices, randomly select a vertex of the polygon as the starting point, and add other vertices in clockwise or counterclockwise order to form the vertex set of the polygon ; Step 2: Use Gauss's area theorem to calculate the area of the polygon ; in, , Vertex , The coordinates of Indicates that the polygon is closed; Step 3: Vertex collection Any two adjacent vertices , It forms a triangle with the coordinate origin (0, 0) and calculates the area of the triangle , Centroid ; ) Step 4: Take the area of each triangle as the weight, take the weighted average of the centroids of all triangles, and calculate the centroid of non-self-intersecting closed polygons ; In the formula, The coordinates of the center of mass.
2. The method for extracting sub-pixel centerline of multi-line structured light based on local centroid according to claim 1, characterized in that: Step S4 includes: In the ROI image, the rotating calculus method is used to calculate the minimum bounding rectangle of a single line structured light stripe in turn, and the maximum and minimum row and column values of the minimum bounding rectangle are recorded. Then, the single line structured light stripe area is copied to a new image with the same size as the ROI image and all pixel values are zero, thereby decomposing the multi-line structured light into several single-line structured lights and obtaining several single-line structured light images.
3. The method for extracting sub-pixel centerline of multi-line structured light based on local centroid according to claim 1, characterized in that: The method for determining the traversal direction of a single-line structured light stripe is as follows: An image coordinate system is established in the single-line structured light image, with the origin of the coordinate system located at the upper left corner of the image, the u-axis parallel to the horizontal direction of the image, and the v-axis parallel to the vertical direction of the image; Determine the direction of the single-line structured light stripe according to the long side of the minimum circumscribed rectangle of the single-line structured light stripe; The traversal direction of the single-line structured light stripe is determined by comparing the angle between the direction of the single-line structured light stripe and the u-axis and v-axis of the image coordinate system. If the angle between the direction of the single-line structured light stripe and the u-axis is smaller, the traversal direction of the single-line structured light stripe is the u-axis direction; otherwise, it is the v-axis direction.
4. The method for extracting sub-pixel centerline of multi-line structured light based on local centroid according to claim 1, characterized in that: Step S2 includes: The original image is subjected to median filtering and maximum inter-class variance method threshold segmentation to obtain a binary image of the original image.
5. The method for extracting sub-pixel centerline of multi-line structured light based on local centroid according to claim 1, characterized in that: The method to remove interference markers is as follows: Calculate the area and perimeter of all contours in the binary image; Calculate the radius based on the area or perimeter of the contour ; Calculation error , the error error is less than the set threshold The contours are considered as interference markers and removed.
6. The method for extracting sub-pixel centerline of multi-line structured light based on local centroid according to claim 5, characterized in that: The interference mark points include the set circular mark points.
7. The method for extracting sub-pixel centerline of multi-line structured light based on local centroid according to claim 1, characterized in that: The method to remove the interference stripe area is as follows: Calculate the average width of the stripe area ,in is the number of pixels in the stripe area, is the number of rows in the stripe area; According to the difference between the average width of the effective line structure light stripe area and the interference stripe area, the average width Less than the set threshold The area is regarded as the interference stripe area and removed.
8. A local centroid-based multi-line structured light sub-pixel centerline extraction system for implementing the local centroid-based multi-line structured light sub-pixel centerline extraction method according to any one of claims 1 to 7, characterized in that: include: An image acquisition module, used for acquiring an original image containing multi-line structured light fringes; An image binarization module is used to obtain a binarized image of the original image; The image segmentation module is used to remove the interference mark points and interference stripe areas in the binary image to obtain the ROI image; The multi-line structured light decomposition module is used to calculate the minimum bounding rectangle of a single line structured light stripe in the ROI image, and use the minimum bounding rectangle to decompose the multi-line structured light into several single-line structured lights to obtain several single-line structured light images; The local centroid point extraction module is used to select k lines of line structured light stripe areas in a single-line structured light image by sliding along the traversal direction of the single-line structured light stripe each time, calculate the centroid of each selected local area, and use the set of centroid points of all local areas as the center line of the line structured light stripe; including: In a single-line structured light image, the maximum and minimum row and column values of the minimum circumscribed rectangle of the single-line structured light stripe are used as the traversal area. K lines of line structured light stripe areas are selected each time along the traversal direction of the single-line structured light stripe. Each selected local area is regarded as a non-self-intersecting closed polygon. The area of the polygon is calculated using the Gaussian area theorem, and the centroid of the triangle formed by each edge of the polygon and the coordinate origin is calculated. The area of each triangle is used as the weight, and the centroids of all triangles are weighted averaged. Finally, the centroid of the polygon is calculated in combination with the area of the polygon, and the set of centroid points of all local areas is used as the center line of the line structured light stripe. Among them, the centroid calculation method of non-self-intersecting closed polygons is as follows: Step 1: Assume that the non-self-intersecting closed polygon has Vertices, randomly select a vertex of the polygon as the starting point, and add other vertices clockwise or counterclockwise to form the vertex set of the polygon ; Step 2: Use Gauss's area theorem to calculate the area of the polygon ; in, , Vertex , The coordinates of Indicates that the polygon is closed; Step 3: Vertex collection Any two adjacent vertices , It forms a triangle with the coordinate origin (0, 0) and calculates the area of the triangle , Centroid ; ) Step 4: Take the area of each triangle as the weight, take the weighted average of the centroids of all triangles, and calculate the centroid of non-self-intersecting closed polygons ; In the formula, The coordinates of the center of mass.
Citation Information
Patent Citations
Line structured light center extraction method and system
CN111260708A
Line structured light stripe center extraction method based on linear regression
CN113989363A
Method and system for accurately extracting central sub-pixel of line-structured light under complex background
CN116433707A
Method for extracting line structure light stripe center
CN117635687A
Image processing method for line extraction, its program, and line concentration degree image filter
JP2005284697A
