A phase correction method and system for structured light fringe profile projection

By employing a two-step boundary recognition and phase correction method, combined with grayscale and phase maps, the phase error problem in structured light fringe contour projection was solved, thus improving the accuracy of 3D reconstruction.

CN117589087BActive Publication Date: 2026-05-15NORTHWESTERN POLYTECHNICAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NORTHWESTERN POLYTECHNICAL UNIV
Filing Date
2023-11-29
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing structured light stripe contour projection technology suffers from phase error, which affects the accuracy of 3D reconstruction. The phase unfolding error is particularly severe in complex and isolated scenes, including random errors and jump errors.

Method used

A two-step boundary recognition method is adopted. The first step is to extract the edge using a grayscale image, and the second step is to extract the edge information using phase calculation. After fusion, stable and unstable regions are divided. Filtering is performed in the stable region, and error compensation is performed in the unstable region. The combination of grayscale image and phase image improves the accuracy of boundary recognition.

Benefits of technology

It improves the accuracy of boundary recognition, reduces phase noise, lowers point cloud noise, and enhances the accuracy of 3D reconstruction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117589087B_ABST
    Figure CN117589087B_ABST
Patent Text Reader

Abstract

The application discloses a kind of phase correction method and system for structured light stripe profile projection, when boundary is identified, including the process of twice boundary identification, edge extraction is carried out by gray scale chart in initial boundary identification, in the second boundary identification, edge information extraction is carried out by phase calculation, boundary is identified by gray scale chart and phase diagram two directions, improve the accuracy of boundary identification, further the result of twice boundary identification is fused, so that the phase of stable area is not disturbed by jump pixel, ensure the accuracy of boundary division, based on the region after division, filtering processing is carried out to stable area, reduce the loss of feature information, provide reference information for the correction of unstable area, reduce error transmission, when the unstable area is compensated for error with stable area as reference, phase noise can be reduced, so as to reduce point cloud noise and improve precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of optical three-dimensional measurement technology, and relates to a phase correction method and system for structured light fringe contour projection. Background Technology

[0002] Fringe projection profilometry (FPP) is a non-contact, high-precision optical 3D measurement technique. FPP has been widely applied in medical imaging, manufacturing, archaeology, package sorting, robotics, and computer vision. Traditional FPP consists of one or two cameras and a projector. The projector projects a set of coded fringe patterns onto an object, and the camera captures the distorted fringe image. The 3D information of the object can be recovered through decoding and triangulation. Phase unwrapping is a key problem in 3D shape measurement based on fringe projection profilometry (FPP). Due to inverse trigonometric function operations, the retrieved phase is wrapped between -π and π, which is ambiguous for further phase-to-depth mapping. To eliminate phase ambiguity, spatial and temporal phase unwrapping methods have been proposed. Spatial phase unwrapping methods detect and eliminate 2π phase jumps by judging the phase difference between adjacent pixels, while temporal phase unwrapping (TPU) methods eliminate phase ambiguity by projecting additional patterns to uniquely label each period of the wrapped phase. Because it employs pixel-by-pixel phase unwrapping, the TPU method is more suitable for complex and isolated scenes. This type of method mainly eliminates phase blur by matching the wrapped phase and the corresponding fringe order, showing good adaptability to complex or isolated test scenes. However, in actual measurements, the TPU method suffers from phase unwrapping errors, which severely affect the final 3D reconstruction results. There are two main types of error sources: one is random phase unwrapping errors caused by factors such as optical system noise and ambient light interference, with a relatively uniform amplitude distribution; the other is errors caused by the mismatch between the tangent line calculation and the wrapped phase and fringe order. These errors are mostly concentrated at discontinuities in the wrapped phase and are called jump errors.

