Three-dimensional measurement method based on quaternary complementary Gray code auxiliary phase unwrapping
Through the phase expansion method based on the quad-complementary Gray code, the problems of low efficiency and insufficient noise resistance in three-dimensional measurements are solved, and efficient and accurate phase expansion is achieved, which improves measurement efficiency and robustness.
Patent Information
- Application Number
- CN202411408234.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-10-10
AI Technical Summary
Among the existing three-dimensional measurement methods, the phase expansion method based on binary Grey code is inefficient and has insufficient noise resistance. The application of quad-cell Grey code has difficulty in determining codewords and errors in the boundary of adjacent codewords, resulting in limited measurement efficiency and accuracy. .
Using the phase expansion method based on quaternary complementary Gray code assisted, the wrapping phase and average intensity are calculated using multi-step phase shift pattern to divide stable and unstable areas, and two The value-based mask is used to solve the codewords and perform gradual corrections to achieve phase expansion.
Improves measurement efficiency and accuracy, reduces the need for additional projection patterns, enhances noise immunity and robustness, and ensures the accuracy of phase expansion.
Smart Images

Figure SMS_1 
Figure SMS_2 
Figure SMS_3
Abstract
Description
Technical Field
[0001] The invention relates to the field of non-contact three-dimensional measurement, and in particular to a three-dimensional measurement method based on quaternary complementary Gray code auxiliary phase unfolding. Background Art
[0002] Optical 3D measurement is a very effective and highly accurate non-contact 3D detection method, and is widely used in high-precision measurement of precision instruments, computer vision, medicine and other fields.
[0003] The structured light projection method is a popular non-contact measurement method. Fringe projection profilometry (FPP) is the most representative method, which has the advantages of high precision and high flexibility. Since the inverse tangent function is used in the phase extraction process, the phase information describing the height information of the object is wrapped, so the wrapped phase needs to be phase unwrapped.
[0004] Common phase unwrapping methods can be divided into spatial phase unwrapping and temporal phase unwrapping. Temporal phase unwrapping has better noise resistance and is more suitable for complex scenes, so it is widely used. Among the temporal phase unwrapping methods, the Gray code-based method has high robustness and good noise resistance, so the accuracy of phase unwrapping is high. However, the conventional Gray code is binary, and its method requires additional projection of a large number of patterns for measurement, which affects the measurement efficiency. In fact, the measurement efficiency can be improved by improving the grayscale of the Gray code, such as using a ternary Gray code or a quaternary Gray code. The codeword determination of the quaternary Gray code is challenging and errors are more likely to occur at the boundaries of adjacent codewords. In addition, the improvement of the grayscale of the Gray code will also lead to a decrease in its noise resistance.
[0005] Therefore, it is necessary to provide a three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping to solve the above technical problems. Summary of the invention
[0006] The present invention provides a three-dimensional measurement method based on quaternary complementary Gray code assisted phase unfolding, which can greatly improve the measurement efficiency while ensuring the measurement accuracy.
[0007] The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping provided by the present invention comprises the following steps:
[0008] S1, a pre-designed multi-step phase-shifted fringe pattern and a quaternary Gray code pattern are projected by a projector and captured by a camera;
[0009] S2, using a multi-step phase shift pattern to calculate the average intensity of the wrapped phase and fringe pattern;
[0010] S3, dividing the wrapped phase into a central stable region and a truncated unstable region according to the phase value of the wrapped phase, generating binary masks of the two regions, and using the truncation point shifting technique to obtain a new wrapped phase;
[0011] S4, using the average intensity and its scaled value as different thresholds, using different threshold lines to solve the last quaternary Gray code pattern into two groups of binary code words, and solving other Gray code patterns into quaternary code words; calculating two groups of levels according to the obtained code words;
[0012] S5, using a strategy based on connected component labeling algorithm to correct the two groups of levels, and selecting the more stable parts of the two groups of wrapped phases and levels respectively through two binary masks;
[0013] S6, respectively performing phase unwrapping on the corresponding regions of the two groups of wrapped phases and orders to obtain two unwrapped phases with only half the regions;
[0014] S7, combining two unwrapped phases with only half the area to obtain a final unwrapped phase;
[0015] S8. Subtract the unwrapped phase of the reference plane from the final unwrapped phase, and then convert the phase information into height information through a phase height model.
[0016] Preferably, S1 comprises the following specific steps:
[0017] S11: Computer generates the multi-step phase shift fringe image required to obtain the phase;
[0018] S12: A computer generates a quaternary Gray code pattern required to obtain the level information;
[0019] S13: binarizing the generated multi-step phase-shifted fringes and quaternary Gray code patterns using a dithering algorithm;
[0020] S14: The projector maintains a certain degree of defocus to ensure that the projected binary multi-step phase-shifted fringe pattern presents sinusoidal properties;
[0021] S15: The camera acquires the deformed phase-shifted fringe pattern and the quaternary Gray code pattern.
[0022] Preferably, the specific steps of S2 are as follows:
[0023] S21: The deformed fringes obtained according to step S1, whose expression is:
[0024]
[0025] Where α is the camera sensitivity, r is the reflectivity of the object, (x, y) is the pixel coordinate in the camera space; a and b are the average intensity and modulation intensity of the projected fringes, respectively. Usually, when the grayscale range of the projector is [0, 255], in order to cover the entire dynamic range, it is generally set to a = b = 127.5; Φ is the phase containing the height information of the measured object; n represents the index of the phase shift, and n = 0, 1, ..., N-1, N represents the number of phase shift steps; β1 is the ambient light of the illuminating object, and β2 is the ambient light directly entering the camera; the above formula can be further simplified as a more commonly used formula:
[0026]
[0027] A(x,y)=α{r(x,y)[a+β1(x,y)]+β2(x,y)}
[0028] B(x,y)=αr(x,y)b
[0029] Where A(x,y) is the average intensity and B(x,y) is the modulation intensity;
[0030] S22: Calculate the wrapped phase using the obtained deformed fringe image. The calculation formula is:
[0031]
[0032] After the wrapped phase is obtained by using the above formula, the Gray code pattern is used to obtain the order and unwrap the wrapped phase;
[0033] S23: Calculate the average intensity using the obtained deformed fringe image. The calculation formula is:
[0034]
[0035] where I1,I2,...,I N The collected multi-step phase-shift fringe image.
[0036] Preferably, the specific steps of S3 are as follows:
[0037] S31: Divide the wrapped phase into a central stable region and a truncated unstable region according to the phase value of the wrapped phase, and generate binary masks of the two regions. The calculation formula is:
[0038]
[0039] Mask edge (x,y)=1-Mask mid (x,y)
[0040] Mask mid(x,y) and Mask edge (x,y) represents the binary mask corresponding to the central stable region and the truncated unstable region, and the subscripts 'mid' and 'edge' represent the central stable region and the truncated unstable region, respectively;
[0041] S32: Use the truncation point shift technique to obtain a new wrapping phase for the original wrapping phase. The calculation formula is:
[0042]
[0043]
[0044] Represents the new wrapped phase after the truncation point is shifted.
[0045] Preferably, the specific steps of S4 are as follows:
[0046] S41: Since quaternion is used for encoding, three threshold distributions are required for decoding; ideally, the threshold expression is:
[0047]
[0048] th m (x,y)=A(x,y)
[0049]
[0050] Among them u (x,y),th m (x,y) and th l (x, y) is the threshold distribution required for image segmentation;
[0051] However, in practice, the AB threshold strategy is not suitable for all scenarios; for example, under high-speed measurement requirements, the projected stripes are binary jitter patterns, and relative sinusoidal stripes are generated by physical defocusing; in this case, the modulation intensity B of the defocused stripes will decrease, which will cause the stripe-based AB threshold strategy to be unable to accurately segment the grayscale level of the Gray code; but we note that the average intensity A of the defocused stripes does not change, and the average intensity A of the defocused stripes is approximately equal to the modulation intensity B in the undefocused state, as shown below:
[0052] The general measurement environment is a dark room, and the influence of ambient light is small. β1 and β2 in the formula of step S21 can be ignored, so it can be obtained:
[0053]
[0054] Therefore, B in the original threshold expression can be replaced by γA; the threshold expression obtained by the A threshold strategy is:
[0055]
[0056] th m (x,y)=A(x,y)
[0057]
[0058] It is worth noting that since a and b are generally set to the same value of 127.5, γ = 1 in normal circumstances;
[0059] S42: Decompose the last quaternary Gray code into two different binary code words using different threshold lines, and decompose the remaining Gray codes into quaternary code words; the formula is as follows:
[0060]
[0061] where G′ M (x,y) and G″ M (x, y) represent two sets of binary codeword information, M represents the number of quaternary Gray code patterns, Gray M (x, y) represents the last four-element Gray code pattern; G m (x,y) represents the quaternary codeword information, Gray m represents the rest of the Gray code patterns except the last one, m represents the Gray code pattern and codeword information index, note that m<M;
[0062] S43: After obtaining the codeword information, the level can be calculated using the following formula:
[0063]
[0064] k(x,y)=f(V(x,y))
[0065]
[0066] W′(x,y)=g(V′(x,y))
[0067] k′(x,y)=Ceil(W′(x,y) / 2)
[0068] where V(x,y) and V′(x,y) represent the codewords obtained by direct calculation, f(·) and g(·) represent the reordering operation, k(x,y) and W′(x,y) represent the codewords obtained after reordering, Ceil(·) represents the rounding operation, and k(x,y) and k′(x,y) are the final levels.
[0069] Preferably, the specific steps of S5 are as follows:
[0070] S51: using a connected region marking algorithm for each of the two groups of levels, and correcting the connected domain with an area of 1 pixel by using a neighborhood determination method;
[0071] S52: Select the relatively stable parts of the two groups of wrapped phases and orders respectively through two binary masks. The calculation formula is:
[0072]
[0073] k mid (x,y)=Mask mid (x,y)·k(x,y)
[0074] k′ mid (x,y)=Mask edge (x,y)·k′(x,y)
[0075] The subscripts 'mid' and 'edge' represent the regions corresponding to the current wrapped phase and order, and all values outside the corresponding regions are set to 0.
[0076] Preferably, the specific steps of S6 are as follows:
[0077] S6: Phase unwrapping is performed on the corresponding regions of the two groups of wrapped phases and orders respectively to obtain two unwrapped phases with only half the region. The calculation formula is:
[0078]
[0079] Notice The directly calculated wrapped phase should be increased by an additional π. In this case, the subscripts 'mid' and 'edge' of the two half-area unwrapped phases are relative to Speaking of.
[0080] Preferably, the specific steps of S7 are as follows:
[0081] S7: Combine the two unwrapped phases with only half the area to get the final unwrapped phase. The calculation formula is:
[0082] Φ(x,y)=Φ mid (x,y)∪Φ edge (x,y)
[0083] Preferably, the specific steps of S8 are as follows:
[0084] S81, subtract the unwrapped phase of the reference plane from the final unwrapped phase, and the calculation formula is:
[0085] ΔΦ(x,y)=Φ(x,y)-Φ r (x,y)
[0086] where Φ r (x,y) and ΔΦ(x,y) represent the unwrapped phase of the reference plane and the unwrapped phase containing only the object height information, respectively;
[0087] S82. The phase information is converted into height information through a phase height model. The calculation formula is:
[0088] ΔΦ 2 =ahΔΦ 2 +bhΔΦ+ch
[0089] For the convenience of representation, (x, y) will be omitted; where h represents the height of the object to be measured, and a, b, and c are system parameters obtained during the calibration process.
[0090] Compared with the related art, the three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping provided by the present invention has the following beneficial effects:
[0091] The present invention provides a three-dimensional measurement method based on quaternary complementary Gray code-assisted phase unfolding, which projects a multi-step phase-shifted fringe image and a quaternary Gray code pattern. Taking advantage of the large information capacity of the quaternary Gray code, the last quaternary Gray code pattern is resolved into two binary Gray code patterns, one for calculating the order and the other for introducing the complementary strategy. Complementary measurement is introduced without the need for additional projection patterns, which improves the measurement efficiency while ensuring the accuracy of phase unfolding. At the same time, an isolated order correction strategy based on a connected region marking algorithm is introduced to deal with the order errors that may occur due to the decrease in the anti-noise performance of the Gray code due to the increase in the grayscale level of the Gray code. This method has the advantages of high measurement efficiency, good robustness, and high accuracy of measurement results. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] Figure 1 It is a measurement flow chart of the method of the present invention;
[0093] Figure 2 It is a schematic diagram of the structural framework of the method of the present invention;
[0094] Figure 3 This is the process of decomposing the last quaternary Gray code into two binary Gray codes. The figure takes three quaternary Gray code patterns as an example. In the figure, (a) is the grayscale image of the grayscale code sequence, and (b) is the cross section of the grayscale image. i is defined as a quaternary Gray code pattern, i = 1, 2, 3. Gray3′ and Gray3″ are two binary Gray codes calculated from the last quaternary Gray code;
[0095] Figure 4The process of solving the level of the proposed quaternary complementary Gray code is shown in the figure. i , G i ′(G i ″), V(V′), and k(W′) are defined as quaternary Gray code words, binary code words solved from quaternary Gray code words, code words directly calculated, and code words obtained by reordering operations, respectively. k and k′ are two groups of levels finally calculated. k′ needs to round up after W′ is divided by 2. In the figure, quaternary and binary Gray code words are represented in grayscale form. Quaternary Gray code black, dark gray, light gray, and white represent quaternary code words 0, 1, 2, and 3, respectively, and binary Gray code black and white represent binary code words 0 and 1, respectively.
[0096] Figure 5 This is the principle diagram of the isolated connected region level correction strategy, where (a) represents the level correction process. In the figure, Q represents an isolated region of level n, which occupies an area of one pixel. The region can be identified by the connected region marking algorithm, and the level in the region is set to m through the field determination strategy represented by (b), thereby achieving the correction of the isolated region level. Different capital letters in (b) represent different levels. The red background block represents the identified isolated region, the orange background block is the neighborhood of the isolated region, and the green background block indicates that the isolated region has been corrected. If and only if the isolated region is surrounded by the same level, the isolated region is corrected, otherwise the point is abandoned;
[0097] Figure 6 Schematic diagram of the final phase unwrapping process. and The definition of is two different sets of wrapped phases, the difference between the two is the different positions of the cutoff points. The background color represents two complementary binary masks Mask mid and Mask edge , indicating the correspondence between the two groups of wrapped phases and orders in different regions. After completing the phase unwrapping, the corresponding regions are selected and combined to obtain the final unwrapped phase Φ;
[0098] Figure 7 Comparison between the isolated region order correction strategy and the median filter method. (a) is the object to be measured; (b) is the Gray code after adding noise; (c) is the comparison of grayscale changes before and after adding noise at the red dotted line in (b); (d) is the reconstruction result of the proposed quaternary complementary Gray code method without applying the order correction strategy when there is a large noise in the simulated measurement scene; (e) to (h) are the measurement results of the median filter method and the proposed order correction strategy with a window size of 3×3, 5×5 and 7×7 respectively; (i) and (l) provide detailed enlarged images of the red border marked area in (a) under the above method;
[0099] Figure 8 Comparison of measurement results of different methods. (a) is the object to be measured, (b) is the reconstruction result of the binary complementary Gray code method, which is used as the reference truth value; the remaining figures (c) to (f) are the reconstruction results (left) and error diagrams (right) of the conventional binary Gray code method and the proposed quaternary complementary Gray code method. The upper part of the reconstruction result diagram shows the number of phase shift fringes (PS) and Gray code patterns (GC) required to be projected by the corresponding method, and the upper part of the error diagram shows the error rate of the order obtained by this method. DETAILED DESCRIPTION
[0100] The present invention will be further described below in conjunction with the accompanying drawings and implementation modes.
[0101] First embodiment
[0102] The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping in this embodiment has a measurement flow chart as shown in FIG. Figure 1 As shown, the method comprises the following steps:
[0103] The following steps are involved:
[0104] Step a, generating a multi-step phase-shifted fringe pattern and a quaternary Gray code pattern by a computer, projecting by a projector and capturing by a camera;
[0105] Step b, calculating the package phase and average intensity;
[0106] Step c, dividing the region by wrapping the phase and generating a binary mask, and obtaining a new wrapping phase by using a truncation point shifting technique;
[0107] Step d, using the average intensity and the scaling value as thresholds to decode the word and calculate the level;
[0108] Step e, correcting the two groups of levels, and selecting the stable regions in the wrapped phase and the levels respectively through a binary mask;
[0109] Step f, phase unwrapping the corresponding regions of the two groups of wrapped phases and orders respectively;
[0110] Step g, merging two unwrapped phases with only half the area to obtain a final unwrapped phase;
[0111] Step h: subtract the unfolded phase of the reference plane from the final unfolded phase, and convert the phase information into height information through a phase height model, thereby achieving three-dimensional reconstruction.
[0112] Second embodiment
[0113] This embodiment is a schematic diagram of the structural framework of the specific embodiment 1, and shows the intermediate process, such as Figure 2 shown.
[0114] Third embodiment
[0115] The specific steps of step a are as follows:
[0116] Step a1: Encode N sinusoidal fringe patterns as a projection image group;
[0117] The phase shift fringe encoding formula is:
[0118]
[0119] Where N is the number of phase shift steps, n = 1, 2, ..., N is the phase shift sequence number, f0 is the set fringe frequency, and a and b are generally set to 127.5;
[0120] Step a2: Encode the required quaternary Gray code;
[0121] Step a3: binarizing the generated multi-step phase-shifted fringes and quaternary Gray code patterns using a dithering algorithm;
[0122] Step a4: The projector maintains a certain degree of defocus to ensure that the projected binary multi-step phase-shifted fringe pattern presents sinusoidal properties;
[0123] Step a5: The projector maintains a certain degree of defocus to ensure that the projected binary multi-step phase-shifted fringe pattern presents sinusoidal properties;
[0124] Step a6: The camera collects the deformed phase-shifted fringe pattern and the quaternary Gray code pattern.
[0125] The specific steps of step b are as follows:
[0126] Step b1: The deformed fringes obtained in step a are expressed as:
[0127]
[0128] Where α is the camera sensitivity, r is the reflectivity of the object, (x, y) is the pixel coordinate in the camera space; a and b are the average intensity and modulation intensity of the projected fringes, respectively; Φ is the phase containing the height information of the measured object; n represents the index of the phase shift, and n = 0, 1, ..., N-1, N represents the number of phase shift steps; β1 is the ambient light illuminating the object, and β2 is the ambient light directly entering the camera; the above formula can be further simplified as a more commonly used formula:
[0129]
[0130] A(x,y)=α{r(x,y)[a+β1(x,y)]+β2(x,y)}
[0131] B(x,y)=αr(x,y)b
[0132] Where A(x,y) is the average intensity and B(x,y) is the modulation intensity;
[0133] Step b2: Use the obtained deformed fringe image to calculate the wrapped phase. The calculation formula is:
[0134]
[0135] After the wrapped phase is obtained by using the above formula, the Gray code pattern is used to obtain the order and unwrap the wrapped phase;
[0136] Step b3: Calculate the average intensity using the obtained deformed fringe image. The calculation formula is:
[0137]
[0138] where I1,I2,...,I N The collected multi-step phase-shift fringe image.
[0139] Fourth embodiment
[0140] This embodiment is for obtaining a binary mask and a new wrapped phase. Based on the above specific embodiment, the specific steps of step c are further defined as follows:
[0141] Step c1: Divide the wrapped phase into a central stable region and a truncated unstable region according to the phase value of the wrapped phase, and generate binary masks of the two regions. The calculation formula is:
[0142]
[0143] Mask edge (x,y)=1-Mask mid (x,y)
[0144] Mask mid (x,y) and Mask edge (x,y) represents the binary mask corresponding to the central stable region and the truncated unstable region, and the subscripts 'mid' and 'edge' represent the central stable region and the truncated unstable region, respectively;
[0145] Step c2: Use the truncation point shift technique to obtain a new wrapping phase for the original wrapping phase. The calculation formula is:
[0146]
[0147]
[0148] Represents the new wrapped phase after the truncation point is shifted.
[0149] Fifth embodiment
[0150] This embodiment sets a threshold to find a decoding word and thus calculate the level. On the basis of the above embodiment, the specific steps of step d are further defined as follows:
[0151] Step d1: Since quaternion is used for encoding, three threshold distributions are required for decoding; ideally, the threshold expression is:
[0152]
[0153] th m (x,y)=A(x,y)
[0154]
[0155] Among them u (x,y),th m (x,y) and th l (x, y) is the threshold distribution required for image segmentation;
[0156] However, in practice, the AB threshold strategy is not suitable for all scenarios; for example, under high-speed measurement requirements, the projected stripes are binary jitter patterns, and relative sinusoidal stripes are generated by physical defocusing; in this case, the modulation intensity B of the defocused stripes will decrease, which will cause the stripe-based AB threshold strategy to be unable to accurately segment the grayscale level of the Gray code; but we note that the average intensity A of the defocused stripes does not change, and the average intensity A of the defocused stripes is approximately equal to the modulation intensity B in the undefocused state, as shown below:
[0157] The general measurement environment is a dark room, and the influence of ambient light is small. β1 and β2 in the formula of step S21 can be ignored, so it can be obtained:
[0158]
[0159] Therefore, B in the original threshold expression can be replaced by γA; the threshold expression obtained by the A threshold strategy is:
[0160]
[0161] th m (x,y)=A(x,y)
[0162]
[0163] It is worth noting that since a and b are generally set to the same value of 127.5, γ = 1 in normal circumstances;
[0164] Step d2: Figure 3 As shown, the last quaternary Gray code is decomposed into two different binary code words using different threshold lines, and the remaining Gray codes are decomposed into quaternary code words. The formula is as follows:
[0165]
[0166] where G′ M (x,y) and G″ M (x, y) represent two sets of binary codeword information, M represents the number of quaternary Gray code patterns, Gray M (x, y) represents the last four-element Gray code pattern, G m (x,y) represents the quaternary codeword information, Gray m represents the rest of the Gray code patterns except the last one, m represents the Gray code pattern and codeword information index, note that m<M;
[0167] Step d3: After obtaining the codeword information, the level can be calculated using the following formula:
[0168]
[0169] k(x,y)=f(V(x,y))
[0170]
[0171] W′(x,y)=g(V′(x,y))
[0172] k′(x,y)=Ceil(W′(x,y) / 2)
[0173] where V(x,y) and V′(x,y) represent the codewords obtained by direct calculation, f(·) and g(·) represent the reordering operation, k(x,y) and W′(x,y) represent the codewords obtained after reordering, Ceil(·) represents the rounding operation, and k(x,y) and k′(x,y) are the final levels;
[0174] The corresponding relationship between the above codewords and the level information is as follows: Figure 4 shown.
[0175] Sixth embodiment:
[0176] This embodiment is for error level correction. Based on the above specific embodiment, the specific steps of step e are further defined as follows:
[0177] Step e1: Use the connected component labeling algorithm for each of the two groups of levels. The algorithm principle is as follows: Figure 5; and the connected domain with an area of 1 pixel is corrected by neighborhood judgment. The domain judgment rules are as follows: Figure 5 (b) If and only if the upper, lower, left, and right sides of the isolated region are all at the same level, the isolated region is set to that level;
[0178] Step e2: Select the relatively stable parts of the two groups of wrapped phases and orders respectively through two binary masks. The calculation formula is:
[0179]
[0180] k mid (x,y)=Mask mid (x,y)·k(x,y)
[0181] k′ mid (x,y)=Mask edge (x,y)·k′(x,y)
[0182] The subscripts 'mid' and 'edge' respectively represent the wrapped phase and order of the corresponding region, and all values outside the corresponding region are set to 0.
[0183] Seventh embodiment:
[0184] This embodiment is for obtaining the unwrapped phases corresponding to different regions. Based on the above specific embodiment, the specific steps of step f are further defined as follows:
[0185] Step f1: Phase unwrapping is performed on the corresponding regions of the two groups of wrapped phases and orders respectively to obtain two unwrapped phases with only half the region. The calculation formula is:
[0186]
[0187] Notice The directly calculated wrapped phase should be increased by an additional π. In this case, the subscripts 'mid' and 'edge' of the two half-area unwrapped phases are relative to Speaking of.
[0188] Eighth embodiment:
[0189] This embodiment is for obtaining the final unwrapped phase. Based on the above specific embodiment, the specific steps of step g are further defined as follows:
[0190] h: such as Figure 6 As shown, the two unwrapped phases with only half the area are combined to obtain the final unwrapped phase, and the calculation formula is:
[0191] Φ(x,y)=Φ mid (x,y)∪Φ edge(x,y).
[0192] Ninth embodiment: This embodiment is for obtaining the height information of the object to be measured. Based on the above specific embodiments, the specific steps of step h are further defined as follows:
[0193] h1. Subtract the unwrapped phase of the reference plane from the final unwrapped phase. The calculation formula is:
[0194] ΔΦ(x,y)=Φ(x,y)-Φ r (x,y)
[0195] where Φ r (x,y) and ΔΦ(x,y) represent the unwrapped phase of the reference plane and the unwrapped phase containing only the object height information, respectively;
[0196] h2. The phase information is converted into height information through the phase height model. The calculation formula is:
[0197] ΔΦ 2 =ahΔΦ 2 +bhΔΦ+ch
[0198] For the convenience of representation, (x, y) will be omitted; where h represents the height of the object to be measured, and a, b, and c are system parameters obtained during the calibration process.
[0199] Tenth embodiment:
[0200] This example verifies the proposed isolated region level correction strategy and compares it with the conventional median filtering strategy. Figure 7 As shown. In addition, in order to show the difference between the two methods more clearly, Gaussian noise is added to the collected quaternary Gray code. The Gaussian noise is generated by pre-generating a standard Gaussian noise with a mean of 0 and a variance of 1, then normalizing it to [0,1], and then multiplying it by a coefficient to control its amplitude. The multiplication coefficient in this experiment is 20. The results show that the median filter with 3×3 and 5×5 windows cannot completely eliminate the spikes caused by the order error. Although both the 7×7 median filter and the proposed method can eliminate the spikes, Figure 7 As can be seen from the detailed images shown in (k) and (l), the 7×7 median filter leads to smooth texture of the wing surface and loss of surface details. In addition, since the median filter method involves selecting an appropriate filter window size, it is challenging to optimize this selection in actual measurements. Therefore, the proposed isolated region order correction strategy is effective and easy to use.
[0201] Eleventh embodiment:
[0202] This embodiment makes a comprehensive comparison between the proposed quaternary complementary Gray code method and the currently more advanced methods, such as Figure 8 As shown. In order to make the comparison more fair, the wrapped phase used for phase unwrapping by all methods is the same, and four-step phase shift is adopted. Since the wrapped phase is the same, only the accuracy of the order under different methods is compared, and the binary complementary Gray code method is used as the reference truth value. The results show the three-dimensional profiles calculated by different methods, as well as the order error rate and error position. It can be seen that the reconstruction results of the conventional binary Gray code method (5 coding patterns) have obvious periodic strip errors, while the binary complementary Gray code method (6 coding patterns) and the proposed quaternary complementary Gray code method (3 coding patterns) can obtain relatively good measurement results. In addition, the proposed method has fewer projection patterns than the other two methods, and thus has higher measurement efficiency.
[0203] Compared with the related art, the three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping provided by the present invention has the following beneficial effects:
[0204] The present invention provides a three-dimensional measurement method based on quaternary complementary Gray code-assisted phase unfolding, which projects a multi-step phase-shifted fringe image and a quaternary Gray code pattern. Taking advantage of the large information capacity of the quaternary Gray code, the last quaternary Gray code pattern is resolved into two binary Gray code patterns, one for calculating the order and the other for introducing the complementary strategy. Complementary measurement is introduced without the need for additional projection patterns, which improves the measurement efficiency while ensuring the accuracy of phase unfolding. At the same time, an isolated order correction strategy based on a connected region marking algorithm is introduced to deal with the order errors that may occur due to the decrease in the anti-noise performance of the Gray code due to the increase in the grayscale level of the Gray code. This method has the advantages of high measurement efficiency, good robustness, and high accuracy of measurement results.
[0205] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping, characterized in that: The following steps are involved: S1, a pre-designed multi-step phase-shifted fringe pattern and a quaternary Gray code pattern are projected by a projector and captured by a camera; S2, using a multi-step phase shift pattern to calculate the average intensity of the wrapped phase and fringe pattern; S3, dividing the wrapped phase into a central stable region and a truncated unstable region according to the phase value of the wrapped phase, generating binary masks of the two regions, and using the truncation point shifting technique to obtain a new wrapped phase; S4, using the average intensity and its scaled value as different thresholds, using different threshold lines to solve the last quaternary Gray code pattern into two groups of binary code words, and solving other Gray code patterns into quaternary code words; calculating two groups of levels according to the obtained code words; S5, using a strategy based on connected component labeling algorithm to correct the two groups of levels, and selecting the more stable parts of the two groups of wrapped phases and levels respectively through two binary masks; S6, respectively performing phase unwrapping on the corresponding regions of the two groups of wrapped phases and orders to obtain two unwrapped phases with only half the regions; S7, combining two unwrapped phases with only half the area to obtain a final unwrapped phase; S8. Subtract the unwrapped phase of the reference plane from the final unwrapped phase, and then convert the phase information into height information through a phase height model.
2. The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping according to claim 1 is characterized in that: The S1 comprises the following specific steps: S11: Computer generates the multi-step phase shift fringe image required to obtain the phase; S12: A computer generates a quaternary Gray code pattern required to obtain the level information; S13: binarizing the generated multi-step phase-shifted fringes and quaternary Gray code patterns using a dithering algorithm; S14: The projector maintains a certain degree of defocus to ensure that the projected binary multi-step phase-shifted fringe pattern presents sinusoidal properties; S15: The camera acquires the deformed phase-shifted fringe pattern and the quaternary Gray code pattern.
3. The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping according to claim 1 is characterized in that: The specific steps of S2 are as follows: S21: The deformed fringes obtained according to step S1, whose expression is: Where α is the camera sensitivity, r is the reflectivity of the object, and (x, y) is the pixel coordinate in the camera space. a and b are the average intensity and modulation intensity of the projected fringes, respectively. Normally, when the grayscale range of the projector is [0, 255], in order to cover the entire dynamic range, it is generally set to a = b = 127.
5. Φ is the phase that contains the height information of the object being measured. n represents the index of the phase shift, and n = 0, 1, ..., N-1, N represents the number of phase shift steps. β1 is the ambient light that illuminates the object, and β2 is the ambient light that directly enters the camera. The above formula can be further simplified into a more commonly used formula: A(x,y)=α{r(x,y)[a+β1(x,y)]+β2(x,y)} B(x,y)=αr(x,y)b Where A(x,y) is the average intensity and B(x,y) is the modulation intensity; S22: Calculate the wrapped phase using the obtained deformed fringe image. The calculation formula is: After the wrapped phase is obtained by using the above formula, the Gray code pattern is used to obtain the order and unwrap the wrapped phase; S23: Calculate the average intensity using the obtained deformed fringe image. The calculation formula is: where I1,I2,...,I N The collected multi-step phase-shift fringe image.
4. The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping according to claim 1, characterized in that: The specific steps of S3 are as follows: S31: Divide the wrapped phase into a central stable region and a truncated unstable region according to the phase value of the wrapped phase, and generate binary masks of the two regions. The calculation formula is: Mask edge (x,y)=1-Mask mid (x,y) Mask mid (x,y) and Mask edge (x,y) represents the binary mask corresponding to the central stable region and the truncated unstable region, and the subscripts 'mid' and 'edge' represent the central stable region and the truncated unstable region, respectively; S32: Use the truncation point shift technique to obtain a new wrapping phase for the original wrapping phase. The calculation formula is: Represents the new wrapped phase after the truncation point is shifted.
5. The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping according to claim 1, characterized in that: The specific steps of S4 are as follows: S41: Since quaternion is used for encoding, three threshold distributions are required for decoding; ideally, the threshold expression is: th m (x,y)=A(x,y) Among them u (x,y),th m (x,y) and th l (x, y) is the threshold distribution required for image segmentation; However, in practice, the AB threshold strategy is not suitable for all scenarios; for example, under high-speed measurement requirements, the projected stripes are binary jitter patterns, and relative sinusoidal stripes are generated by physical defocusing; in this case, the modulation intensity B of the defocused stripes will decrease, which will cause the stripe-based AB threshold strategy to be unable to accurately segment the grayscale level of the Gray code; but we note that the average intensity A of the defocused stripes does not change, and the average intensity A of the defocused stripes is approximately equal to the modulation intensity B in the undefocused state, as shown below: The general measurement environment is a dark room, and the influence of ambient light is small. β1 and β2 in the formula of step S21 can be ignored, so it can be obtained: Therefore, B in the original threshold expression can be replaced by γA; the threshold expression obtained by the A threshold strategy is: th m (x,y)=A(x,y) It is worth noting that since a and b are generally set to the same value of 127.5, γ = 1 in normal circumstances; S42: Decompose the last quaternary Gray code into two different binary code words using different threshold lines, and decompose the remaining Gray codes into quaternary code words; the formula is as follows: where G′ M (x,y) and G″ M (x, y) represent two sets of binary codeword information, M represents the number of quaternary Gray code patterns, Gray M (x, y) represents the last four-element Gray code pattern; G m (x,y) represents the quaternary codeword information, Gray m represents the rest of the Gray code patterns except the last one, m represents the Gray code pattern and codeword information index, note that m<M; S43: After obtaining the codeword information, the level can be calculated using the following formula: k(x,y)=f(V(x,y)) W′(x,y)=g(V′(x,y)) k′(x,y)=Ceil(W′(x,y) / 2) where V(x,y) and V′(x,y) represent the codewords obtained by direct calculation, f(·) and g(·) represent the reordering operation, k(x,y) and W′(x,y) represent the codewords obtained after reordering, Ceil(·) represents the rounding operation, and k(x,y) and k′(x,y) are the final levels.
6. The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping according to claim 1, characterized in that: The specific steps of S5 are as follows: S51: using a connected region labeling algorithm for each of the two groups of levels, and correcting a connected region with an area of 1 pixel by means of domain determination; S52: Select the relatively stable parts of the two groups of wrapped phases and orders respectively through two binary masks. The calculation formula is: k mid (x,y)=Mask mid (x,y)·k(x,y) k′ mid (x,y)=Mask edge (x,y)·k′(x,y) The subscripts 'mid' and 'edge' represent the regions corresponding to the current wrapped phase and order, and all values outside the corresponding regions are set to 0.
7. The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping according to claim 1, characterized in that: The specific steps of S6 are as follows: S6: Phase unwrapping is performed on the corresponding regions of the two groups of wrapped phases and orders respectively to obtain two unwrapped phases with only half the region. The calculation formula is: Notice The directly calculated wrapped phase should be increased by an additional π. In this case, the subscripts 'mid' and 'edge' of the two half-area unwrapped phases are relative to Speaking of.
8. The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping according to claim 1, characterized in that: The specific steps of S7 are as follows: S7: Combine the two unwrapped phases with only half the area to get the final unwrapped phase. The calculation formula is: Φ(x,y)=Φ mid (x,y)∪Φ edge (x,y)。 9. The three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping according to claim 1, characterized in that: The specific steps of S8 are as follows: S81, subtract the unwrapped phase of the reference plane from the final unwrapped phase, and the calculation formula is: ΔΦ(x,y)=Φ(x,y)-Φ r (x,y) where Φ r (x,y) and ΔΦ(x,y) represent the unwrapped phase of the reference plane and the unwrapped phase containing only the object height information, respectively; S82. The phase information is converted into height information through a phase height model. The calculation formula is: DF 2 =ahΔΦ 2 +bhΔΦ+ch For the convenience of representation, (x, y) will be omitted; where h represents the height of the object to be measured, and a, b, and c are system parameters obtained during the calibration process.
Citation Information
Patent Citations
Fringe projection method, fringe projection device, and computer program product
CN107810384A
Three-dimensional shape measurement method based on cyclic complementary Gray code
CN109540039A
Three-dimensional measurement technical method based on four-eye structured light
CN116164667A
Three-dimensional measurement method based on ternary complementary Gray code phase unwrapping
CN116734762A
Quaternary Gray code three-dimensional imaging method and device, electronic equipment and storage medium
CN118729990A
Cited By
Three-dimensional measurement method and system for fusion of linear polarization degree image and gray level image
CN120495101A
Underwater high-speed three-dimensional measurement method based on stripe structured light
CN120760636A
Underwater high-speed three-dimensional measurement method based on stripe structured light
CN120760636B