Monocular structured light three-dimensional reconstruction method based on parity check XOR coding

By using parity check XOR encoding, parity check codes and XOR code diagrams are generated. Combined with sinusoidal fringe projection, the problems of transition error and global illumination effect in the traditional Gray code phase deconstruction method are solved, and high-precision 3D reconstruction is achieved.

CN121482267APending Publication Date: 2026-02-06JIANGSU JUMU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511633143.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Traditional Gray code phase decoding methods are prone to jump errors, and global illumination effects have a significant impact on phase decoding, leading to reduced accuracy in 3D reconstruction.

Method used

A monocular structured light 3D reconstruction method based on parity check XOR coding is adopted. By generating parity check codes and XOR code maps, combined with sinusoidal fringe projection, the wrapping phase is calculated and checked to correct the phase jump error.

Benefits of technology

It effectively suppresses global illumination problems, eliminates absolute phase jump errors, improves the accuracy and robustness of 3D measurement, and adapts to high-precision reconstruction under complex working conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482267A_ABST
    Figure CN121482267A_ABST
Patent Text Reader

Abstract

According to the monocular structured light three-dimensional reconstruction method based on parity check exclusive-or coding, a structured light coding and decoding strategy of parity check and exclusive-or operation is constructed, firstly, global illumination components in a scene are separated by using high-frequency information of a sinogram, and a dynamic threshold value per pixel is generated to binarize a coding pattern; secondly, an auxiliary graph is generated through parity check bits of the Gray codes, XOR operation is carried out on a traditional low-frequency Gray code graph and the auxiliary graph, high-frequency information is embedded, and the problems of fringe defocus, image blurring and the like caused by global illumination are solved; and finally, performing odd-even check on the absolute phase by the designed auxiliary graph, identifying and constructing a phase error mask graph, optimizing a decoding process, and eliminating a jump error in the absolute phase. According to the method, the global illumination problem can be effectively inhibited, the absolute phase jump error is eliminated, and a reliable technical path is provided for high-precision three-dimensional measurement under complex working conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of structured light 3D reconstruction technology, specifically a monocular structured light 3D reconstruction method based on parity check XOR coding. Background Technology

[0002] Phase unwrapping is a key technique in optical interferometry and phase imaging. Phase unwrapping methods are mainly divided into two categories: spatial methods and temporal methods. Among them, temporal phase unwrapping (TPU) eliminates ambiguity by analyzing the phase values ​​of the same pixel at different time series, and its reliability is far higher than that of spatial methods, which are easily affected by surface discontinuities or isolated objects. In TPU methods, intensity-encoded methods, especially Gray code-assisted phase shifting methods, are widely used due to their intuitive principle and strong anti-interference ability. However, this method faces two problems in practice: First, in the transition edge region of Gray code black and white fringes, factors such as camera defocus and system noise can lead to blurred binarization judgments, easily causing misjudgment of fringe order, resulting in phase jump errors and drastic changes or breaks in the reconstructed point cloud. Second, in measurement scenarios with complex global illumination effects (such as subsurface scattering from object surfaces and mutual reflection between adjacent objects), the contrast of projected fringes will be severely reduced, and the intensity information of the encoded pattern will be interfered with, causing traditional binary decoding methods to fail, ultimately leading to decoding failure or reduced reconstruction accuracy.

[0003] To address the challenges of phase jump errors and global illumination interference, researchers have proposed various solutions. On the hardware side, some studies have introduced linear polarizers between the object under test and the projection system to construct polarization difference imaging systems, filtering out scattered light in specific polarization directions and thus suppressing the influence of global illumination. However, this method increases system complexity and cost. At the algorithmic level, to overcome the edge decoding ambiguity problem of Gray codes, complementary Gray codes and their variants have been proposed, providing redundant information by projecting complementary patterns to improve decoding reliability. To combat global illumination, early research has shown that projecting high-frequency patterns can effectively separate global illumination and direct illumination components in a scene. Methods combine high-frequency binary fringes with phase-shifting methods or employ modulation phase-shifting techniques to suppress global illumination artifacts; other studies have involved in-depth analysis of the physical model of global illumination, designing coded patterns for error calibration, and attempting to reconstruct the light transfer function of each pixel to achieve accurate separation.

[0004] Despite significant progress made by existing methods, there are still obvious limitations. Hardware improvements sacrifice the inherent simplicity and low cost advantages of structured light systems. Furthermore, most algorithms still lack robustness when dealing with strong global illumination or objects with complex surface optical properties; while some methods have increased decoding frequency, their ability to correct phase transition errors is limited, and the complexity of the algorithmic flow reduces the system's decoding efficiency. Summary of the Invention