[0003] In actual measurements, phase unwrapping is susceptible to errors due to various factors. First, noise generated by the camera or sensor hardware when capturing fringe images can affect image quality. Sensor noise includes dark current noise, readout noise, and gain noise, while camera noise includes thermal image noise and fixed pattern noise. Second, besides hardware factors, environmental factors such as insufficient light and uneven illumination during image acquisition can also interfere with image quality. Third, image transmission may be affected by noise, such as signal attenuation and electromagnetic interference. Fourth, optical system limitations can introduce some nonlinear errors. Fifth, during phase calculation of fringe images, the limitations of the arctangent function can blur the periodic edges of the phase, easily leading to phase unwrapping errors in adjacent pixel regions. In addition to these reasons, imperfections in the algorithm and insufficient computing power also contribute to the problem. Based on the magnitude of the error change between adjacent values ​​after phase unwrapping, errors with larger changes can be called jump errors, while errors with smaller changes can be called random errors.

[0004] Random errors arise in practice due to factors such as optical imaging systems, where the phase may exhibit a wavy, increasing trend with inconsistent changes between adjacent phases. When calculating point clouds based on the phase, these fluctuations cause point cloud jitter, increasing the RMS and affecting measurement accuracy. Another type of error, skipping errors, is mainly caused by periodic errors resulting from the inconsistency between the periods of Gray code and phase-shift code. Both of these errors affect the final 3D reconstruction results. Summary of the Invention

[0005] The purpose of this invention is to solve the problem of phase error in existing optical three-dimensional measurement technology, and to provide a phase correction method and system for structured light stripe contour projection.

[0006] To achieve the above objectives, the present invention employs the following technical solution:

[0007] A phase correction method for structured light fringe profile projection includes the following steps:

[0008] The grayscale image of the target object is obtained from the stripe image. The first boundary recognition is performed on the obtained grayscale image to obtain the first extracted edge information.

[0009] The stripe image is unwrapped to calculate the phase, and the edge information is extracted a second time.

[0010] The edge information extracted in the first and second extractions is fused to obtain the final boundary result, and the stable region and unstable region are divided according to the final boundary result.

[0011] The stable region is filtered to obtain the error distribution of the phase data in that region. The pixel priority in the unstable region is calculated. Based on the error distribution of the phase data in the stable region, the phase of the unstable region is corrected sequentially, starting from the priority pixels.

[0012] A further improvement of the present invention is that:

[0013] The process of obtaining the first extracted edge information includes the following steps:

[0014] The Sobel operator is used for the first boundary identification:

[0015] Calculate the average gradient of adjacent pixels and the average gradient of outer pixels respectively;

[0016] The average gray level of the center pixel is estimated by the average gradient of the adjacent pixels and the average gradient of the outer pixels. The gray level and edge direction of all pixels in the image are calculated sequentially for all pixels.

[0017] Set a threshold for the center pixel, and divide the image based on the set threshold, the gray values ​​of all pixels, and the edge direction to determine the preliminary boundaries between stable and unstable regions.

[0018] The average gray level estimate of the center pixel is calculated using formula (1):

[0019] g(x,y)=|g x (x,y)| / σ+|g y (x,y)| / σ (1)

[0020] In the formula, g x (x,y) and g y (x,y) represents the gradient values ​​in the X and Y directions; σ represents the attenuation factor;

[0021] Binarize the selected threshold:

[0022] Set the window size, and take the average of the values ​​after removing the maximum and minimum values ​​within the window as the final threshold for the center pixel:

[0023]

[0024] In the formula, This represents the sum of the grayscale values ​​of the pixels within the window.

[0025] The process of obtaining the second extracted edge information includes the following steps:

[0026] The phase of the striped image is calculated by unwrapping it, and the phase gradient and correlation coefficient are obtained by convolution.

[0027] Quadratic boundary identification based on phase gradient;

[0028] The stable and unstable regions are divided based on the final boundary results:

[0029] The edge information extracted in the first and second extractions is fused to generate a phase mask, which serves as the basis for dividing the stable and unstable regions.

[0030] The filtering process for the stable region includes the following steps:

[0031] Perform mean filtering along the row direction of the image:

[0032]

[0033]

[0034] In the formula, W represents a one-dimensional window with radius r centered at pixel (x,y), the input data is the phase of the stable region, n is the number of consecutive effective pixels within the template window W, and p i The phase of the effective pixel is represented by phase(x,y); phase(x,y) represents the phase of the pixel after correction by averaging (x,y).

