Color Gray code coding auxiliary phase unwrapping method and applied three-dimensional imaging method and system
Through the color Gray code encoding auxiliary phase expansion method, the color sinusoidal stripe pattern and multi-frequency heterodyne method are used to solve the problem of low efficiency of projected coding structured light-assisted phase expansion in the prior art, and efficient three-dimensional imaging measurement is achieved.
Patent Information
- Application Number
- CN202510768560.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-06-10
AI Technical Summary
In the existing phase deployment technology, the projection coded structured light assisted phase deployment efficiency is low, resulting in a reduced measurement efficiency.
The color grey code encoding assisted phase expansion method is used to construct two sets of color sinusoidal stripe patterns with different frequencies, and the RGB color channel is used to encode Grey code, combining multi-frequency heterodyne method and Grey code decoding to perform phase expansion.
The number of projected patterns is reduced, the measurement efficiency is improved, periodic errors are avoided, the system is robust, and the high ambient noise conditions are adapted.
Smart Images

Figure CN120293034A_ABST
Abstract
Description
Technical Field
[0001] The present invention discloses a three-dimensional imaging method and system for a color Gray code encoding-assisted phase unwrapping method and application, belonging to the field of three-dimensional shape measurement technology. Background Art
[0002] With the progress of modern computational methods, optical technologies, and graphics computing, research in the field of computer vision has grown rapidly and has found extensive applications in the past few decades. To meet the needs of production and life, computer vision technology has gradually expanded from two-dimensional images to three-dimensional space. How to enable machines to obtain high-quality spatial stereo vision information has become an important research direction in the current field of computer vision. Due to its advantages such as non-contact, high precision, and strong robustness, the structured light measurement method has become one of the most practical technologies in the field of three-dimensional reconstruction.
[0003] Optical three-dimensional measurement technology is widely used in industrial modeling, virtual reality, and microscopic measurement due to its high precision, fast response, and non-contact characteristics. Among them, the fringe projection profilometry is particularly well-known. This method uses a projector to project a grating pattern carrying phase information and synchronously captures the image modulated by the object surface through a camera. The phase-shifting method is used to decode the phase information in the image. However, since the contour information of the object surface is hidden in the phase, and the phase can only be obtained through the inverse trigonometric function, its effective range is limited, resulting in phase ambiguity. To eliminate this ambiguity, phase unwrapping technology must be used to restore the continuous absolute phase.
[0004] To stably unwrap the wrapped phase into the absolute phase, it is necessary to project additional encoded structured light to assist in the wrapped phase unwrapping. The phase order information is obtained through the additional encoded structured light, and this information is used to assist in obtaining the absolute phase of the wrapped phase. Commonly used methods include projecting three sets of sinusoidal encoded fringes with different frequencies for multi-frequency heterodyne phase unwrapping, such as a three-dimensional reconstruction method of fringe structured light based on virtual binoculars disclosed in a Chinese patent application with the application number CN202111413425.1, or projecting a set of sinusoidal fringes and a set of Gray code encoded fringes to use the Gray code to assist in unwrapping the sinusoidal fringes, such as a three-dimensional measurement method of a low-reflectivity workpiece based on structured light disclosed in a Chinese patent application with the application number CN202410785197.8. However, whether it is projecting three sets of sinusoidal fringes or combining sinusoidal fringes and Gray code encoded fringes, the required number of fringes is relatively large, reducing the measurement efficiency of the system. Therefore, calculating the absolute phase while reducing the number of projected patterns is one of the key issues in improving the performance of the phase measurement system. Summary of the Invention
[0005] The technical problem solved by the present invention is: aiming at the problem of low efficiency in the existing phase unwrapping technology with projection coded structured light assisted phase unwrapping, a color Gray code coding assisted phase unwrapping method, a three-dimensional imaging method and system using the same are provided.
[0006] The present invention is implemented by adopting the following technical solutions:
[0007] The present invention first discloses a color Gray code coding assisted phase unwrapping method, including the following steps:
[0008] Step 1: Construct two sets of color sine stripe patterns with different frequencies to project stripes on the contour of the scene to be measured;
[0009] Step 2: Capture the two sets of color sine stripe patterns projected on the scene to be measured, and convert the projected images from RGB format images to HSV format images;
[0010] Step 3: Respectively extract the red region and the blue region from the HSV format image according to the hue value, extract the corresponding channels of the red region and the blue region from the RGB format projected image, perform intensity normalization on the extracted red region channels and blue region channels, merge and fill them into a single-channel image after the intensity normalization process, calculate the wrapped phases of the single-channel images of the two sets of color sine stripe patterns with different frequencies by using the phase shift formula, and perform the first unwrapping on the wrapped phases of the two sets of color sine stripe patterns with different frequencies;
[0011] Step 4: Extract the hue channel from the color sine stripe patterns in the HSV format image in Step 2, and perform Gray code decoding to obtain the Gray code decoding order of this time;
[0012] Step 5: Use the Gray code decoding order obtained in Step 4 to assist in the second unwrapping of the phase map in the first unwrapping in Step 3, and obtain the final absolute phase through error compensation.
[0013] In the color Gray code coding assisted phase unwrapping method of the present invention, further, the construction process of the two sets of color sine stripe patterns with different frequencies in Step 1 is as follows:
[0014] Define the N-step phase shift stripe pattern:
[0015] ,
[0016] Wherein, It represents the gray value of the phase-shifted fringe pattern at the pixel coordinates (u, v), where n is a positive integer representing the number of phase-shifting steps, a(u, v) and b(u, v) respectively represent the background light intensity and modulation amplitude of the fringe pattern at the pixel coordinates (u, v), f0 is the fringe frequency, and the following encodings are performed on a(u, v) and b(u, v) respectively: a(u, v) = 0.6, b(u, v) = 0.4;
[0017] There are two groups of phase-shifted fringe patterns, each group contains N images, which are N-step phase-shifted images, a total of 2N images, corresponding to 2N-bit Gray code images.
[0018] In the color Gray code encoding-assisted phase unwrapping method of the present invention, further, Gray code encoding is performed on the two groups of phase-shifted fringe patterns through the RGB three channels, and two color channels, red and blue, are selected as the encoding colors to construct a color sine fringe pattern.
[0019] In the color Gray code encoding-assisted phase unwrapping method of the present invention, further, step 2 includes the following sub-steps:
[0020] Step 2.1: The projector projects two groups of color sine fringe patterns with different frequencies into the scene to be measured, and the industrial camera synchronously captures the two groups of projected color sine fringe patterns. The RGB mode of the fringe pattern of the captured projected image is expressed as:
[0021] ,
[0022] where c represents the pattern captured by the camera, N represents the number of phase-shifted patterns, which is equal to the number of phase-shifting steps of the fringe pattern, (u, v) represents the pixel coordinates, respectively represent the intensities of the RGB three channels of the fringe pattern at the pixel coordinates (u, v);
[0023] Step 2.2: Convert the two groups of projected color sine fringe patterns from the RGB channel mode to the HSV channel mode. The conversion formula for the hue angle H is:
[0024] .
[0025] ,
[0026] where H(u, v) represents the hue angle of the pixel coordinates (u, v), and θ(u, v) represents the hue angle of the pixel coordinates (u, v) when the phase is in (0, 2π).
[0027] In the color Gray code encoding-assisted phase unwrapping method of the present invention, further, step 3 includes the following sub-steps:
[0028] Step 3.1: Extract the red and blue regions from the HSV - format projection image according to the hue value. Then, extract the channels of the corresponding regions from the RGB - format projection image. After performing intensity normalization on the extracted region channels respectively, merge and fill them into a single - channel image. The normalization formula is as follows:
[0029] ,
[0030] where, is the stripe intensity information of the red and blue regions after normalization at the pixel coordinates (u, v) of the stripe pattern, l is the intensity lower limit, and h is the intensity upper limit;
[0031] Step 3.2: Use the following phase - shift formulas to calculate the wrapped phases of the red and blue regions in two groups of different - frequency color sinusoidal stripe patterns respectively:
[0032] For the red region:
[0033] ,
[0034] For the blue region:
[0035] ,
[0036] where φ r (u, v) and φ b (u, v) refer to the stripe - pattern wrapped phases of the pixel coordinates (u, v) in the red and blue regions;
[0037] Step 3.3: Perform the first - order unwrapping on the wrapped phases of the two groups of different - frequency stripe patterns by the multi - frequency heterodyne method. The multi - frequency heterodyne calculation formula is as follows:
[0038] ,
[0039] ,
[0040] where, λ b is the frequency corresponding to the heterodyne phase Δφ, λ1 and λ2 are the phase functions corresponding to the two groups of different - frequency stripe patterns respectively, Δφ is the heterodyne phase, that is, the difference between the two groups of different - frequency stripe patterns, φ1 is the wrapped phase of the first group of stripe patterns, and φ2 is the wrapped phase of the second group of stripe patterns;
[0041] Select the wrapped phase of one of the groups of stripe patterns to perform a first - order unwrapping to obtain the first - order unwrapped phase diagram.
[0042] In the color Gray - code - encoding - assisted phase - unwrapping method of the present invention, further, the Gray - code decoding in step 4 includes the following sub - steps:
[0043] Step 4.1: Extract the red region from the stripe pattern in HSV format. Assign the red region as 1 through the following formula, and assign the remaining parts as 0;
[0044] ,
[0045] where GC i (u, v) represents the Gray code encoding map obtained from the hue channel of the image at pixel coordinates (u, v) in HSV format, and H(u, v) is the hue angle of the pixel coordinates (u, v) in the HSV format image;
[0046] Step 4.2: Convert the Gray code of the extracted red region to decimal encoding. The conversion formula is as follows:
[0047] ,
[0048] ,
[0049] where, B i is the i-th bit of the binary code, GC i is the i-th bit of the Gray code encoding map obtained in Step 4.1, ⊕ represents the exclusive OR operation, k is the decimal number of the Gray code order, and m is the number of bits of the binary code.
[0050] In the color Gray code encoding assisted phase unwrapping method of the present invention, further, the said Step 5 includes the following process:
[0051] Step 5.1: Use the Gray code decoding order obtained in Step 4 to assist in unwrapping the first phase unwrapping map of Step 3 through the following formula, and calculate the absolute phase map:
[0052] ,
[0053] where, Φ erros (u, v) represents the absolute phase with periodic error of pixel coordinates (u, v), φ(u, v) represents the first phase unwrapping map of pixel coordinates (u, v) obtained in Step 3, and k(u, v) represents the decimal number of the Gray code order of pixel coordinates (u, v) obtained by Gray code decoding in Step 4;
[0054] Step 5.2: Perform median filtering on the absolute phase with periodic error to obtain a phase correction template;
[0055] Step 5.3: Use the correction template to assist in performing the second phase unwrapping on the wrapped phase through the following formula to compensate for the error,
[0056] ,
[0057] Among them, Φ template represents the absolute phase after median filtering, Round(x) represents the integer closest to the distance x, Φ(u, v) represents the error-free absolute phase of the pixel coordinates (u, v), and φ(u, v) is the first phase unwrapping diagram of the pixel coordinates (u, v) obtained in step 3.
[0058] The present invention further provides a three-dimensional imaging method, which uses the fringe projection profilometry for three-dimensional imaging, and the above-mentioned color Gray code encoding assisted phase unwrapping method of the present invention is used to unwrap the wrapped phase of the projected fringe pattern during the imaging process.
[0059] Based on the above three-dimensional imaging method, the present invention also provides a three-dimensional imaging system, including:
[0060] A visible light projection module that generates two sets of color sine fringe patterns with different frequencies and projects the fringe patterns onto the contour of the scene to be measured;
[0061] An image acquisition module that captures the two sets of color sine fringe patterns projected onto the scene to be measured;
[0062] One or more processors;
[0063] A memory storing one or more computer programs;
[0064] Among them, the processor receives the image data of the image acquisition module and calls the computer program in the memory to implement the three-dimensional imaging method of the present invention.
[0065] The present invention has the following beneficial effects:
[0066] The beneficial effects of the present invention are as follows:
[0067] (1) A color Gray code encoding assisted phase unwrapping method proposed by the present invention embeds the phase-shifted fringes into different channels of a color image according to the Gray code encoding method, extracts the phase-shift information in the color fringes first, calculates the wrapped phase, uses the multi-frequency heterodyne method for the first phase unwrapping, then uses the hue information of the color fringes to perform Gray code decoding on it, and finally performs the second phase unwrapping through the Gray code to obtain the absolute phase.
[0068] (2) The present invention can complete phase unwrapping using two sets of phase-shifted fringes, which not only avoids the problem of large errors in low-frequency fringes but also avoids the problem of large periodic errors caused by Gray code encoding.
[0069] (3) When calculating the wrapped phase in the present invention, since the red region and the blue region in the color image have a high visual contrast, and the hue values of the two colors are quite different, they are easy to extract and distinguish, reducing the crosstalk between fringes. The present invention specifically normalizes the encoded regions of red and blue in the color fringes respectively and combines them into a single-channel image, ensuring that different color fringes are at the same intensity level.
[0070] (4) The present invention adopts a coding scheme of color Gray code + phase-shifted fringes, without the need to project additional fringes. Since the Gray code is embedded in different channels of two sets of patterns, the required number of patterns is significantly reduced. This method effectively improves the measurement efficiency, avoids periodic errors without having any impact on the normal phase, and has good robustness in high ambient noise.
[0071] In summary, the color Gray code encoding-assisted phase unwrapping method and the three-dimensional imaging method disclosed by the present invention reduce the number of auxiliary projection fringes required for wrapped phase unwrapping, streamline the three-dimensional imaging calculation process, and improve the measurement efficiency of the three-dimensional imaging system.
[0072] The following further describes the present invention in conjunction with the accompanying drawings and specific embodiments. Description of the Drawings
[0073] Figure 1 It is a schematic flow diagram of the color Gray code encoding-assisted phase unwrapping method of the present invention.
[0074] Figure 2 It is a schematic diagram of color Gray code encoding-assisted phase unwrapping in Embodiment 1.
[0075] Figures 3a - 3f It is a set of color deformed fringes obtained by shooting in Embodiment 1.
[0076] Figure 4 It is a Gray code expansion diagram in Embodiment 1.
[0077] Figure 5a , 5b It is a wrapped phase diagram of two frequency fringe patterns in Embodiment 1.
[0078] Figure 6 It is a double-frequency heterodyne diagram in Embodiment 1.
[0079] Figure 7 It is a phase unwrapping diagram in Embodiment 1. Specific Embodiments
[0080] Embodiment
[0081] Such as Figure 1 And Figure 2As shown in the figure, the color Gray-code encoding assisted phase unwrapping method of the present invention specifically includes the following steps:
[0082] Step 1: Construct two sets of N-step color sinusoidal fringe patterns with different frequencies, where N is a positive integer representing the number of phase shift steps, which can be selected according to actual measurement accuracy requirements and system performance, and usually ranges from 3 to 10.
[0083] Specifically, the construction process of the two sets of N-step color sinusoidal fringe patterns is as follows:
[0084] First, define the N-step phase shift fringe pattern:
[0085] .
[0086] Among them, represents the gray value of the fringe pattern, a(u, v) and b(u, v) respectively represent the background light intensity and modulation amplitude, and f0 is the fringe frequency. To facilitate separating different color regions through the hue channel, a(u, v) and b(u, v) are encoded as follows respectively: a(u, v) = 0.6, b(u, v) = 0.4.
[0087] Secondly, there are two sets of phase shift fringe patterns in total, with a total of 2N images, corresponding to encoding 2N-bit Gray-code images. Gray-code encoding is performed on the two sets of phase shift fringe patterns through the RGB three channels. The known color-H value mapping range table is as follows:
[0088] Color-H value mapping range table.
[0089] .
[0090] Gray-code encoding is performed on the two sets of phase shift fringe patterns through the RGB three channels. Two color channels, red and blue, are selected as the encoding colors to construct the color sinusoidal fringe pattern.
[0091] Step 2: Capture the two sets of N-step color sinusoidal fringe patterns projected onto the scene to be measured, and convert the projected image from an RGB format image to an HSV format image.
[0092] Specifically, the conversion of the projected image from the RGB format to the HSV format includes the following sub-steps:
[0093] Step 2.1: Project two sets of N-step color sinusoidal fringe patterns with different frequencies from the projector into the scene to be measured, and synchronously capture the two sets of N-step color sinusoidal fringe patterns after projection by an industrial camera. The obtained color deformed fringe pattern is , and the projected fringe pattern captured is represented in the RGB mode as:
[0094] .
[0095] Among them, the superscript c represents the pattern captured by the camera, N represents the number of phase-shifted patterns, which is equal to the number of phase-shifting steps of the fringe pattern, and (u, v) represents the pixel coordinates. The pixel coordinates are retrieved from the zero point to the maximum value direction. respectively represent the intensities of the RGB three channels of the fringe pattern at the pixel coordinates (u, v).
[0096] Step 2.2: Convert the two sets of N-step color sinusoidal fringe patterns after projection from the RGB channel mode to the HSV channel mode. The conversion formula for the hue angle H is:
[0097] 、
[0098] 。
[0099] Among them, H(u, v) represents the hue angle of each pixel coordinate (u, v), and θ(u, v) represents the hue angle of each pixel coordinate (u, v) when the phase is in (0, 2π).
[0100] Step 3: Extract the red region and the blue region from the HSV format image respectively according to the hue value, extract the corresponding channels of the red region and the blue region from the RGB format projection image, perform intensity normalization on the extracted red region channel and blue region channel parts. Since the red region and the blue region correspond to different positions in the image, after the intensity normalization processing, they are merged and filled into a single-channel image. There are N images in a group of images. Due to the two sets of projected images, the frequencies corresponding to each group of images are different. Use the phase-shift formula to calculate the wrapped phase of the single-channel images of the two sets of color sinusoidal fringe patterns with different frequencies, and perform the first unwrapping on the wrapped phases of the two sets of color sinusoidal fringe patterns with different frequencies.
[0101] Specifically, the step 3 includes the following sub-steps:
[0102] Step 3.1: Extract the red and blue regions from the HSV format projection image respectively according to the hue value, extract the corresponding region channels from the RGB format projection image according to the extracted red and blue regions, perform intensity normalization processing on the extracted region channels respectively, and then merge and fill them into a single-channel image. The normalization formula is as follows:
[0103] 。
[0104] Among them, is the fringe intensity information of the pixel coordinates (u, v) after normalization in the red and blue regions. l is the intensity lower limit, l = 0, and h is the intensity upper limit, h = 255.
[0105] Step 3.2: Use the following phase-shift formula to calculate the wrapped phases of two sets of fringe patterns with different frequencies in the red region and the blue region respectively.
[0106] For the red region:
[0107] ,
[0108] For the blue region:
[0109] .
[0110] Among them, φ r (u, v) and φ b (u, v) refer to the wrapped phases of the fringe patterns at the pixel coordinates (u, v) in the red region and the blue region.
[0111] Step 3.3: Perform the first unwrapping on the wrapped phases of the two sets of fringe patterns with different frequencies by the multi-frequency heterodyne method. The multi-frequency heterodyne calculation formula is as follows:
[0112] ,
[0113] .
[0114] Among them, λ b is the frequency corresponding to the heterodyne phase Δφ, λ1 and λ2 are the phase functions corresponding to the two sets of fringe patterns with different frequencies respectively, Δφ is the heterodyne phase, that is, the difference between the two sets of fringe patterns with different frequencies, φ1 is the wrapped phase of the first set of fringe patterns, and φ2 is the wrapped phase of the second set of fringe patterns;
[0115] Since the projection image is two sets of fringe patterns with different frequencies, and each set has N images. Using the above formula, calculate the wrapped phases of the red and blue regions of these two sets of fringe patterns with different frequencies to obtain φ r1 , φ r2 , φ b1 , φ b2 , where φ r1 is the wrapped phase of the red region of the first set of images, φ r2 is the wrapped phase of the red region of the second set of images, φ b1 is the wrapped phase of the blue region of the first set of images, and φ b2 is the wrapped phase of the blue region of the second set of images.
[0116] The processed single-channel image used only unfolds the first set of frequencies. Due to the nature of multi-frequency heterodyne, only the first set of images needs to be unfolded, and then the absolute phase map can be obtained. Use the following formula to perform a single unwrapping on the wrapped phase φ1 obtained from the above first set of images:
[0117] 。
[0118] Among them, Round(x) represents taking the integer closest to x, φ is the phase after the first expansion of φ1, and O1 is the phase order.
[0119] Step 4: Extract the hue channel from the color sine stripe pattern of the HSV-format image in Step 2, and perform Gray code decoding to obtain the Gray code decoding order for this time.
[0120] Specific Gray code decoding includes the following sub-steps:
[0121] Step 4.1: Extract the red area from the stripe pattern in HSV format through the hue channel, assign the red area to 1 using the following formula, and assign the rest to 0;
[0122] 。
[0123] Among them, GC i (u, v) represents the Gray code encoding map of the pixel point coordinates (u, v) obtained from the hue channel of the HSV-format image, and H(u, v) is the hue angle of the pixel point coordinates (u, v) in the HSV-format image.
[0124] Step 4.2: Convert the Gray code of the extracted red area into a decimal code, and the conversion formula is as follows:
[0125] 、
[0126] 。
[0127] Among them, B i is the i-th bit of the binary code, GC i is the i-th bit of the Gray code encoding map obtained in Step 4.1, ⊕ represents the exclusive OR operation, k is the decimal number of the Gray code order, and m is the number of bits of the Gray code binary code.
[0128] Step 5: Use the Gray code decoding order obtained in Step 4 to assist in the second expansion of the phase diagram in the first expansion in Step 3, and obtain the final absolute phase through error compensation.
[0129] Specifically, the said Step 5 includes the following sub-steps:
[0130] Step 5.1: Use the Gray code decoding order obtained in Step 4 to assist in expanding the heterodyne phase obtained in Step 3, and the phase expansion formula is as follows:
[0131] 。
[0132] Among them, Φ erros(u, v) represents the absolute phase with periodic error of the pixel coordinates (u, v), φ(u, v) represents the first phase unwrapping of the pixel coordinates (u, v) obtained in step 3, and k(u, v) represents the decimal number of the Gray code order of the pixel coordinates (u, v) obtained by Gray code decoding in step 4.
[0133] Step 5.2: Perform median filtering on the absolute phase with periodic error to obtain a phase correction template. The median filtering formula is as follows:
[0134] 。
[0135] Among them, medfilt a×b represents the median filtering operator, a and b respectively represent the length and width of the filter kernel, and Φ template represents Φ after median filtering erros 。
[0136] Step 5.3: Use the correction template to assist in the second phase unwrapping of the wrapped phase through the following formula to compensate for the error.
[0137] 。
[0138] Among them, Φ template represents the absolute phase after median filtering, Round(x) represents taking the integer closest to x, Φ(u, v) represents the absolute phase without error, and φ(u, v) is the first phase unwrapping obtained in step 3.
[0139] The above-mentioned color Gray code encoding assisted phase unwrapping method of the present invention is used in a three-dimensional imaging method, especially for three-dimensional imaging using the fringe projection profilometry method. During the imaging process, the color Gray code encoding assisted phase unwrapping method is used to perform the wrapped phase unwrapping of the projected fringe pattern. By embedding the Gray code into different channels of two groups of patterns, the number of required projected patterns is significantly reduced, effectively improving the measurement efficiency of three-dimensional imaging.
[0140] The present invention also discloses a three-dimensional imaging system, including a visible light projection module, an image acquisition module, and an image processing computer. The visible light projection module generates two sets of N-step color sinusoidal fringe patterns and projects the fringes onto the contour of the scene to be measured. A DLP6500 digital visible light projector is selected as the device for projecting the coded structured light in the system. The image acquisition module captures the two sets of N-step color sinusoidal fringe patterns projected onto the scene to be measured and transmits them to the image processing computer. An MV-CS050-10UM industrial camera of Hikvision and an FA1202D lens of Hikvision are selected as the devices. The image processing computer includes one or more processors and a memory storing one or more computer programs. The processor receives the image data from the image acquisition module and calls the computer programs in the memory to implement the three-dimensional imaging method described above in this embodiment.
[0141] The following further elaborates on the color Gray code encoding-assisted phase unwrapping method of the present invention with specific embodiments in the accompanying drawings.
[0142] To better illustrate the method of the present invention, in this embodiment, a three-step phase shift and color Gray code scheme with two sets of frequencies of is used to illustrate the measurement of a complex scene of a human statue. In the traditional three-frequency three-step phase shift encoding of the phase unwrapping algorithm, 9 images are required for global encoding. If the phase shift plus Gray code method is used, at least 3 phase shift fringes and 6 Gray code fringes are needed. The present invention is proposed to reduce the projected patterns and achieve high-precision phase unwrapping.
[0143] The specific steps are as follows:
[0144] Construct two sets of color sinusoidal fringe patterns.
[0145] For the convenience of separating different color regions through the hue channel, we encode the sinusoidal fringes as:
[0146] .
[0147] To minimize the crosstalk between different color fringes, two color channels with a large hue difference in the HIS color space are selected for encoding, namely red and blue, to construct two sets of color Gray code-sinusoidal fringe patterns.
[0148] Project two sets of color sinusoidal fringe patterns onto the human statue scene, capture the two sets of projected color sinusoidal fringe patterns, and convert the RGB format image to the HSV format image.
[0149] The projector projects two sets of color sinusoidal fringe patterns with different frequencies onto the scene to be measured, and the industrial camera synchronously captures the color deformed fringes such as Figures 3a - 3fAs shown, the captured color pattern can be represented in the RGB mode as follows:
[0150] .
[0151] Among them, respectively represent the intensities of the RGB channels of the color stripe pattern at the pixel coordinates (u, v). Then, a color recognition algorithm based on HSV is used to decode the color stripes. First, the color stripes are converted from the RGB channel mode to the HSV channel mode. Among them, the hue angle H is obtained using the following formula.
[0152] 、
[0153] .
[0154] Among them, H(u, v) represents the hue angle of each pixel, and cos represents the cosine function.
[0155] According to the hue value, the red hue value region and the blue hue value region are respectively extracted from the projection image in HSV format, and using the above-mentioned extracted red hue region and blue hue region, the red channel and the blue channel of the corresponding region are extracted from the projection image in RGB format, and after intensity normalization processing respectively, they are filled into the single-channel image. The wrapped phases of two different frequencies are calculated using the phase shift formula, and then the heterodyne phase of the two frequencies is calculated by the multi-frequency heterodyne method to perform the first unwrapping of the wrapped phases of the two different frequency stripe patterns.
[0156] First, the red and blue regions, namely redmask(u, v) and bluemask(u, v), are extracted according to the hue value respectively. The formulas are as follows:
[0157] 、
[0158] .
[0159] After that, the channels I ri (u, v) and I bi (u, v) corresponding to redmask(u, v) and bluemask(u, v) are extracted from the RGB format stripes. The formulas are as follows:
[0160] .
[0161] After that, intensity normalization processing is performed on them respectively. The formulas are as follows:
[0162] .
[0163] is the fringe intensity information of the pixel coordinates (u, v) after normalization in the red and blue regions. l is the intensity lower limit, l = 0, and h is the intensity upper limit, h = 255.
[0164] Then, the two normalized images are merged into a single-channel image I i in (u, v), and the formula is as follows:
[0165] .
[0166] Further, the wrapped phase φ of the fringe patterns of two sets of frequencies in the red and blue regions is calculated by the phase-shifting method r φ(u, v), φ b (u, v). Since each set of images contains N images, the wrapped phase is calculated for the fringe patterns of the red and blue regions extracted respectively. The specific formula is as follows.
[0167] For the red region:
[0168] .
[0169] For the blue region:
[0170] .
[0171] Where φ r (u, v) and φ b (u, v) refer to the wrapped phases of the pixel coordinates (u, v) of the fringe patterns in the red and blue regions of the two sets of images, and N is the selected value in the above N-step phase shift.
[0172] Finally, the first phase unwrapping is performed on the fringes of one of the frequencies according to the multi-frequency heterodyne method. The formula is as follows:
[0173] 、
[0174] 、
[0175] .
[0176] Where λ b is the frequency corresponding to the heterodyne phase Δφ, λ1 and λ2 are the phase functions corresponding to the fringe patterns of two different frequencies respectively, Δφ is the heterodyne phase, that is, the difference between the fringe patterns of two different frequencies, φ1 is the wrapped phase of the first set of fringe patterns, φ2 is the wrapped phase of the second set of fringe patterns, Round(x) represents taking the integer closest to x, φ is the phase after the first unwrapping of φ1, and O1 is the phase order. The principal values of the phases of the two-frequency fringe patterns are as Figure 5a and 5bAs shown, the phase unwrapping diagram of the first phase unwrapping is as Figure 4 shown.
[0177] Extract the hue channel from the fringe pattern of the HSV format image and perform Gray code decoding.
[0178] First, use the red mask to convert the Gray code to binary code. Extract the red area from the fringe pattern in HSV format through the hue channel, assign the red area to 1 according to the following formula, and assign the rest to 0;
[0179] .
[0180] where GC i (u, v) represents the Gray code encoding map obtained from the hue channel of the HSV format image, and H(u, v) is the hue angle in the HSV format image.
[0181] Then convert the Gray code of the extracted red area to decimal encoding, and the conversion formula is as follows:
[0182] ,
[0183] .
[0184] where B i is the i-th bit of the binary code, GC i is the i-th bit of the obtained Gray code encoding map, ⊕ represents the exclusive OR operation, k is the decimal number of the Gray code order, which is the order information for subsequent phase unwrapping, and m is the number of bits of the Gray code binary code.
[0185] Use the obtained Gray code decoding order to assist the phase diagram of the first unwrapping for the second unwrapping, and obtain the final absolute phase through error compensation.
[0186] Use the obtained Gray code decoding order to assist in unwrapping the first phase unwrapping diagram through the following formula to calculate the absolute phase diagram:
[0187] .
[0188] where Φ erros (u, v) represents the absolute phase with periodic error at the pixel coordinates (u, v), φ(u, v) represents the first phase unwrapping diagram of the obtained pixel coordinates (u, v), and k(u, v) represents the Gray code decoding order of the pixel coordinates (u, v) obtained by Gray code decoding in the above process.
[0189] Perform median filtering on the absolute phase with periodic error to obtain the phase correction template.
[0190] The second phase unwrapping is performed using the corrected template to assist in wrapping the phase, and the error is compensated by the following formula:
[0191] .
[0192] where Φ template represents the absolute phase after median filtering, Round(x) represents the integer closest to x, Φ(u, v) represents the error-free absolute phase of the pixel point coordinates (u, v), and φ(u, v) is the first phase unwrapping diagram of the pixel point coordinates (u, v).
[0193] The finally obtained error-free absolute phase diagram is as Figure 7 shown.
[0194] In this article, the orientation or positional relationship indicated by terms such as "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", "vertical", "horizontal", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of clearly expressing the technical solution and description. Therefore, it cannot be understood as a limitation to the present invention.
[0195] In this article, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion. In addition to the listed elements, it may also include other elements not specifically listed.
[0196] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. Color Gray Code Encoding-Assisted Phase Unwrapping Method, characterized in that: It includes the following steps: Step 1: Construct two sets of color sinusoidal fringe patterns with different frequencies to project fringe patterns onto the contour of the scene to be measured; Step 2: Capture the two sets of color sinusoidal fringe patterns projected onto the scene to be measured, and convert the projected image from an RGB format image to an HSV format image; Step 3: Respectively extract the red region and the blue region from the HSV format image according to the hue value, extract the channels corresponding to the red region and the blue region from the RGB format projected image, perform intensity normalization on the extracted red region channel and blue region channel parts, merge and fill them into a single-channel image after the intensity normalization process, calculate the wrapped phase of the single-channel images of the two sets of color sinusoidal fringe patterns with different frequencies using the phase shift formula, and perform the first unwrapping on the wrapped phases of the two sets of color sinusoidal fringe patterns with different frequencies; Step 4: Extract the hue channel from the color sinusoidal fringe patterns in the HSV format image in Step 2, and perform Gray code decoding to obtain the Gray code decoding order of this time; Step 5: Use the Gray code decoding order obtained in Step 4 to assist in the second unwrapping of the phase diagram obtained in the first unwrapping in Step 3, and obtain the final absolute phase through error compensation.
2. The color Gray code encoding assisted phase unwrapping method according to claim 1, wherein: The construction process of the two sets of color sinusoidal fringe patterns with different frequencies in Step 1 is as follows: Define the N-step phase shift fringe pattern: , Among them, represents the gray value of the phase-shifted fringe pattern at the pixel coordinates (u, v), where n is a positive integer representing the number of phase-shift steps, a(u, v) and b(u, v) respectively represent the background light intensity and modulation amplitude of the fringe pattern at the pixel coordinates (u, v), f0 is the fringe frequency, and the following encodings are performed on a(u, v) and b(u, v) respectively: a(u, v) = 0.6, b(u, v) = 0.4; There are two sets of phase shift fringe patterns, each set contains N images, which are N-step phase shift diagrams, a total of 2N images, corresponding to encoding 2N-bit Gray code images.
3. The color Gray code encoding-assisted phase unwrapping method according to claim 2, wherein: Perform Gray code encoding on the two sets of phase shift fringe patterns through the three RGB channels, select the two color channels of red and blue as the encoding colors, and construct a color sinusoidal fringe pattern.
4. The color Gray code encoding assisted phase unwrapping method according to claim 1, wherein: Step 2 includes the following sub-steps: Step 2.1: Project two sets of color sinusoidal fringe patterns with different frequencies into the scene to be measured by a projector, and synchronously capture the two sets of color sinusoidal fringe patterns after projection by an industrial camera. The fringe pattern of the projected image in RGB mode is expressed as: , Among them, \(c\) represents the pattern captured by the camera, \(N\) represents the number of phase-shifted patterns, which is equal to the number of phase-shifting steps of the fringe pattern, and \((u, v)\) represents the pixel coordinates. respectively represent the intensities of the RGB three channels of the fringe pattern at the pixel coordinates \((u, v)\). Step 2.2: Convert the two sets of color sinusoidal fringe patterns after projection from the RGB channel mode to the HSV channel mode, and the conversion formula for the hue angle H is: 、 , Where, H(u, v) represents the hue angle of the pixel coordinates (u, v), and θ(u, v) represents the hue angle of the pixel coordinates (u, v) when the phase is in (0, 2π).
5. The color Gray code encoding assisted phase unwrapping method according to claim 1, wherein: Step 3 includes the following sub-steps: Step 3.1: Respectively extract the red and blue regions from the projected image in HSV format according to the hue value, extract the channels of the corresponding regions from the projected image in RGB format according to the extracted red and blue regions, perform intensity normalization processing on the extracted region channels respectively, and then merge and fill them into a single-channel image. The normalization formula is as follows: , Among them, is the stripe intensity information after normalization of the stripe pattern in the red and blue regions at the pixel coordinates (u, v), l is the intensity lower limit, and h is the intensity upper limit; Step 3.2: Use the following phase shift formula to calculate the wrapped phases of the red region and the blue region in the two sets of color sinusoidal fringe patterns with different frequencies respectively: For the red region: , For the blue region: , where φ r (u, v) and φ b (u, v) refer to the wrapped phases of the pixel point coordinates (u, v) in the stripe patterns of the red and blue regions; Step 3.
3. Perform the first unwrapping on the wrapped phases of two sets of fringe patterns with different frequencies by the multi-frequency heterodyne method. The multi-frequency heterodyne calculation formula is as follows: 、 , where λ b is the frequency corresponding to the heterodyne phase Δφ, λ1 and λ2 are the phase functions corresponding to two sets of fringe patterns with different frequencies respectively, Δφ is the heterodyne phase, that is, the difference between two sets of fringe patterns with different frequencies, φ1 is the wrapped phase of the first set of fringe patterns, and φ2 is the wrapped phase of the second set of fringe patterns; Select the wrapped phase of one set of fringe patterns and perform one-time unwrapping to obtain the phase diagram after the first unwrapping.
6. The color Gray code encoding assisted phase unwrapping method according to claim 1, characterized in that: The Gray code decoding in Step 4 includes the following sub-steps: Step 4.
1. Extract the red region from the fringe pattern in HSV format through the hue channel, assign the red region a value of 1 according to the following formula, and assign the remaining parts a value of 0; , Among them, GC i (u, v) represents the Gray code encoded image obtained from the hue channel of the HSV format image at the pixel coordinates (u, v), and H(u, v) is the hue angle of the pixel coordinates (u, v) in the HSV format image; Step 4.
2. Convert the Gray code of the extracted red region into decimal encoding. The conversion formula is as follows: 、 , where B i is the i-th bit of the binary code, and GC i is the i-th bit of the Gray code encoding diagram obtained in step 4.
1. ⊕ represents the exclusive OR operation. k is the decimal number of the Gray code order, and m is the number of bits of the binary code.
7. The color Gray code encoding assisted phase unwrapping method according to claim 1, characterized in that: Step 5 includes the following processes: Step 5.
1. Use the Gray code decoding order obtained in Step 4 to assist in unwrapping the first phase unwrapping diagram in Step 3 according to the following formula, and calculate the absolute phase diagram: , Among them, Φ erros (u, v) represents the absolute phase with periodic error of the pixel coordinates (u, v), φ(u, v) represents the first phase unwrapping diagram of the pixel coordinates (u, v) obtained in step 3, and k(u, v) represents the decimal number of the Gray code order of the pixel coordinates (u, v) obtained by Gray code decoding in step 4; Step 5.
2. Perform median filtering on the absolute phase with periodic errors to obtain a phase correction template; Step 5.
3. Use the correction template to assist in the second phase unwrapping of the wrapped phase according to the following formula to compensate for the errors , Among them, Φ template represents the absolute phase after median filtering, Round(x) represents the integer closest to the distance x, Φ(u, v) represents the error-free absolute phase of the pixel coordinates (u, v), and φ(u, v) is the first phase unwrapping diagram of the pixel coordinates (u, v) obtained in step 3.
8. A three-dimensional imaging method, characterized in that: Use the fringe projection profilometry for three-dimensional imaging. During the imaging process, use the color Gray code encoding-assisted phase unwrapping method described in any one of claims 1-7 to perform the unwrapping of the wrapped phase of the projected fringe pattern.
9. A three-dimensional imaging system, characterized in that: Comprising: A visible light projection module that generates two sets of color sinusoidal fringe patterns with different frequencies and projects the fringes onto the contour of the scene to be measured; An image acquisition module that captures the two sets of color sinusoidal fringe patterns projected onto the scene to be measured; One or more processors; A memory storing one or more computer programs; Wherein, the processor receives the image data of the image acquisition module and calls the computer programs in the memory to implement the three-dimensional imaging method described in claim 8.
Citation Information
Patent Citations
Color response calibration method in colored structure light three-dimensional measurement
CN102519395A
Phase unwrapping method for color phase order coding and decoding
CN116429022A
Three-dimensional reconstruction method based on structured light image enhancement
CN119941982A
Three-dimensional reconstruction method based on structured light and binocular vision
WO2024113127A1
Cited By
Underwater high-speed three-dimensional measurement method based on stripe structured light
CN120760636A