[0005] To address the issues of phase jump errors inherent in traditional Gray code phase decoding methods and the impact of global illumination effects on phase decoding, this invention provides a monocular structured light 3D reconstruction method based on parity check XOR coding. This method can identify and correct erroneous fringe orders caused by edge blurring, significantly improves adaptability to global illumination environments, solves the phase jump error problem, and provides a reliable technical path for high-precision 3D measurement under complex working conditions.

[0006] The technical solution of this invention is as follows: a monocular structured light 3D reconstruction method based on parity check XOR coding, characterized by comprising the following steps: S1: Select an n-bit Gray code, denoted as: basic Gray code, and the corresponding Gray code diagram is denoted as: basic Gray code diagram; According to the parity check code generation method, the basic Gray code operation is used to generate a parity check code; then, an auxiliary code map PCP is generated based on the parity check code. S2: Generate n XOR codes based on the basic Gray code map and the auxiliary code map PCP. Figure X ; S3: Move the sinusoidal fringe uniformly N steps within one period, with each phase shift being 2π / N, to obtain N sinusoidal fringe patterns, denoted as: phase shift pattern; S4: Using a calibrated structured light system, the auxiliary code map and the XOR code are... Figure X The phase-shifted image and the phase-shifted image are projected onto the surface of the object to be reconstructed, and the corresponding projected images are acquired. S5: Using the projection images of N phase shift images, calculate the wrapping phase φ(x,y) corresponding to each pixel (x,y) carrying the surface shape information of the object; S6: Using the projection images of N phase-shift maps, the direct components L of the scene points are... g [x,y] and indirect component L d Solve for [x,y]; The initial confidence map is constructed by calculating the average intensity of each pixel based on the projection map of the N-step phase-shifting map; S7: Calculate the stability weight W corresponding to each pixel (x, y) based on the direct component and the indirect component. sAnd confidence level C(x,y); The initial confidence map and the stability weight W are used. s Multiplying them together yields the corrected confidence plot; S8: Calculate the confidence threshold τ corresponding to each pixel (x,y) based on the direct components; S9: Perform binarization processing on the collected XOR code image and the projection image of the auxiliary image; The binarization method is as follows: If the brightness of a pixel (x,y) in the image is greater than its corresponding confidence threshold τ, then the pixel value of that pixel is binarized to 1; otherwise, it is binarized to 0. S10: XOR the projection of the auxiliary image with each of the aforementioned XOR codes. Figure X The projection image is XORed to obtain the Gray code image, denoted as: Gray code image to be confirmed; S11: The initial parity check region of the auxiliary code map PCP is divided using the wrapping phase. Regions with a wrapping phase less than 0 correspond to odd parity check regions, and regions with a wrapping phase greater than 0 correspond to even parity check regions, thus obtaining the mask mask(x,y). For each pixel (x,y) in the Gray code image to be verified, a mask (x,y) is used for verification to obtain the verification result; The verification result is compared with the projection map of the auxiliary code map PCP to generate a parity map. S12: Based on the parityMap, perform error correction on the pixels with parity conflicts in the Gray code image to be confirmed, and obtain the corrected stripe order map. S13: Wrap the phase φ(x,y), the confidence map, and the corrected fringe order map to calculate the absolute phase map, thereby realizing the subsequent three-dimensional reconstruction process.