[0035] The error compensation correction for the phase in the unstable region includes the following steps:

[0036] Filter the pixel with the highest priority in the unstable region, and then search for the final matching pixel in the horizontal direction of that point;

[0037] Error correction is performed by referencing the bit error distribution in the stable region and the positional relationship between the finally matched pixels and the points to be repaired.

[0038] After error correction is completed, update the phase values ​​and structure mask of pixels in the unstable region;

[0039] The pixels in the unstable region are corrected one by one until all phase corrections in the unstable region are completed.

[0040] The process of determining the pixel with the highest priority in the unstable region includes the following steps:

[0041]

[0042] I=Ω+ψ (6)

[0043] P(x,y)=C(x,y)*phase(x,y) / d(x,y) (7)

[0044] In the formula, P(x,y) represents the priority of a certain pixel; C(x,y) represents the mask of a certain pixel; phase(x,y) represents the phase value; and d represents the distance between a certain pixel and the nearest stable region pixel in the horizontal direction.

[0045] Move horizontally near the pixel with the highest priority, and select the pixel that has more than 80% of the pixels in the stable region within the moving window and whose center pixel belongs to the stable region as the final matching pixel.

[0046] A phase correction system for structured light stripe contour projection includes a primary edge recognition module, a secondary edge recognition module, a region segmentation module, and a correction module.

[0047] The initial edge recognition module is used to obtain a grayscale image of the target object based on the stripe image, and to perform the first boundary recognition on the obtained grayscale image to obtain the first extracted edge information;

[0048] The secondary edge recognition module is used to unwrap the stripe image and calculate the phase to obtain the second extracted edge information;

[0049] The region segmentation module is used to fuse the edge information extracted in the first extraction and the edge information extracted in the second extraction to obtain the final boundary result, and to divide the region into stable region and unstable region based on the final boundary result.

[0050] The correction module is used to filter the stable region, obtain the error distribution of the phase data in the region, calculate the pixel priority in the unstable region, and perform error compensation correction on the phase of the unstable region sequentially, starting from the priority pixels, based on the error distribution of the phase data in the stable region.

[0051] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method as described in any one of the present invention.

[0052] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method as described in any one of the present invention.

[0053] Compared with the prior art, the present invention has the following beneficial effects:

[0054] This invention discloses a phase correction method for structured light fringe contour projection. The method involves two boundary recognition processes: initial boundary recognition using grayscale images for edge extraction, and second boundary recognition using phase calculations for edge information extraction. By recognizing the boundary from both grayscale and phase perspectives, the accuracy of boundary recognition is improved. Furthermore, the results of the two boundary recognition processes are fused to ensure that the phase of the stable region is not affected by pixel jumps, guaranteeing accurate boundary segmentation. Based on the segmented region, the stable region is filtered to reduce feature information loss and provide reference information for the correction of the unstable region, reducing error propagation. Using the stable region as a reference for error compensation in the unstable region reduces phase noise, thereby reducing point cloud noise and improving accuracy. Attached Figure Description

[0055] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0056] Figure 1 This is a schematic diagram of the process of the present invention;

[0057] Figure 2 This is a schematic diagram of the boundary recognition process of the present invention;

[0058] Figure 3 This is a composite image of the stripe pattern of the present invention;

[0059] Figure 4 This is a schematic diagram of the 5*5 Cartesian network and city distance of the present invention; (where a represents the position of the neighboring pixels of the target pixel, and b represents the distance weighting value of the neighboring pixels);

[0060] Figure 5 This is a schematic diagram of the filtered phase correlation coefficient template of the present invention (where a represents the 6 directions of the target pixel correlation scale template, b represents the horizontal scale template; c represents the 45° scale template; d represents the 135° scale template; e represents the vertical scale template; f represents the 225° scale template; g represents the 315° scale template; h represents the integrated template).

[0061] Figure 6 This is a schematic diagram of the edge detection result obtained by integrating the two boundary recognition results in this invention; (where a represents the result of only performing grayscale image boundary recognition, b represents the result of only performing phase image boundary recognition, and c represents the boundary recognition result of fusing grayscale image and phase image).

