A three-dimensional measurement method based on quaternary complementary gray code auxiliary phase unwrapping
By using the quaternary complementary Gray code-assisted phase expansion method, the problems of low measurement efficiency and reduced noise resistance in existing technologies are solved, and efficient and accurate three-dimensional measurement is achieved.
Patent Information
- Application Number
- CN202411408234.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-10-10
AI Technical Summary
Existing Gray code-based 3D measurement methods suffer from low measurement efficiency and reduced noise resistance when increasing grayscale levels, making it difficult to maintain high accuracy in complex scenarios.
A quaternary complementary Gray code-assisted phase expansion method is adopted. By projecting multi-step phase shift fringe patterns and quaternary Gray code patterns, combined with connected component labeling algorithm and truncation point translation technique, the quaternary Gray code is decomposed into two sets of binary codewords. The complementary strategy is then used for phase expansion to correct order errors.
It improves measurement efficiency, maintains high precision and robustness, reduces order errors, and enhances the accuracy of measurement results.
Smart Images

Figure CN119309509B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of non-contact three-dimensional measurement, and in particular to a three-dimensional measurement method based on four-element complementary Gray code auxiliary phase unwrapping. BACKGROUND
[0002] Optical three-dimensional measurement is a very effective and high-precision non-contact three-dimensional detection method, which has a very wide application in the fields of high-precision measurement of precision instruments, computer vision and medicine.
[0003] And the structured light projection method is a popular non-contact measurement method at present. The fringe projection profilometry (FPP) is one of the most representative methods, which has the advantages of high precision and high flexibility. Since the arctangent function is used in the process of phase extraction, the phase information describing the height information of the object is wrapped, so it is necessary to unwrap the wrapped phase.
[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. In the temporal phase unwrapping method, 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 needs to project a large number of patterns for measurement, which affects the measurement efficiency. In fact, the measurement efficiency can be improved by increasing the gray scale of the Gray code, such as using ternary Gray code or quaternary Gray code. The code word determination of quaternary Gray code has challenges, and the boundary of adjacent code words is more prone to errors. In addition, the increase of the gray scale 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 four-element complementary Gray code auxiliary phase unwrapping to solve the above technical problems. SUMMARY
[0006] The present application provides a three-dimensional measurement method based on four-element complementary Gray code auxiliary phase unwrapping, which can greatly improve the measurement efficiency while ensuring the measurement accuracy.
[0007] The three-dimensional measurement method based on four-element complementary Gray code auxiliary phase unwrapping provided by the present application comprises the following steps:
[0008] S1, projecting a pre-designed multi-step phase shift fringe pattern and a quaternary Gray code pattern by a projector and capturing them by a camera;
[0009] S2, calculating the wrapped phase and the average intensity of the fringe pattern using the multi-step phase shift pattern;
[0010] S3, dividing the wrapped phase into a center stable region and a truncated unstable region according to the phase value of the wrapped phase, and generating binary masks of the two regions, and using a truncation point translation technique to obtain a new wrapped phase;
[0011] S4, using the average intensity and its scaling value as different thresholds, using different threshold lines to calculate the last four-quadrant Gray code pattern into two groups of binary code words, and other Gray code patterns into four-quadrant code words; calculating two groups of orders according to the obtained code words;
[0012] S5, using a strategy based on a connected region marking algorithm to correct the two groups of orders, and selecting the more stable parts of the two groups of wrapped phases and orders through the two binary masks, respectively;
[0013] S6, respectively unwrapping the corresponding regions of the two groups of wrapped phases and orders to obtain two unwrapped phases with only half the region;
[0014] S7, combining the two unwrapped phases with only half the region to obtain the final unwrapped phase;
[0015] S8, subtracting the unwrapped phase of the reference plane from the final unwrapped phase, and then converting the phase information into height information through a phase-height model.
[0016] Preferably, the S1 comprises the following specific steps:
[0017] S11: generating a multi-step phase shift fringe image required to obtain the phase by computer;
[0018] S12: generating a four-quadrant Gray code pattern required to obtain order information by computer;
[0019] S13: using a dithering algorithm to binarize the generated multi-step phase shift fringe and four-quadrant Gray code pattern;
[0020] S14: the projector maintains a certain degree of defocus to ensure that the projected binarized multi-step phase shift fringe pattern presents sinusoidal;
[0021] S15: the camera collects the deformed phase shift fringe pattern and the four-quadrant Gray code pattern.
[0022] Preferably, the specific steps of the S2 are as follows:
[0023] S21: according to the deformed fringe obtained in step S1, the expression is:
[0024]
[0025] where, a 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 fringe respectively, generally, when the gray scale range of the projector is [0, 255], in order to cover the entire dynamic range, a = b = 127.5 is generally set; Phi 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; beta1 is the ambient light of the illuminated object, beta2 is the ambient light directly entering the camera; the above formula can be further simplified as the more commonly used formula:
[0026]
[0027] A(x, y) = a{r(x, y)[a + beta1(x, y)] + beta2(x, y)}
[0028] B(x, y) = a r(x, y) b
[0029] where A(x, y) is the average intensity, B(x, y) is the modulation intensity;
[0030] S22: Calculate the wrapped phase using the obtained deformed fringe image, and the calculation formula is:
[0031]
[0032] After obtaining the wrapped phase using the above formula, the order is obtained using the Gray code pattern, and the wrapped phase is unwrapped;
[0033] S23: Calculate the average intensity using the obtained deformed fringe image, and the calculation formula is:
[0034]
[0035] where I1, I2,..., I N are the collected multi-step phase shift fringe images.
[0036] Preferably, the specific steps of S3 are as follows:
[0037] S31: According to the phase value of the wrapped phase, the wrapped phase is divided into a central stable region and a truncated unstable region, and a binary mask of the two regions is generated, and the calculation formula is:
[0038]
[0039] Mask edge (x, y) = 1 - Mask mid (x, y)
[0040] where Mask mid(x, y) and Mask edge (x, y) represents the binary mask corresponding to the center stable region and the truncated unstable region, and the subscripts'mid' and 'edge' represent the center stable region and the truncated unstable region, respectively;
[0041] S32: A new wrapped phase is obtained by using the cut-off point translation technique on the original wrapped phase, and the calculation formula is:
[0042]
[0043]
[0044] represents the new wrapped phase after cut-off point translation.
[0045] Preferably, the specific steps of S4 are as follows:
[0046] S41: Since four elements are used for encoding, three threshold distributions are needed for decoding; in an ideal case, the expression of the threshold is:
[0047]
[0048] th m (x, y) = A(x, y)
[0049]
[0050] where th u (x, y), th m (x, y) and th l (x, y) are the threshold distributions required for image segmentation;
[0051] However, in practice, the AB threshold strategy is not suitable for all scenarios; for example, in high-speed measurement requirements, the projected fringe is a binary dithering pattern, and the relative sinusoidal fringe is generated by physical defocusing; in this case, the modulation intensity B of the defocused fringe will be reduced, which will cause the AB threshold strategy based on the fringe to be unable to accurately segment the gray levels of the Gray code; however, we notice that the average intensity A of the defocused fringe does not change, and the average intensity A of the defocused fringe is approximately equal to the modulation intensity B in the non-defocused state, which is proved as follows:
[0052] Generally, the environment for measurement is a dark room, and the influence of ambient light is small, so β1 and β2 in the formula of step S21 can be ignored, and thus the following 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 127.5, γ = 1 in general cases;
[0059] S42: The last quaternary Gray code is decomposed into two groups of different binary code words using different threshold lines, and the remaining Gray codes are decomposed into quaternary code words; the formula is as follows:
[0060]
[0061] where G′ M (x,y) and G″ M (x,y) represent two groups of binary code word information, M represents the number of quaternary Gray code patterns, Gray M (x,y) represents the last quaternary Gray code pattern; G m (x,y) represents quaternary code word information, Gray m represents the remaining Gray code patterns except the last Gray code pattern, and m represents the Gray code pattern and code word information index, and it is noted that m < M;
[0062] S43: After obtaining the code word information, the order can be calculated, and the calculation formula is:
[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 code words directly calculated, f(·) and g(·) represent the reordering operations, k(x,y) and W′(x,y) represent the code words obtained after reordering, Ceil(·) represents the rounding up operation, and k(x,y) and k′(x,y) are the final orders.
[0069] Preferably, the specific steps of S5 are as follows:
[0070] S51: Use the connected region marking algorithm for each level of the two groups respectively, and correct the connected region with an area size of 1 pixel point size by using the neighborhood judgment method;
[0071] S52: Select the more stable part of the two groups of wrapped phases and levels by using two binary masks respectively, and 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] Wherein, the subscripts'mid' and 'edge' represent the area corresponding to the current wrapped phase and level, and the values outside the corresponding area are set to 0.
[0076] Preferably, the specific steps of S6 are as follows:
[0077] S6: Expand the corresponding area of the two groups of wrapped phases and levels respectively to obtain two expanded phases with only half area, and the calculation formula is:
[0078]
[0079] Note The directly calculated wrapped phase should be additionally increased by π, and at this time, the subscripts'mid' and 'edge' of the two expanded phases with only half area are relative to .
[0080] Preferably, the specific steps of S7 are as follows:
[0081] S7: Combine the two expanded phases with only half area to obtain the final expanded phase, and 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 expanded phase of the reference plane from the final expanded phase, and the calculation formula is:
[0085] Delta Phi (x, y) = Phi (x, y) - Phi r (x, y)
[0086] Wherein Phi r (x, y) and Delta Phi (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 by the phase height model, and the calculation formula is:
[0088] Delta Phi 2 = ahDelta Phi 2 +bhDelta Phi+ch
[0089] For convenience of representation, (x, y) will be omitted;Wherein h represents the height of the object to be measured, a, b and c are system parameters, which are obtained in the calibration process.
[0090] Compared with the related art, the three-dimensional measurement method based on four-element complementary Gray code auxiliary phase unwrapping provided by the application has the following beneficial effects:
[0091] The application provides a three-dimensional measurement method based on four-element complementary Gray code auxiliary phase unwrapping, which projects a plurality of step phase fringe images and four-element Gray code patterns. By taking advantage of the large information capacity of the four-element Gray code, the last four-element Gray code pattern is calculated into two binary Gray code patterns, one of which is used to calculate the order, and the other is used to introduce the complementary strategy. Without additional projection patterns, the complementary measurement is introduced, which improves the measurement efficiency and ensures the accuracy of the phase unwrapping. At the same time, an isolated order correction strategy based on the connected region labeling algorithm is introduced to deal with the order error that may occur due to the decrease of the noise resistance performance of the Gray code caused by the increase of the Gray level. The method has the advantages of high measurement efficiency, good robustness and high measurement result precision. BRIEF DESCRIPTION OF DRAWINGS
[0092] Figure 1 The measurement flowchart of the method of the application is shown in the figure;
[0093] Figure 2 The structural framework schematic diagram of the method of the application is shown in the figure;
[0094] Figure 3 The process of calculating the last four-element Gray code into two binary Gray codes is shown in the figure. Three four-element Gray code patterns are taken as an example in the figure. In the figure, (a) is the gray scale diagram of the gray code sequence, and (b) is the cross section of the gray scale diagram. Gray i The definition of four-element Gray code pattern is i = 1, 2, 3. Gray3' and Gray3'' are two binary Gray codes calculated from the last four-element Gray code;
[0095] Figure 4The process of solving the order of the proposed quaternary complementary Gray code is illustrated in the figure. Three quaternary Gray code patterns are shown as examples, G... i G i ′(G i The definitions of ″), V(V′), and k(W′) are respectively: quaternary Gray codeword, binary codeword calculated from quaternary Gray codeword, directly calculated codeword, and codeword obtained from reordering operation. k and k′ are the two sets of levels obtained in the final calculation. k′ needs to be rounded up after dividing W′ by 2. In the figure, quaternary and binary Gray codewords are represented in grayscale. Quaternary Gray codewords black, dark gray, light gray, and white represent quaternary codewords 0, 1, 2, and 3, respectively. Binary Gray codewords black and white represent binary codewords 0 and 1, respectively.
[0096] Figure 5 This diagram illustrates the principle of the isolated connected region order correction strategy. (a) represents the order correction process, where Q represents an isolated region of order n, occupying an area of one pixel. The region is identified using a connected region labeling algorithm, and the order within the region is set to m using the neighborhood determination strategy represented in (b), thus achieving the order correction of the isolated region. In (b), different uppercase letters represent different orders; red background blocks represent identified isolated regions, orange background blocks represent the neighborhood of the isolated region, and green background blocks indicate that the isolated region has been corrected. An isolated region is corrected only if it is surrounded by other regions of the same order; otherwise, it is discarded.
[0097] Figure 6 This is a schematic diagram of the final phase expansion process. and The definition consists of two different sets of wrapping phases, distinguished by the different cutoff point positions. The background color represents two complementary binary masks. mid and Mask edge This indicates the correspondence between two sets of wrapped phases and orders in different regions. After the phase expansion is completed, the corresponding regions are selected and combined to obtain the final expanded phase Φ.
[0098] Figure 7 This paper compares the isolated region order correction strategy with the median filtering method. (a) shows the object under test; (b) shows the Gray code after adding noise; (c) shows the grayscale changes before and after adding noise at the red dashed line in (b); (d) shows the reconstruction results using the proposed quaternary complementary Gray code method without applying the order correction strategy when there is significant noise in the simulated measurement scene; (e) to (h) show the measurement results using the median filtering method with 3×3, 5×5, and 7×7 window sizes and the proposed order correction strategy, respectively; (i) and (l) provide detailed magnified images of the area marked by the red border in (a) under the above methods.
[0099] Figure 8 Comparison of different methods. (a) is the object to be measured, (b) is the reconstruction result of the binary complementary Gray code method as the reference true value; the remaining figures (c) to (f) are the reconstruction results (left) and error maps (right) of the conventional binary Gray code method and the proposed quaternary complementary Gray code method, respectively. The upper part of the reconstruction result figure shows the number of phase shift stripes (PS) and Gray code patterns (GC) required by the corresponding method, and the upper part of the error map shows the error rate of the order obtained by the method. DETAILED DESCRIPTION
[0100] The application will be further described below in conjunction with the drawings and embodiments.
[0101] First embodiment
[0102] The three-dimensional measurement method based on quaternary complementary Gray code auxiliary phase unwrapping of the present embodiment is shown in the measurement flowchart as Figure 1 The method comprises the following steps:
[0103] The method comprises the following steps:
[0104] Step a, generating, projecting by a computer, projecting by a projector and collecting by a camera a multi-step phase shift stripe pattern and a quaternary Gray code pattern;
[0105] Step b, calculating the wrapped phase and the average intensity;
[0106] Step c, dividing the area by the wrapped phase and generating a binary mask, and obtaining a new wrapped phase by using the cut-off point translation technology;
[0107] Step d, using the average intensity and the scaling value as the threshold to decompose the code word and calculate the order;
[0108] Step e, correcting the two groups of orders, and selecting the stable area in the wrapped phase and the order by the binary mask, respectively;
[0109] Step f, respectively unwrapping the corresponding areas of the two groups of wrapped phase and order;
[0110] Step g, merging the two unwrapped phases with only half the area to obtain the final unwrapped phase;
[0111] Step h, subtracting the unwrapped phase of the reference plane from the final unwrapped phase, and converting the phase information into height information by the phase height model, thereby realizing three-dimensional reconstruction.
[0112] Second embodiment
[0113] The present embodiment is a structural framework diagram of the first embodiment, and shows the intermediate process, as shown in Figure 2 .
[0114] Third embodiment
[0115] The specific steps of step a are as follows:
[0116] Step a1: encode N sinusoidal fringe patterns as a projection pattern group;
[0117] The phase shift fringe encoding formula is:
[0118]
[0119] Wherein, N is the number of phase shift steps, n = 1, 2, …, N is the phase shift index, f0 is the set fringe frequency, a, b are generally set to 127.5;
[0120] Step a2: encode the required quaternary Gray code;
[0121] Step a3: use the dithering algorithm to binarize the generated multi-step phase shift fringe and quaternary Gray code patterns;
[0122] Step a4: the projector maintains a certain degree of defocus to ensure that the projected binarized multi-step phase shift fringe pattern presents sinusoidal;
[0123] Step a5: the projector maintains a certain degree of defocus to ensure that the projected binarized multi-step phase shift fringe pattern presents sinusoidal;
[0124] Step a6: the camera collects the deformed phase shift fringe pattern and the quaternary Gray code pattern.
[0125] The specific steps of step b are as follows:
[0126] Step b1: according to the deformed fringe obtained in step a, the expression is:
[0127]
[0128] Wherein, α 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 fringe 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 the 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, B(x, y) is the modulation intensity;
[0133] Step b2: Calculate the wrapped phase using the obtained deformed fringe image, the calculation formula is:
[0134]
[0135] After obtaining the wrapped phase using the above formula, the subsequent step is to use the Gray code pattern to obtain the order, and then phase 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 are the collected multi-step phase-shifting fringe images.
[0139] Fourth embodiment
[0140] This embodiment is the acquisition of binary mask and new wrapped phase, on the basis of the above specific embodiments, the specific steps of step c are further limited as follows:
[0141] Step c1: According to the phase value of the wrapped phase, the wrapped phase is divided into a central stable region and a truncated unstable region, and a binary mask of the two regions is generated, the calculation formula is:
[0142]
[0143] Mask edge (x, y) = 1 - Mask mid (x, y)
[0144] where Mask mid (x, y) and Mask edge (x, y) represent the binary masks 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: Obtain a new wrapped phase using the truncation point translation technique on the original wrapped phase, the calculation formula is:
[0146]
[0147]
[0148] represent the new wrapped phase after truncation point translation.
[0149] Fifth embodiment
[0150] The embodiment is to set threshold value to solve decoding word and then calculate level, on the basis of the above embodiment, the specific steps of step d are further limited as follows:
[0151] Step d1: since four elements are used for encoding, three threshold distributions are needed for decoding; in an ideal case, the expression of threshold value is:
[0152]
[0153] th m (x,y)=A(x,y)
[0154]
[0155] Where th u (x,y), th m (x,y) and th l (x,y) are threshold distributions needed for image segmentation;
[0156] However, in practice, the AB threshold strategy is not applicable to all scenarios; for example, under high-speed measurement requirements, the projected fringe is a binary dither pattern, and the relative sinusoidal fringe is generated by physical defocusing; in this case, the modulation intensity B of the defocused fringe will be reduced, which will cause the AB threshold strategy based on the fringe to fail to accurately segment the gray levels of the Gray code; however, we notice that the average intensity A of the defocused fringe does not change, and the average intensity A of the defocused fringe is approximately equal to the modulation intensity B in the unfocused state, which is proved as follows:
[0157] The general measurement environment is a darkroom, and the influence of ambient light is small, so β1 and β2 in step S21 formula can be ignored, so we can get:
[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 127.5, γ = 1 under normal circumstances;
[0164] Step d2: As Figure 3 As shown, the last quaternary Gray code is decomposed into two different sets of binary codewords using different threshold lines, and the remaining Gray codes are decomposed into quaternary codewords, as shown in the following formula:
[0165]
[0166] Where G′ M (x,y) and G″ M (x, y) represent two sets of binary codewords, M represents the number of quaternary Gray code patterns, and Gray... M (x,y) represents the last quaternion Gray code pattern, G m (x,y) represents the quadratic codeword information, Gray m This represents all Gray code patterns except the last one, where 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 codewords obtained by direct calculation, f(·) and g(·) represent reordering operations, k(x,y) and W′(x,y) represent codewords obtained after reordering, Ceil(·) represents floor operation, and k(x,y) and k′(x,y) are the final order.
[0174] The correspondence between the above codewords and level information is as follows: Figure 4 As shown.
[0175] Sixth embodiment:
[0176] This embodiment addresses the correction of error levels. Based on the specific embodiment described above, step e is further defined as follows:
[0177] Step e1: Apply the connected component labeling algorithm to each of the two sets of levels sequentially. The algorithm principle is as follows: Figure 5; and the connected domain with the size of 1 pixel is corrected by the neighborhood judgment, and the neighborhood judgment rule is as follows Figure 5 (b), the isolated region is set to the same level only when the upper, lower, left and right of the isolated region are the same level;
[0178] Step e2: two groups of relatively stable parts in the wrapped phase and the level are selected by two binary masks, and the calculation formula is as follows:
[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] Wherein, the subscripts'mid' and 'edge' respectively correspond to the wrapped phase and the level of the region, and the values outside the corresponding region are set to 0.
[0183] Seventh embodiment:
[0184] This embodiment is the acquisition of the unwrapped phase corresponding to different regions, and the specific steps of step f are further limited as follows on the basis of the above specific embodiments:
[0185] Step f1: the corresponding regions of the two groups of wrapped phase and level are unwrapped respectively, and two unwrapped phases with only half of the region are obtained, and the calculation formula is as follows:
[0186]
[0187] Note The directly calculated wrapped phase should be additionally increased by π, and the subscripts'mid' and 'edge' of the two unwrapped phases with only half of the region are relative to .
[0188] Eighth embodiment:
[0189] This embodiment is the acquisition of the final unwrapped phase, and the specific steps of step g are further limited as follows on the basis of the above specific embodiments:
[0190] h: as Figure 6 shown, two unwrapped phases with only half of the region are combined to obtain the final unwrapped phase, and the calculation formula is as follows:
[0191] Φ(x,y)=Φ mid (x,y)∪Φ edge(x, y).
[0192] Ninth embodiment: This embodiment is the acquisition of the height information of the object to be measured, and based on the above specific embodiments, the specific steps of step h are further limited 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] Wherein Φ r (x, y) and ΔΦ(x, y) represent the unwrapped phase of the reference plane and the unwrapped phase containing only the height information of the object, respectively;
[0196] h2, convert the phase information into height information through the phase-height model, the calculation formula is:
[0197] ΔΦ 2 = ahΔΦ 2 +bhΔΦ+ch
[0198] For convenience of representation, (x, y) will be omitted; wherein h represents the height of the object to be measured, a, b and c are system parameters obtained in the calibration process.
[0199] Tenth embodiment:
[0200] This embodiment verifies the proposed isolated region order correction strategy, and compares it with the conventional median filtering strategy, as shown in Figure 7 In addition, in order to more clearly show the difference between the two methods, Gaussian noise is added to the collected four-element Gray code, and the Gaussian noise is generated in the following way: a standard Gaussian noise with mean 0 and variance 1 is generated in advance, then it is normalized to [0, 1], then it is multiplied by a coefficient to control its amplitude, and the coefficient multiplied in this experiment is 20. The results show that the median filtering with 3x3 and 5x5 window cannot completely eliminate the spikes caused by order errors. Although 7x7 median filtering and the proposed method can eliminate the spikes, it can be found in the detail maps shown in Figure 7 (k) and (l) that 7x7 median filtering leads to the smoothing of the surface texture of the wing and the loss of the details of the object surface. In addition, since the median filtering method involves selecting an appropriate filter window size, it is challenging to optimize this selection in actual measurement. Therefore, the proposed isolated region order correction strategy is effective and easy to use.
[0201] Eleventh embodiment:
[0202] This embodiment compares the proposed four-element complementary Gray code method with the currently more advanced methods, as shown inFigure 8 To make the comparison more fair, the wrapped phase used for phase unwrapping in all methods is the same, which is four-step phase shifting. Since the wrapped phase is the same, only the accuracy of the sub-phases under different methods is compared, and the binary complementary Golay code method is used as the reference true value. The results show the three-dimensional profile calculated by different methods, as well as the sub-phase error rate and error position. It can be seen that the reconstruction result of the conventional binary Golay code method (5 encoded patterns) has obvious periodic strip errors, while the binary complementary Golay code method (6 encoded patterns) and the proposed quaternary complementary Golay code method (3 encoded patterns) can obtain better measurement results. In addition, the proposed method has fewer projected patterns compared with 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 Golay code assisted phase unwrapping provided by the application has the following beneficial effects:
[0204] The application provides a three-dimensional measurement method based on quaternary complementary Golay code assisted phase unwrapping, which projects a plurality of step phase shift fringe images and quaternary Golay code patterns. By taking advantage of the large information capacity of the quaternary Golay code, the last quaternary Golay code pattern is calculated into two binary Golay code patterns, one of which is used to calculate the sub-phase, and the other is used to introduce the complementary strategy. The complementary measurement is introduced without additional projected patterns, which improves the measurement efficiency while ensuring the accuracy of phase unwrapping. At the same time, an isolated sub-phase correction strategy based on a connected region labeling algorithm is introduced to deal with the sub-phase error that may occur due to the decrease in the noise resistance of the Golay code caused by the increase in the gray level. The method has the advantages of high measurement efficiency, good robustness, and high measurement result precision.
[0205] The above description is only an embodiment of the application, and does not limit the patent scope of the application, and any equivalent structure or equivalent flow transformation obtained by using the content of the specification and drawings, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the application.
Claims
1. A three-dimensional measurement method based on quaternary complementary Gray code assisted phase unwrapping, characterized by, The method comprises the following steps: S1, projecting and capturing a pre-designed multi-step phase-shifting fringe pattern and a four-element Gray code pattern by a projector and a camera; S2, calculating the wrapped phase and the average intensity of the fringe pattern using the multi-step phase-shifting 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 a binary mask of the two regions, and obtaining a new wrapped phase using a truncation point translation technique; S4, using the average intensity and its scaled value as different thresholds, using different threshold lines to calculate the last four-element Gray code pattern into two groups of binary code words and other Gray code patterns into four-element code words, and calculating two groups of orders according to the obtained code words; S5, correcting the two groups of orders using a strategy based on a connected region marking algorithm, and selecting the stable parts of the two groups of wrapped phases and orders through the two binary masks, respectively; 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 regions; S7, combining the two unwrapped phases with only half regions to obtain a final unwrapped phase; S8, subtracting the unwrapped phase of the reference plane from the final unwrapped phase, and converting the phase information into height information through a phase height model.
2. The method of claim 1, wherein, The S1 comprises the following specific steps: S11, generating a multi-step phase-shifting fringe image required for obtaining a phase by a computer; S12, generating a four-element Gray code pattern required for obtaining order information by a computer; S13, binarizing the generated multi-step phase-shifting fringe and four-element Gray code pattern using a dithering algorithm; S14, keeping a certain degree of defocus by the projector to ensure that the projected binarized multi-step phase-shifting fringe pattern presents sinusoidal characteristics; S15, collecting the deformed phase-shifting fringe pattern and four-element Gray code pattern by a camera.
3. The method of claim 1, wherein, The specific steps of S2 are as follows: S21, the expression of the deformed fringe obtained in step S1 is: Wherein, α is the sensitivity of the camera, 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 fringe respectively. In general, when the gray scale range of the projector is [0, 255], in order to cover the entire dynamic range, a = b = 127.5 is generally set, Φ is the phase containing the height information of the measured object, n represents the index of phase shift, and n = 0, 1, …, N-1, N represents the number of phase shifts, β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: A(x, y) = α{r(x, y)[a + β1(x, y)] + β2(x, y)} B(x, y) = αr(x, y)b Wherein, A(x, y) is the average intensity, and B(x, y) is the modulation intensity; S22, calculating the wrapped phase using the obtained deformed fringe image, and the calculation formula is: After calculating the wrapped phase using the above formula, the subsequent step is to obtain the order using the Gray code pattern, and the wrapped phase is unwrapped; S23, calculating the average intensity using the obtained deformed fringe image, and the calculation formula is: where I1, I2,..., I N are the collected multi-step phase-shifting fringe images.
4. The method of claim 1, wherein, The specific steps of S3 are as follows: S31: The wrapped phase is divided into a center stable region and a truncated unstable region according to the phase value of the wrapped phase, and a binary mask of the two regions is generated, and the calculation formula is: Mask edge (x,y) = 1 - Mask mid (x,y) where Mask mid (x,y) and Mask edge (x,y) represent the binary mask corresponding to the center stable region and the truncated unstable region, and the subscripts'mid' and 'edge' represent the center stable region and the truncated unstable region, respectively. S32: A new wrapped phase is obtained by using the truncated point translation technique on the original wrapped phase, and the calculation formula is: represent the new wrapped phase after truncation and translation.
5. The method of claim 1, wherein, The specific steps of S4 are as follows: S41: Since four elements are used for encoding, three threshold distributions are needed for decoding; in an ideal case, the expression of the threshold value is: th m (x,y) = A(x,y) where th u (x,y), th m (x,y), and th l (x,y) is a threshold distribution required for image segmentation; However, in practice, the AB threshold strategy is not applicable to all scenarios; for example, in high-speed measurement requirements, the projected fringe is a binary dithering pattern, and the relative sinusoidal fringe is generated by physical defocusing; in this case, the modulation intensity B of the defocused fringe will be reduced, which will cause the AB threshold strategy based on the fringe to be unable to accurately segment the gray levels of the Gray code; however, we notice that the average intensity A of the defocused fringe does not change, and the average intensity A of the defocused fringe is approximately equal to the modulation intensity B in the non-defocused state, as shown below: Generally, the environment for measurement is a dark room, and the influence of ambient light is small, so β1 and β2 in the formula of step S21 can be ignored, and thus the following 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 127.5, γ is usually equal to 1 in most cases; S42: 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: where G' (x, y) and G" (x, y) represent two sets of binary code word information, M represents the number of quaternary Gray code patterns, Gray (x, y) represents the last quaternary Gray code pattern; G M (x, y) and G" (x, y) represent two sets of binary code word information, M represents the number of quaternary Gray code patterns, Gray M (x, y) represents the last quaternary Gray code pattern; G M (x, y) represents the last quaternary Gray code pattern; G m (x, y) represents the last quaternary Gray code pattern; G m represents the last quaternary Gray code pattern; G S43: After obtaining the code word information, the order can be calculated, and the calculation formula is: 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 directly calculated code words, f(·) and g(·) represent the reordering operations, k(x,y) and W′(x,y) represent the code words obtained after reordering, Ceil(·) represents the rounding up operation, and k(x,y) and k′(x,y) are the final orders.
6. The method of claim 1, wherein, The specific steps of S5 are as follows: S51: The connected region marking algorithm is used for each order of the two groups of orders, and the connected domains with an area size of 1 pixel are corrected by domain judgment; S52: The more stable parts of the two groups of wrapped phases and orders are selected through two binary masks, and 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) where the subscripts'mid' and 'edge' represent the regions corresponding to the current wrapped phase and order, and the values outside the corresponding regions are set to 0.
7. The method of claim 1, wherein, The specific steps of S6 are as follows: S6: The corresponding regions of the two groups of wrapped phases and orders are respectively unwrapped to obtain two unwrapped phases with only half the area, and the calculation formula is: Note The wrapped phases calculated directly should be additionally increased by π, when the indices'mid' and 'edge' of the unwrapped phases of the two halves of the region are referred to respectively.
8. The method of claim 1, wherein, The specific steps of S7 are as follows: S7: The two unwrapped phases with only half the area are combined to obtain the final unwrapped phase, and the calculation formula is: Φ(x,y) = Φ mid (x,y)∪Φ edge (x,y) 9. The method of claim 1, wherein, The specific steps of S8 are as follows: S81, subtract the unwrapped phase of the reference plane from the final unwrapped phase, 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, convert the phase information into height information through the phase-height model, the calculation formula is: ΔΦ 2 = ahΔΦ 2 +bhΔΦ+ch For convenience of representation, (x, y) will be omitted; wherein h represents the height of the object to be measured, a, b and c are system parameters, which are obtained in 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