[0007] Its further features are: Step S1 includes the following steps in detail: S1.1: Each Gray codeword is regarded as a parity unit, and each unit is divided into two parity regions: odd parity region and even parity region; S1.2: The odd parity area is filled with the odd parity bit of the Gray code word: when the number of 1s in the Gray code word data unit is odd, fill in 0, otherwise fill in 1; the even parity area is filled with the even parity bit: when the number of 1s in the Gray code word data unit is odd, fill in 1, otherwise fill in 0. S1.3: Map the check bit value to the grayscale value, specifying that 1 corresponds to the highest grayscale value I. max =255, 0 corresponds to the lowest grayscale value I. min =0; In step S2, the XOR code Figure X The generation method is as follows: The XOR code is generated by XORing the basic Gray code map and the auxiliary code map PCP. Figure X ; When the binary bits of the two images are the same, the binary bit of the resulting image is set to 0; when the binary bits of the two images are different, the binary bit of the resulting image is set to 1. In step S5, the projection of the phase shift map is expressed as follows: ; In the formula, I k (x,y) represents the k-th projected fringe pattern; A(x,y) is the background light intensity, B(x,y) is the fringe modulation degree; φ(x,y) is the wrapping phase; In step S5, the method for calculating the wrapping phase φ(x,y) is as follows: ; In the formula, I k (x,y) represents the kth sub-projection fringe pattern; In step S6, the direct component L g [x,y] and indirect component L d The solution method for [x,y] is as follows: ; In the formula, I k (x,y), k∈[0,3], represents the kth sub-projection fringe pattern; In step S7, the stability weight W s The confidence level C(x,y) is calculated as follows: ; In the formula, I k (x,y) represents the kth sub-projected fringe pattern, and ε is the smoothing parameter; In step S8, the confidence threshold τ is calculated as follows: ; In the formula, τ0 represents the basic threshold without considering the influence of illumination; In step S11, the parityMap calculation method is as follows: ; Wherein, the mask(x,y) is: ; oddParity(x,y) represents the odd parity code calculated at (x,y) in the Gray code diagram, and evenParity(x,y) represents the corresponding even parity code; φ(x,y) is the wrapping phase corresponding to pixel (x,y); Step S12 specifically includes the following steps: a1: Based on the Gray code diagram to be confirmed, the fringe order of each pixel (x,y) in the diagram is determined, and an initial fringe order diagram K is constructed. The initial fringe order diagram K is then used as a basis for correction. a2: Scan the initial stripe order map K row by row to check the conflict area, count the pixel intervals with consecutive errors in each row, and find the conflict point. ; In the formula, x start and x end R represents the start and end y-coordinates of the error verification region, respectively. y This represents the pixel region in the y-th row that contains consecutive errors; a3: When correcting each conflict region, check whether the K value changes before and after: If the K value at the front of the area changes, it indicates that the stripe order changed too early. The K value in that area should be corrected to the K value of the previous pixel. If the K value changes, it is a late jump and should be corrected to the K value of the next pixel. If there is no change before and after, then the error in this area is considered to originate from the auxiliary... Figure 2 Value the deviation at the light-dark boundary while keeping the original K value unchanged; ; In the formula, H represents the row height of the image, and K(x,y) and floorMap(x,y) represent the stripe order before and after correction, respectively.

[0008] This application provides a monocular structured light 3D reconstruction method based on parity check and XOR encoding. It constructs a structured light encoding and decoding strategy that combines parity check and XOR operation. First, high-frequency information from a sine wave is used to separate the global illumination component in the scene, and a pixel-by-pixel dynamic threshold is generated to binarize the encoded pattern. Second, an auxiliary map is generated from the parity check bits of the Gray code. Then, a traditional low-frequency Gray code map is XORed with the auxiliary map to embed high-frequency information, suppressing problems such as stripe defocusing and image blurring caused by global illumination. Finally, the designed auxiliary map performs parity check on the absolute phase, identifies and constructs a phase error mask map, optimizes the decoding process, and eliminates jump errors in the absolute phase. This method can effectively suppress global illumination problems and eliminate absolute phase jump errors, providing a reliable technical path for high-precision 3D measurement under complex conditions. Attached Figure Description

[0009] Figure 1 This is a schematic diagram of global illumination effect error analysis; Figure 2 This is the overall flow of phase expansion in this method; Figure 3 This is an example of a structured light system in this application; Figure 4 This is an example of 3D reconstruction results and phase error analysis based on this method; Figure 5 Examples of direct and global component images of illumination obtained based on this method; Figure 6 Example 1 shows the point cloud result reconstructed based on this method; Figure 7 Example 2 shows the point cloud results reconstructed based on this method; Figure 8 Example 3 shows the point cloud results reconstructed based on this method; Figure 9 This is a flowchart of the method; Figure 10 This is a schematic diagram illustrating the principle of auxiliary graph generation based on parity check. Figure 11 Examples of Gray code diagrams, auxiliary diagrams, and phase shift diagrams. Detailed Implementation

[0010] To obtain reliable 3D reconstruction results, it is first necessary to determine the correspondence between camera pixels and projector pixels, which depends on the correct decoding of the deformed fringe image. However, global illumination effects in real-world scenes severely limit decoding accuracy, including mutual reflection of light on object surfaces and subsurface scattering within objects. This causes the image signal captured by the camera to deviate from the expected signal originally projected by the projector, and the degree of this signal distortion is closely related to the spatial frequency characteristics of the projected image.