[0062] Figure 7 This is a schematic diagram of the phase correction process of the present invention;

[0063] Figure 8 This is a schematic diagram illustrating the priority calculation of the present invention;

[0064] Figure 9 In this embodiment of the invention, the measurement results of standard components during the test process are shown (where a represents a partial fringe pattern of the standard sphere, b represents a composite image of the standard sphere, c represents the reconstruction result of the standard sphere, d represents a partial fringe pattern of the standard plane, e represents a composite image of the standard plane, and f represents the reconstruction result of the standard plane). Detailed Implementation

[0065] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0066] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0067] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0068] In the description of the embodiments of the present invention, it should be noted that if terms such as "upper," "lower," "horizontal," or "inner" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of the invention is in use, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. Furthermore, terms such as "first" and "second" are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0069] Furthermore, the use of the term "horizontal" does not imply that the component must be absolutely horizontal, but rather that it can be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal than "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted.

[0070] In the description of the embodiments of the present invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention according to the specific circumstances.

[0071] The present invention will now be described in further detail with reference to the accompanying drawings:

[0072] See Figure 1 This invention discloses a phase correction method for structured light fringe contour projection, specifically including the following steps:

[0073] Step 1: Boundary recognition, such as Figure 2 As shown

[0074] Step 1.1: Initial boundary identification. The stripe patterns are stitched together to obtain a complete grayscale image. An improved Sobel operator is used for initial boundary identification.

[0075] A complete image of the target object is obtained by stitching together the stripe images, such as... Figure 3 As shown, threshold filtering and morphological processing are performed on the grayscale image of the target object, and the improved Soble operator is used for image recognition to obtain the edge information extracted in the first step.

[0076] First, a complete grayscale image of the target object is obtained by stitching together the stripe images. In order to obtain rich features, the image is enhanced by morphological opening operation, which involves erosion followed by dilation.

[0077] In edge detection methods, the Sobel operator has a significant effect on suppressing Gaussian noise and performs well in processing images with gradual gray-level changes and high noise levels. In this embodiment, the Sobel operator is selected to perform edge detection on the enhanced image. The main purpose of Sobel operator detection is to calculate the average gradient estimate of the center pixel. The main process is to sum the gradients of the image's gradient vector (the ratio of the forward difference of pixel gray level to the city distance) in four directions (vertical, horizontal, 45° diagonal, and 135° diagonal) in the Cartesian network. In order to expand the boundary range, the receptive field scale of the convolution template is changed to 5*5.

[0078] Sobel uses city distance as pixel distance, with a distance of 2 between diagonally adjacent pixels. Figure 4 As shown, Z 13 Representing the center pixel, Z7, Z8, Z9, Z 12 Z 14 Z 17 Z 18 Z 19 Representing adjacent pixels, Z1, Z3, Z5, Z 11 Z 15 Z 21 Z 23 Z 25 This represents the outermost pixel, which is aligned with the direction of its neighboring pixels. The average gradient estimate of the center pixel is calculated primarily by referencing its neighboring pixels and the outermost pixels. The specific calculation process is shown below.

[0079] Calculate the average gradient of neighboring pixels:

[0080] The direction vectors are (Z7, Z) in sequence. 19 (Z8,Z) 18 (Z9,Z) 17 ), (Z 14 Z 12 The unit components of the corresponding control difference directions are (-1,1), (0,1), (1,1), and (1,0), respectively, and the corresponding inverse distance weights are 1 / 4, 1 / 2, 1 / 4, and 1 / 2, respectively. The average gradient calculated from the four directions is:

[0081]

[0082] Calculate the average gradient of the outer pixels:

[0083] The direction vectors are (Z1, Z...) 25 (Z3,Z) 23 (Z5,Z) 21 (Z) 15 Z 11 The unit components of the corresponding control difference directions are (-1,1), (0,1), (1,1), and (1,0), respectively, and the corresponding inverse distance weights are 1 / 8, 1 / 4, 1 / 8, and 1 / 4, respectively. The average gradient calculated from the four directions is:

[0084] G2=(Z1-Z 25 ) / 8*[-1,1]+(Z3-Z 23 ) / 4*[0,1]+(Z5-Z 21 ) / 8*[1,1]+(Z 15 -Z 11 ) / 4*[1,0] (9)

[0085] Calculate the average gradient estimate of the center pixel:

[0086] By summing the components obtained in the above two steps, we can obtain the average gray level estimate of the center pixel. Reducing the denominator in this formula and decomposing it along the X and Y directions yields a 5x5 Sobel operator template, where directionX represents the convolution template in the horizontal X direction and directionY represents the convolution template in the vertical Y direction.

[0087]

[0088]

[0089] Furthermore, the grayscale image is convolved with the operator templates in the two directions calculated in the third step to obtain the gradient values ​​g in the two directions. x (x,y),g y To avoid data overflow, the values ​​(x, y) are divided by a decay factor σ and then summed to obtain the average gray level estimate of the center pixel. Here, σ is set to 10, and the direction is determined by the direction of the obtained center pixel. This calculation is performed on all pixels to determine the gray level and edge direction of all pixels in the image.

[0090] g(x,y)=|g x (x,y)| / σ+|g y (x,y)| / σ (1)

[0091] Furthermore, the adaptive dynamic threshold selects the optimal threshold for binarization.

[0092] Within a 3x3 window, the average value after removing the maximum and minimum values ​​is used as the final threshold for the center pixel.

[0093]

[0094] In the formula: The sum of gray values ​​of all pixels in the 3×3 neighborhood of pixel (x,y) is subtracted from the maximum and minimum gray values ​​and the average is taken as the threshold T adaptively determined within this neighborhood.

[0095] Pixels with gray values ​​greater than their threshold T within each template are set to 255, thus marking them as unstable edge regions. Pixels with gray values ​​less than the threshold are set to 0. Based on the distribution of phase data, pixels with gray values ​​less than the threshold and valid phase are classified as stable regions. By traversing all pixels in the image, the global stable and unstable regions can be determined.

[0096] Step 1.2: Secondary Boundary Recognition

[0097] Then, phase data and phase gradient are calculated based on the stripe image. Edge information is extracted a second time based on the distribution of the phase gradient. After edge detection in both grayscale and phase directions, the final image segmentation result is obtained, which is divided into stable and unstable regions.

[0098] Specifically, the following steps are included:

[0099] The corresponding phase data is obtained by unwrapping the stripe pattern. Phase can be understood as 2D data with depth information. The error between adjacent phases of each pixel is calculated. Error analysis is performed on the pixel in 6 directions on a 3*3 scale. This value is used as the criterion for determining whether the current pixel belongs to an edge. The weighted matrix coefficients of the point are obtained by summing the error weights.

[0100] like Figure 5 As shown, the pentagram area represents the target pixel. Figure 5 (a) The arrows indicate 6 directions. Figure 5 (b) represents the horizontal dimension template. Figure 5 (c) represents the 45° dimensional template. Figure 5 (d) represents the 135° dimensional template. Figure 5 (e) represents the vertical dimension template. Figure 5 (f) represents the 225° orientation scale template. Figure 5 (g) represents a 315° directional scale template. Integrating the correlation coefficients of the pixels yields a 5x5 scale weighted coefficient, such as... Figure 5 As shown in (h), the phase gradient after filtering in the stable region, i.e., the absolute value of the error between adjacent phases, is multiplied by the correlation coefficient, and the calculated value is used as the error evaluation index for that point.

[0101] By integrating the results of the two boundary recognition operations, and after initial edge detection of the grayscale image and secondary edge detection of the phase, we can obtain the following: Figure 6 The edge detection results are shown. Some details are detected repeatedly, which makes the edges thicker. This avoids edge information being mixed in with the data in stable regions. The following data processing can avoid interference from abnormal pixels in the neighborhood on the phase correction of stable regions. A mask of the same size as the original phase is regenerated. A value of 1 is assigned to the boundary blocks and a value of 0 is assigned to the stable regions. This is used as the basis for the structural judgment of subsequent phase correction.

[0102] Boundary identification is performed using both grayscale and phase images. For grayscale boundary identification, an improved Sobel operator and adaptive thresholding are used to obtain a preliminary segmentation result. For phase boundary identification, the gradient of the phase error distribution of adjacent pixels and weighting coefficients are used to obtain a second segmentation result. The two segmentation results are then fused to obtain structural masks for the phase-stable and unstable regions, aiming to ensure that the phase of the stable region is not disturbed by abrupt pixel changes.

[0103] Step 2: Phase correction, see Figure 7 .

[0104] First, the phase in the stable region is determined by filtering suitable data and analyzing the phase residual distribution within that region. The results are then used as reference data for phase correction in the unstable region. Phase correction in the boundary unstable region primarily involves referencing the data and residual distribution in the stable region to find suitable reference points and perform error compensation on the target points. The specific process is as follows:

[0105] Step 2.1 Phase Correction in the Stable Region

[0106] Based on the segmentation results, the stable region is subjected to adaptive window filtering to calculate the error distribution of the phase data in this region, and the processed data is used as a reference point for subsequent calculations.

[0107] General filtering requires referencing the surrounding neighboring pixels when processing the target point. To ensure a good linear increasing trend in phase data and minimize data loss, mean filtering is performed along the row direction of the image. Compared to other smoothing filters, mean filtering is more effective at suppressing Gaussian noise. When selecting the filtering data and the window, texture information near the pixel needs to be considered. Since edge detection already takes into account the phase error of adjacent pixels, the size of the filtering window can be determined simply by the number of consecutive pixels in the horizontal direction.

[0108]

[0109]

[0110] In the formula, W represents a one-dimensional window with radius r centered at pixel (x,y), the input data is the phase of the stable region, n is the number of consecutive effective pixels within the template window W, and p iThe phase of a valid pixel is represented by the average phase (phase(x,y)) after correction. This process only applies when there are at least three consecutive valid pixels. For pixels with fewer than three valid pixels, these are treated as isolated points, and the corresponding mask value is updated to 1. These pixels are then corrected together with the unstable region. After filtering the stable region in the horizontal row direction, the phase gradient of adjacent pixels in the filtered data is calculated and its distribution is analyzed. The gradient with the highest probability is used as the reference for the magnitude of the next boundary correction.

[0111] Adaptive window filtering correction of the phase in the stable region reduces the loss of feature information, provides effective reference information for subsequent correction, and reduces error propagation.

[0112] Step 2.2: Phase Correction in the Unstable Region

[0113] The third step is to propose a boundary phase correction strategy. Combining the Manhattan distance formula and pixel priority, the pixel closest to the unstable phase is selected in the stable region. The unstable phase is fitted and corrected according to the error distribution calculated in step 2.1. Finally, the corrected phase data is obtained. The corrected phase is then transformed into a 3D point cloud according to the coordinate system transformation relationship.

[0114] Phase ambiguity, interference from factors such as hardware, algorithms, and environment, can easily lead to periodic phase disorder, resulting in noise or calculation errors in the calculated point cloud. To reduce the impact of noise, after completing phase filtering in the stable region, it is important to perform error compensation for the unstable phase, thereby improving reconstruction accuracy while minimizing phase loss.

[0115] The main process of phase correction in unstable regions is to refer to the data and gradient distribution in stable regions, match appropriate pixels, and compensate for the phase error of the target point.

[0116] First, the pixel information of the unstable region is used as input to filter the pixel with the highest priority in the region. Then, a 5*5 window is determined in the stable region in the horizontal direction of the point. As the window moves, the best matching pixel is searched. The phase of the point to be corrected is obtained by referring to the phase error distribution of the best matching pixel. Finally, the phase data and the structure mask are updated.

[0117] First, calculate the priority of the phase to be corrected, such as... Figure 8 As shown, Ω represents the stable region, ψ represents the unstable region, and ξ represents the pixel region within the unstable region that is closest to the stable region. Pixels within this unstable region have higher priority and are repaired first during error correction. The priority P(x,y) of a pixel is determined by the mask C(x,y) generated by boundary recognition, the phase value phase(x,y), and the distance d between that point and the nearest stable pixel in the horizontal direction.

[0118]

[0119] I=Ω+ψ (6)

[0120] P(x,y)=C(x,y)*phase(x,y) / d(x,y) (7)

[0121] Moving horizontally in a 9x9 window near high-priority pixels, the system searches for the best-matching stable region pixel. The criterion is that more than 80% of the pixels within the window are stable, and the center pixel belongs to the stable region. Error correction is performed based on the phase error distribution and the positional relationship between the matching point and the point to be repaired. After error correction, the phase value of the pixels within the ξ region is updated, and their mask value is changed from 1 to 0. This process is repeated until all unstable region phases are corrected.

[0122] Error compensation is performed on the unstable region phase based on the phase results in the stable region. The final matching point is found in the horizontal direction, and the structure mask is updated until all phase corrections are complete. The purpose of correction is to reduce phase noise based on reliable data, thereby reducing point cloud noise and improving accuracy.

[0123] In this embodiment, the phase is corrected before calculating the phase-height mapping, thus avoiding some phase errors in advance, reducing point cloud noise, and obtaining more stable point cloud reconstruction results. The two boundary segmentations do not affect each other and are consistent in scale. Sequential or parallel calculations can be selected to reduce time consumption. Compared with traditional methods, the phase correction method disclosed in this embodiment can improve measurement accuracy. Based on this, the present invention discloses a verification embodiment:

[0124] Two standard workpieces (a flat plate with a flatness of 0.05 mm or higher, and a standard dumbbell ball with a diameter of 38.1 ± 0.01 mm and a center-to-center distance of 201.09 ± 0.01 mm) were tested within working ranges of 300–900 mm. The results are shown in Tables 1 and 2. Compared with the traditional method, the fitting error after phase correction is significantly reduced. Both methods show significant measurement errors at farther positions. This result is reasonable for a structured light 3D measurement system; when the camera and projection module positions remain unchanged, the farther away from the target object, the higher the efficiency of the measurement results in mitigating noise interference.

[0125] See Figure 9 These are the measurement results for standard components.

[0126] Table 1. Three-dimensional measurements of a standard dumbbell ball at different distances

[0127]

[0128]

[0129] Table 2. Three-dimensional measurement of the standard plane at different distances

[0130]

[0131] This invention also discloses a phase correction system for structured light stripe contour projection, including a primary edge recognition module, a secondary edge recognition module, a region division module, and a correction module;

[0132] The initial edge recognition module is used to obtain a grayscale image of the target object based on the stripe image, and to perform the first boundary recognition on the obtained grayscale image to obtain the first extracted edge information.

[0133] The secondary edge recognition module is used to unwrap the stripe image and calculate the phase to obtain the second extracted edge information;

[0134] The region segmentation module is used to fuse the edge information extracted in the first extraction and the edge information extracted in the second extraction to obtain the final boundary result, and to divide the region into stable region and unstable region based on the final boundary result.

[0135] The correction module is used to filter the stable region, obtain the error distribution of the phase data in the region, calculate the pixel priority in the unstable region, and perform error compensation correction on the phase of the unstable region sequentially, starting from the priority pixels, based on the error distribution of the phase data in the stable region.

[0136] A schematic diagram of a terminal device according to an embodiment of the present invention. The terminal device of this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the various method embodiments described above. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the various device embodiments described above.

[0137] The computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention.

[0138] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0139] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0140] The memory can be used to store the computer program and / or module. The processor implements various functions of the terminal device by running or executing the computer program and / or module stored in the memory and calling the data stored in the memory.