[0011] like Figure 1 As shown, the long-range effect is more pronounced under low-frequency illumination. Light from bright stripe areas is reflected multiple times by the object's surface, propagating to areas that should be dark stripes, causing an abnormal increase in brightness in those areas. Figure 1 Taking a V-shaped groove scene illuminated by a low-frequency image as an example, rectangular regions A1 and A2 of the same size are selected on the upper and lower sides of the bottom of the groove (shown by the red dotted line in the figure). Due to the influence of global illumination, the average brightness of region A1 is higher than that of region A2, which will directly affect the decoding accuracy of this region. Meanwhile, the short-range effect mainly interferes with the clarity of the high-frequency image. Light undergoes low-pass filtering during subsurface scattering, causing severe blurring of the high-frequency image and making it difficult to binarize correctly. For example... Figure 1As shown in the image, which is illuminated by a high-frequency image, the image captured by the camera is noticeably blurred. For the traditional Gray code method, this effect will ultimately lead to errors in the reconstruction results.

[0012] like Figure 9 As shown, the present invention includes a monocular structured light 3D reconstruction method based on parity check XOR coding, which includes the following steps.

[0013] To suppress the influence of global illumination, this method employs a parity check-based XOR operation coding method to increase the frequency of the coding pattern. Similar to traditional Gray code-assisted phase shift techniques, this method uses a binary image and sine wave structure design. The binary image includes an auxiliary code image and a set of XOR code images, and the auxiliary pattern is generated as follows.

[0014] S1: Select an n-bit Gray code, denoted as: basic Gray code, and the corresponding Gray code diagram is denoted as: basic Gray code diagram.

[0015] like Figure 10 In the embodiment shown, a Gray code with n=3 bits is selected as the base Gray code.

[0016] According to the parity check code generation method, parity check codes are generated from basic Gray code operations; then, auxiliary code maps (PCPs) are generated based on the parity check codes. The detailed steps include:

[0017] S1.1: Each Gray codeword is regarded as a parity unit, and each unit is divided into two parity regions: odd parity region and even parity region; S1.2: The odd parity area is filled with the odd parity bit of the Gray code word: when the number of 1s in the Gray code word data unit is odd, fill in 0, otherwise fill in 1; the even parity area is filled with the even parity bit: when the number of 1s in the Gray code word data unit is odd, fill in 1, otherwise fill in 0. S1.3: Map the check bit value to the grayscale value, specifying that 1 corresponds to the highest grayscale value I. max =255, 0 corresponds to the lowest grayscale value I. min =0.

[0018] For an n-bit Gray code sequence: The calculation method for the parity bit is defined as follows: ; ; In the formula, e i Represents the i-th Gray code word g i Even parity bit, o i This represents the i-th Gray code word g. i The odd parity bit; b k(g i )∈{0,1} represents the i-th Gray code word g i The k-th bit value; the check function Φ(∙) maps the Gray code to the binary space {0,1} to establish an implicit correlation between codeword parity and spatial position.

[0019] Figure 10 In the example, G1, G2, and G3 represent the 1st, 2nd, and 3rd bits of the Gray code, respectively. The PCP code is two bits: one odd bit and one even bit. Therefore, the PCP code corresponding to Gray code 000 is 10, and the PCP code corresponding to Gray code 001 is 01.

[0020] The proposed method for generating auxiliary fringe patterns (PCP) based on parity-check codes enhances the robustness of Gray code decoding and enables the embedding of high-frequency information into low-frequency fringe patterns.

[0021] S2: Generate n XOR codes based on the basic Gray code map and the auxiliary code map PCP. Figure X .

[0022] Specific XOR codes Figure X The generation method is as follows: The XOR code is generated by XORing the basic Gray code diagram and the auxiliary code diagram PCP. Figure X The operational relationship can be described as follows: ; In the formula, X i (x,y) is an XOR code diagram, G i (x,y) is the Gray code diagram, and PCP(x,y) is the auxiliary code diagram. It is the XOR operator.

[0023] When the binary bits of the two images are the same, the binary bit of the resulting image is set to 0; when the binary bits of the two images are different, the binary bit of the resulting image is set to 1.

[0024] like Figure 11 In the illustrated embodiment, the XOR code Figure X This includes: G1⊕PCP=X1, G2⊕PCP=X2, and G3⊕PCP=X3.

[0025] To retrieve 3D information from the measurement scene, the overall phase unwrapping process of the proposed method is as follows: Figure 2 As shown. To calculate the absolute phase corresponding to the projector, the wrapping phase must first be calculated using the phase-shifting method.

[0026] S3: The sinusoidal fringes are uniformly shifted N steps within one period, with each phase shift being 2π / N, resulting in N sinusoidal fringe patterns, denoted as: phase-shifted patterns. For example... Figure 11 In the embodiment shown, N is 4, and P1, P2, P3 and P4 are the four corresponding sine stripe patterns.

[0027] S4: Use the calibrated structured light system to generate the auxiliary code image and XOR code. Figure X The phase-shifted image and phase-shifted image are projected onto the surface of the object to be reconstructed, and the corresponding projected images are acquired.

[0028] S5: Using the projection of N phase-shifted images, calculate the wrapping phase φ(x,y) corresponding to each pixel (x,y) carrying the surface shape information of the object.

[0029] The sine function expression for the projected fringe pattern of the phase-shifted image obtained by phase-shifting projection is: ; In the formula, I k (x,y) represents the k-th projected fringe pattern; A(x,y) is the background light intensity; B(x,y) is the fringe modulation degree; φ(x,y) is the wrapping phase.

[0030] Using this frame of deformed fringes, the method for calculating the wrapping phase φ(x,y) carrying the object's surface shape information is as follows: ; In the formula, I k (x,y) represents the k-th sub-projection fringe pattern.

[0031] like Figure 11 In the illustrated embodiment, the lines marked with φ represent the calculated wrapping phase φ(x,y), and the lines marked with K represent the calculated fringe order.

[0032] According to the literature Chen YC, Yao PC, Gai SY, et al. A self-alignment XORcoding strategy resistant to global illumination[J]. Measurement, 2022, 193, assuming that the global component received by each scene point is a smooth function of the illumination frequency, in complex scenes, the direct and indirect components of all scene points can be effectively determined through high-frequency illumination maps. The calculation method is as follows: ; In the formula, L+[x,y] and L-[x,y] represent the brightness values ​​of the same pixel in both bright and dark states, Ld[x,y] and Lg[x,y] represent the direct component and global component received by the pixel, α is the attenuation coefficient of the average power in high-frequency illumination mode, and b is the transmittance of the pixel when the projection source is off.

[0033] When the image sampling frequency is sufficiently high, α = 1 / 2 is chosen. The N-step sine wave used in the phase-shifting method provides high-frequency features. This method directly utilizes the phase-shifting graph to solve for the direct and global components. In this embodiment, N is set to 4, and a four-step phase-shifting graph is used for the solution.

[0034] S6: Using the projection of N phase-shifted images, the direct components L of the scene points are... g [x,y] and indirect component L d Solve for [x,y]; The average intensity of each pixel is calculated based on the projection map of the N-step phase-shifting map to form the initial confidence map.

[0035] Direct component L g [x,y] and indirect component L d The solution method for [x,y] is as follows: ; In the formula, I k (x,y), k∈[0,3], represents the k-th sub-projection fringe pattern.

[0036] Due to the positional relationship between the camera and the projector, the acquired images contain shadows and areas without stripes. To suppress and remove such noise interference and reduce computational complexity, this method proposes a confidence map generation strategy based on dynamic thresholds.

[0037] A phase-shifted image consists of a set of sine waves that move uniformly N steps within one period, with each pixel experiencing a complete cycle of brightness and darkness. Therefore, the average intensity of each pixel can be calculated from the N-step phase-shifted image as an initial confidence map.

[0038] To further improve the confidence value of stable regions, a stability weight composed of direct components and global components is introduced. The initial confidence map is multiplied by the stability weight to obtain the final confidence map. When the direct components in the image increase, the stability weight and the confidence value at the corresponding position will also increase, thus strengthening the confidence performance of stable regions.

[0039] S7: Calculate the stability weight W for each pixel (x, y) based on the direct and indirect components. s And confidence level C(x,y); The initial confidence plot and stability weight W s The corrected confidence map is obtained by multiplying the results. In this method, the average intensity of each pixel is calculated using an N-step phase-shift map as the initial confidence map, and a stability weight composed of direct components and global components is introduced to further improve the confidence value of the stable region.

[0040] In step S7, the stability weight Ws The confidence level C(x,y) is calculated as follows: ; In the formula, I k (x,y) represents the k-th projected fringe pattern, ε is a smoothing parameter, in this embodiment ε=0.005 to prevent division by zero; L d and L g These are the direct components and the global components.

[0041] S8: Calculate the confidence threshold τ for each pixel (x,y) based on the direct component.