[0141] If the modules / units integrated into the terminal device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0142] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A phase correction method for structured light fringe contour projection, characterized in that, Includes the following steps: The grayscale image of the target object is obtained from the stripe image. The first boundary recognition is performed on the obtained grayscale image to obtain the first extracted edge information. The stripe image is unwrapped to calculate the phase, and the edge information is extracted a second time. The edge information extracted in the first and second extractions is fused to obtain the final boundary result, and the stable region and unstable region are divided according to the final boundary result. The stable region is filtered to obtain the error distribution of the phase data in the region. The pixel priority in the unstable region is calculated. Based on the error distribution of the phase data in the stable region, the phase of the unstable region is corrected sequentially, starting from the priority pixels. The error compensation correction for the phase in the unstable region includes the following steps: Filter the pixel with the highest priority in the unstable region, and then search for the final matching pixel in the horizontal direction of that point; Error correction is performed by referencing the bit error distribution in the stable region and the positional relationship between the finally matched pixels and the points to be repaired. After error correction is completed, update the phase values ​​and structure mask of pixels in the unstable region; The pixels in the unstable region are corrected one by one until all phase corrections in the unstable region are completed. The process of determining the pixel with the highest priority in the unstable region includes the following steps: In the formula, Indicates the priority of a certain pixel; A mask representing a specific pixel; Indicates the phase value; This represents the distance between a given pixel and the nearest stable region pixel in the horizontal direction. Move horizontally near the pixel with the highest priority, and select the pixel that has more than 80% of the pixels in the stable region within the moving window and whose center pixel belongs to the stable region as the final matching pixel.