[0042] In step S8, the confidence threshold τ is calculated as follows: ; In the formula, τ0 represents the base threshold without considering the effect of illumination; this method designs a dynamic threshold τ such that in the global component L g In larger areas, the threshold is automatically increased, effectively suppressing noise; while in L... g Smaller regions retain their original thresholds to avoid excessive suppression of valid signals. Ultimately, pixels with confidence values ​​below the dynamic threshold will not participate in subsequent calculations.

[0043] S9: Perform binarization processing on the XOR code image and the projection image of the auxiliary image captured by the camera; The binarization method is as follows: If the brightness of a pixel (x,y) in the image is greater than its corresponding confidence threshold τ, then the pixel value of that pixel is binarized to 1; otherwise, it is binarized to 0.

[0044] S10: XOR the projection of the auxiliary graph with each of the XOR codes. Figure X The projection image is XORed to obtain the Gray code image, denoted as: the Gray code image to be confirmed. The calculation relationship for reconstructing the Gray code image is: .

[0045] S11: Use the wrapping phase to complete the initial parity check region division of the auxiliary code map PCP.

[0046] Based on the relationship between phase-shift patterns and Gray code patterns, a set of sinusoidal fringes with a period of t requires at least Log2 t. NThe Gray code diagram is used for auxiliary phase expansion, and the wrapped phase calculated from the phase shift pattern is strictly aligned with each bit of the Gray code. Therefore, the parity check region in the auxiliary diagram is also strictly aligned with the wrapped phase, and the corresponding parity check region can be directly determined based on the wrapped phase. Regions with a wrapped phase less than 0 correspond to odd parity check regions, and regions with a wrapped phase greater than 0 correspond to even parity check regions, resulting in a mask (x,y). The mask (x,y) is represented as: .

[0047] For each pixel (x, y) in the Gray code image to be verified, a mask (x, y) is used for verification. Based on the verification regions divided by the mask, the odd parity code and even parity code of the Gray code value are calculated respectively to obtain the verification result. The verification result is compared with the projection map of the auxiliary code image PCP to generate a parity map. Regions with matching verification are set to 1, and regions with non-matching verification are set to 0.

[0048] The parityMap calculation method is as follows: ; Where oddParity(x,y) represents the odd parity code calculated at (x,y) in the Gray code diagram, and evenParity(x,y) represents the corresponding even parity code; φ(x,y) is the wrapping phase corresponding to pixel (x,y).

[0049] S12: Based on the parityMap, perform error correction on the pixels with parity conflicts in the Gray code image to be confirmed, and obtain the corrected fringe order map.

[0050] The correction method specifically includes the following steps: a1: Based on the Gray code diagram to be confirmed, the fringe order of each pixel (x,y) in the diagram is determined and an initial fringe order diagram K is constructed. The initial fringe order diagram K is then used as the basis for correction. a2: Scan the initial stripe order map K row by row to check the conflict area, count the pixel intervals with consecutive errors in each row, and find the conflict points. ; In the formula, x start and x end R represents the start and end y-coordinates of the error verification region, respectively. y This represents the pixel region in the y-th row that contains consecutive errors; a3: When correcting each conflict region, check whether the K value changes before and after: If the K value at the front of the area changes, it indicates that the stripe order changed too early. The K value in that area should be corrected to the K value of the previous pixel. If the K value changes, it is a late jump and should be corrected to the K value of the next pixel. If there is no change before and after, then the error in this area is considered to originate from the auxiliary... Figure 2 Value the deviation at the light-dark boundary while keeping the original K value unchanged; ; In the formula, H represents the row height of the image, and K(x,y) and floorMap(x,y) represent the stripe order before and after correction, respectively.

[0051] S13: Wrap the phase φ(x,y), confidence map, and corrected fringe order map to calculate a high-precision absolute phase map, thereby enabling the subsequent three-dimensional reconstruction process.

[0052] To evaluate the effectiveness of this method in eliminating jump errors in absolute phase, a calibrated structured light system was prepared, including a camera and a projector, with their relative positions remaining fixed. Its structure is as follows: Figure 3 As shown, the proposed XOR code diagram and a 4-step phase shift fringe with a frequency of 64 were projected using a projector. Using plaster casts and stepped blocks as objects, phase expansion was performed using this method to obtain the absolute phase. Figure 4 The reconstruction results of this method are shown. As can be seen from the corresponding 3D reconstructed point cloud, the surface smoothness of the reconstructed result is good.