2. The phase correction method for structured light fringe contour projection according to claim 1, characterized in that, The process of obtaining the first extracted edge information includes the following steps: The Sobel operator is used for the first boundary identification: Calculate the average gradient of adjacent pixels and the average gradient of outer pixels respectively; The average gray level of the center pixel is estimated by the average gradient of the adjacent pixels and the average gradient of the outer pixels. The gray level and edge direction of all pixels in the image are calculated sequentially for all pixels. Set a threshold for the center pixel, and divide the image based on the set threshold, the gray values ​​of all pixels, and the edge direction to determine the preliminary boundaries between stable and unstable regions.

3. The phase correction method for structured light fringe contour projection according to claim 1, characterized in that, The average gray level estimate of the center pixel is calculated using formula (1): In the formula, and The gradient values ​​in the X and Y directions are represented separately. Indicates the attenuation factor; Binarize the selected threshold: Set the window size, and take the average of the values ​​after removing the maximum and minimum values ​​within the window as the final threshold for the center pixel: In the formula, This represents the sum of the grayscale values ​​of the pixels within the window.

4. The phase correction method for structured light fringe contour projection according to claim 1, characterized in that, The process of obtaining the second extracted edge information includes the following steps: The phase of the striped image is calculated by unwrapping it, and the phase gradient and correlation coefficient are obtained by convolution. Quadratic boundary identification based on phase gradient; The stable and unstable regions are divided based on the final boundary results: The edge information extracted in the first and second extractions is fused to generate a phase mask, which serves as the basis for dividing the stable and unstable regions.

5. A phase correction method for structured light fringe contour projection according to claim 1, characterized in that, The filtering process for the stable region includes the following steps: Perform mean filtering along the row direction of the image: In the formula, Represented by pixels Centered on, with radius as A one-dimensional window, with input data being the phase of the stable region. For template window Continuous valid pixels within, Indicates the phase of a valid pixel; This means that the pixel points are obtained by averaging. The corrected phase.

6. A phase correction system for structured light fringe contour projection that implements the method of claim 1, characterized in that, It includes an initial edge recognition module, a secondary edge recognition module, a region segmentation module, and a correction module; The initial edge recognition module is used to obtain a grayscale image of the target object based on the stripe image, and to perform the first boundary recognition on the obtained grayscale image to obtain the first extracted edge information. The secondary edge recognition module is used to unwrap the stripe image and calculate the phase to obtain the second extracted edge information; The region segmentation module is used to fuse the edge information extracted in the first extraction and the edge information extracted in the second extraction to obtain the final boundary result, and to divide the region into stable region and unstable region based on the final boundary result. The correction module is used to filter the stable region, obtain the error distribution of the phase data in the region, calculate the pixel priority in the unstable region, and perform error compensation correction on the phase of the unstable region sequentially, starting from the priority pixels, based on the error distribution of the phase data in the stable region.

7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1-5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1-5.