[0053] To further quantify the method's performance, the absolute phase obtained using the complementary Gray code method is used as a benchmark to calculate the phase error of this method. Figure 4 The phase error calculation results of this method show that, except for a small number of error points in the object edge region due to shadow noise being filtered out by the confidence mechanism, the phase error of this method is zero in the remaining regions. This confidence strategy maintains accuracy while reducing the time cost of subsequent calculations. Error statistics show that the error rates of this method are only 0.80% and 0.75%, respectively, verifying its good performance in practical measurements.

[0054] To evaluate the robustness of this method in reflexive scenarios, a concave ceramic bowl was used as the measurement object in the experiment, and the method was used for 3D reconstruction. Figure 5 The images of the direct and global components of illumination calculated using this method are shown. It can be observed that, due to mutual reflection, the global component is more pronounced in the bottom region of the bowl, especially in... Figure 5 The area marked with a red box in the image shows overexposure, which leads to errors in 3D reconstruction. Figure 6 To reconstruct the point cloud results, it can be seen that the point cloud reconstructed by this method has fewer void areas in the bowl-shaped part, and in the bottom part of the bowl, except for a few overexposed areas, the point cloud data obtained by this method is more complete and smoother.

[0055] Furthermore, using translucent nylon microspheres as experimental subjects, the stability of this method in subsurface scattering scenarios was evaluated. The actual diameter of the microspheres was 20 mm. Figure 7 The point cloud reconstructed by this method is clearly more complete. A sphere fit was performed on the point cloud, and the number of points and related indicators are listed in Table 1, including the number of points, the fitting diameter, and the root mean square error (RMSE). This method still maintains high measurement accuracy and stability under subsurface scattering conditions.

[0056] Table 1 Evaluation of the sphere fitting results using this method Finally, to address the measurement challenges in global illumination environments, this method was used to perform 3D reconstruction of a battery cell with a blue insulating film covering its surface. This battery cell exhibits complex surface characteristics such as high reflectivity, high brightness, and unevenness. Figure 8 The results of the reconstructed point cloud are shown, demonstrating that the proposed method can maintain stable reconstruction quality even under strong interference conditions.

[0057] The fringe encoding and decoding method based on parity check and XOR coding proposed in this application can identify and correct erroneous fringe orders caused by edge blurring, significantly improve adaptability to global illumination environments, and solve the phase jump error problem, providing a reliable technical path for high-precision 3D measurement under complex working conditions. This method solves the problem of easy jump errors in traditional Gray code phase decoding methods and suppresses the influence of global illumination effects on phase decoding.

Claims

1. A monocular structured light 3D reconstruction method based on parity check XOR coding, characterized in that: It includes the following steps: S1: Select an n-bit Gray code, denoted as: basic Gray code, and the corresponding Gray code diagram is denoted as: basic Gray code diagram; According to the parity check code generation method, the basic Gray code operation is used to generate a parity check code; then, an auxiliary code map PCP is generated based on the parity check code. S2: Based on the basic Gray code map and the auxiliary code map PCP, calculate and generate n XOR code maps X; S3: Move the sinusoidal fringe uniformly N steps within one period, with each phase shift being 2π / N, to obtain N sinusoidal fringe patterns, denoted as: phase shift pattern; S4: Using a calibrated structured light system, the auxiliary code map, the XOR code map X, and the phase shift map are projected onto the surface of the object to be reconstructed, and the corresponding projected images are acquired. S5: Using the projection images of N phase shift images, calculate the wrapping phase φ(x,y) corresponding to each pixel (x,y) carrying the surface shape information of the object; S6: Using the projection images of N phase-shift maps, the direct components L of the scene points are... g [x,y] and indirect component L d Solve for [x,y]; The initial confidence map is constructed by calculating the average intensity of each pixel based on the projection map of the N-step phase-shifting map; S7: Calculate the stability weight W corresponding to each pixel (x, y) based on the direct component and the indirect component. s And confidence level C(x,y); The initial confidence map and the stability weight W are used. s Multiplying them together yields the corrected confidence plot; S8: Calculate the confidence threshold τ corresponding to each pixel (x,y) based on the direct components; S9: Perform binarization processing on the collected XOR code image and the projection image of the auxiliary image; The binarization method is as follows: If the brightness of a pixel (x,y) in the image is greater than its corresponding confidence threshold τ, then the pixel value of that pixel is binarized to 1; otherwise, it is binarized to 0. S10: Perform an XOR operation between the projection map of the auxiliary map and the projection map of each XOR code map X to calculate the Gray code map, denoted as: Gray code map to be confirmed; S11: The initial parity check region of the auxiliary code map PCP is divided using the wrapping phase. Regions with a wrapping phase less than 0 correspond to odd parity check regions, and regions with a wrapping phase greater than 0 correspond to even parity check regions, thus obtaining the mask mask(x,y). For each pixel (x,y) in the Gray code image to be verified, a mask (x,y) is used for verification to obtain the verification result; The verification result is compared with the projection map of the auxiliary code map PCP to generate a parity map. S12: Based on the parityMap, perform error correction on the pixels with parity conflicts in the Gray code image to be confirmed, and obtain the corrected stripe order map. S13: Wrap the phase φ(x,y), the confidence map, and the corrected fringe order map to calculate the absolute phase map, thereby realizing the subsequent three-dimensional reconstruction process.

2. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 1, characterized in that: Step S1 includes the following steps in detail: S1.1: Each Gray codeword is regarded as a parity unit, and each unit is divided into two parity regions: odd parity region and even parity region; S1.2: The odd parity area is filled with the odd parity bit of the Gray code word: when the number of 1s in the Gray code word data unit is odd, fill in 0, otherwise fill in 1; the even parity area is filled with the even parity bit: when the number of 1s in the Gray code word data unit is odd, fill in 1, otherwise fill in 0. S1.3: Map the check bit value to the grayscale value, specifying that 1 corresponds to the highest grayscale value I. max =255, 0 corresponds to the lowest grayscale value I. min =0.

3. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 1, characterized in that: In step S2, the method for generating the XOR code image X is as follows: The XOR code map X is generated by XORing the basic Gray code map and the auxiliary code map PCP. When the binary bits of the two images are the same, the binary bit of the resulting image is set to 0; when the binary bits of the two images are different, the binary bit of the resulting image is set to 1.

4. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 1, characterized in that: In step S5, the projection of the phase shift map is expressed as follows: ; In the formula, I k (x,y) represents the k-th projected fringe pattern; A(x,y) is the background light intensity; B(x,y) is the fringe modulation degree; φ(x,y) is the wrapping phase.

5. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 4, characterized in that: In step S5, the method for calculating the wrapping phase φ(x,y) is as follows: ; In the formula, I k (x,y) represents the k-th sub-projection fringe pattern.

6. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 5, characterized in that: In step S6, the direct component L g [x,y] and indirect component L d The solution method for [x,y] is as follows: ; In the formula, I k (x,y),k∈[0,3], represents the k-th sub-projection fringe pattern.

7. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 6, characterized in that: In step S7, the stability weight W s The confidence level C(x,y) is calculated as follows: ; In the formula, I k (x,y) represents the k-th sub-projected fringe pattern, and ε is the smoothing parameter.

8. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 7, characterized in that: In step S8, the confidence threshold τ is calculated as follows: ; In the formula, τ0 represents the base threshold without considering the effect of illumination.

9. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 1, characterized in that: In step S11, the parityMap calculation method is as follows: ; Wherein, the mask(x,y) is: ; oddParity(x,y) represents the odd parity code calculated at (x,y) in the Gray code diagram, and evenParity(x,y) represents the corresponding even parity code; φ(x,y) is the wrapping phase corresponding to pixel (x,y).

10. The monocular structured light 3D reconstruction method based on parity check XOR coding according to claim 9, characterized in that: Step S12 specifically includes the following steps: a1: Based on the Gray code diagram to be confirmed, the fringe order of each pixel (x,y) in the diagram is determined, and an initial fringe order diagram K is constructed. The initial fringe order diagram K is then used as a basis for correction. a2: Scan the initial stripe order map K row by row to check the conflict area, count the pixel intervals with consecutive errors in each row, and find the conflict point. ; In the formula, x start and x end R represents the start and end y-coordinates of the error verification region, respectively. y This represents the pixel region in the y-th row that contains consecutive errors; a3: When correcting each conflict region, check whether the K value changes before and after: If the K value at the front of the area changes, it indicates that the stripe order changed too early. The K value in that area should be corrected to the K value of the previous pixel. If the K value changes, it is a late jump and should be corrected to the K value of the next pixel. If there is no change before and after, it is assumed that the error in this area originates from the deviation of the auxiliary image binarization at the light and dark boundary, and the original K value is kept unchanged; ; In the formula, H represents the row height of the image, and K(x,y) and floorMap(x,y) represent the stripe order before and after correction, respectively.