A high-quality binary fringe generation method based on 2+1 phase shift algorithm
High-quality binary fringes were generated by an improved 2+1 phase shift algorithm. By utilizing Bayer jitter and a comprehensive optimization method, the DC component error problem was solved, thereby improving the measurement accuracy and speed of structured light 3D reconstruction.
Patent Information
- Application Number
- CN202411877357.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-12-19
AI Technical Summary
In the existing technology, DC component errors during binary fringe generation limit measurement accuracy and speed, and the technology is highly sensitive to motion fuzziness.
An initial binary sinusoidal fringe pattern is generated using a 2+1 phase shift algorithm and the Bayer dithering method. The patch pattern is then optimized by combining pre-intensity optimization, comprehensive optimization, and Gaussian filtering to reduce DC component error and improve phase quality.
It effectively reduces DC component error, improves the accuracy and speed of the measurement system, reduces errors caused by motion fuzziness, and enhances the optimization efficiency of fringe patterns.
Smart Images

Figure CN119741428B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of structured light three-dimensional reconstruction, and particularly relates to extraction of high-quality binary fringe under defocusing technology. TECHNICAL BACKGROUND
[0002] Structured light three-dimensional reconstruction technology is a non-contact optical three-dimensional measurement technology, and binary defocusing technology can improve measurement speed and accuracy, and eliminate nonlinear errors of a projector. In an improved 2+1 phase shift algorithm, only two sinusoidal patterns with phase shifts of π / 2 and a uniform gray scale pattern are needed, and compared with a common three-step phase shift algorithm, the sensitivity of the uniform gray scale image to motion blur is much lower than that of a grating pattern, so that measurement errors caused by object motion can be effectively reduced. However, the direct current component of the binary sinusoidal fringe pattern after defocusing is different from the gray scale value of the uniform gray scale pattern, causing a direct current component error. SUMMARY
[0003] In order to solve the problems in the prior art, a high-quality binary fringe generation method based on a 2+1 phase shift algorithm is provided, so as to reduce measurement errors caused by the direct current component, to obtain better phase quality under different defocusing degrees, and to improve the performance of a measurement system.
[0004] The technical scheme adopted by the present application to solve the technical problem is:
[0005] The high-quality binary fringe generation method based on the 2+1 phase shift algorithm has the characteristics that it comprises the following steps:
[0006] Step 1, performing Bayer dithering on a standard sinusoidal fringe pattern by using a Bayer dithering method to obtain an initial binary sinusoidal fringe pattern; according to the periodicity of the sinusoidal fringe pattern, part of the initial binary sinusoidal fringe pattern is intercepted as a patch A, and the column period of the patch A is the number of periods of the sinusoidal fringe pattern, and the row period is 2;
[0007] Step 2, performing pre-intensity optimization on the patch A to obtain a patch B;
[0008] Step 3, performing comprehensive optimization on the patch B to obtain a patch C;
[0009] Step 4, increasing the row period of the patch A by one pixel to change the size of the patch A, and judging whether the row period of the patch A exceeds a maximum value Max, if yes, Max different sizes of the patch C are obtained; otherwise, returning to step 2 for sequential execution;
[0010] Step 5, calculating the phase values of the binary fringe patterns respectively formed by the Max patches C under different defocus degrees, and selecting the patch with the minimum root mean square error as the optimal patch, so as to tile the optimal patch into a complete fringe pattern, that is, a high-quality binary fringe pattern.
[0011] The high-quality binary fringe generation method based on the 2+1 phase shift algorithm has the characteristics that step 2 comprises the following steps.
[0012] Step 2.1, sequentially mutating each pixel point in patch A, and tiling patch A after each mutation to obtain a first binary update pattern after one mutation;
[0013] Step 2.2, performing Gaussian filtering on the first binary update pattern after mutation of the current pixel point to obtain a filtered pattern as shown in formula (1) :
[0014] (1)
[0015] In formula (1), represents the gray value of the pixel in the position of the filtered pattern ; represents the frequency of the pattern ; represents the direct current component at ; represents the amplitude at ; represents the amplitude at ; represents the amplitude at ;
[0016] Step 2.3, calculating the intensity root mean square error between the standard sinusoidal fringe pattern corresponding to and , and comparing it with the intensity root mean square error between the pattern after mutation and filtering of the last pixel point and the standard sinusoidal fringe pattern corresponding thereto, if the error is reduced, the current pixel point after mutation is retained, otherwise, the current pixel point before mutation is retained, thereby completing one round of mutation.
[0017] Step 2.4, performing several rounds of mutation according to the processes of step 2.1-step 2.3 until the intensity root mean square error no longer changes, thereby taking the finally mutated patch A as patch B.
[0018] Further, step 3 comprises the following steps:
[0019] Step 3.1, sequentially mutating each pixel point in patch B, and tiling patch B after each mutation to obtain a first binary update pattern after one mutation having the second and third binary update patterns of the phase difference of the current pixel point mutation;
[0020] Step 3.2, Gaussian filtering is performed on the second and third binary update patterns of the phase difference of the current pixel point mutation respectively, to obtain the Gaussian filtered second and third binary update patterns and Gaussian filtered third binary update patterns ; the computer-generated white light pattern is denoted as , so that a complete set of patterns of the current pixel point mutation is obtained by using formula (2):
[0021] (2)
[0022] In formula (2), represents the gray value at ; represents the gray value in at position; represents the gray value in at position; represents the gray value in at
[0023] position.
[0024] (3)
[0025] In formula (3), N and M represent the length and width of respectively; is the standard sinusoidal fringe pattern corresponding to .
[0026] Step 3.4, the local intensity optimization index for evaluating the local structural similarity between and the standard sinusoidal fringe pattern is calculated.
[0027] Step 3.5, the phase of is calculated by using formula (11), so that the phase root mean square error of is obtained by using formula (11):
[0028] (11)
[0029] In formula (11), denotes the phase of the standard sinusoidal fringe pattern
[0030] (12)
[0031] In formula (12), denotes the phase value of the standard sinusoidal fringe pattern
[0032] Step 3.6, the direct current component of is calculated according to formula (13) so that the root mean square error of the direct current component of is obtained by using formula (13)
[0033] (13)
[0034] In formula (13), denotes the complementary pattern of denotes the direct current component of
[0035] (14)
[0036] Step 3.7, the comprehensive optimization target function is constructed according to formula (15)
[0037] (15)
[0038] In formula (15), , , , and are five weight factors, and the value range of each weight factor is [0, 1];
[0039] Step 3.8, the target function of a complete pattern after mutation of the current pixel point is calculated, and compared with the target function of a complete pattern after mutation of the last pixel point. If the target function is reduced, the current pixel point after mutation is retained. Otherwise, the current pixel point before mutation is retained. Thus, one round of mutation is completed.
[0040] Step 3.9, a number of rounds of mutation are performed according to the process of step 3.1-step 3.8 until the target function no longer changes, so that the final mutated patch B is taken as patch C.
[0041] Further, step 3.4 includes the following steps:
[0042] Step 3.4.1, formula (4) is used to calculate between brightness functions :
[0043] (4)
[0044] In formula (4), denotes the average intensity of the pixels of the image and is obtained from formula (5), denotes the average intensity of the pixels of the image ; denotes a first parameter;
[0045] (5)
[0046] In formula (5), denotes the grey value of the i-th pixel of the image ; denotes the total number of pixels of the image ;
[0047] Step 3.4.2, the contrast function between and is calculated using formula (6) :
[0048] (6)
[0049] In formula (6), denotes a second parameter, denotes the standard deviation of the intensity of the image and is obtained from formula (7); denotes the standard deviation of the intensity of the image ;
[0050] (7)
[0051] Step 3.4.3, the structure function between and is calculated using formula (8) :
[0052] (8)
[0053] In formula (8), denotes a third parameter, denotes the intensity covariance of the image and and is obtained from formula (9):
[0054] (9)
[0055] In formula (9), I represents the intensity of the pixel point of the 2+1 phase shift algorithm, and represents the intensity of the pixel point of the 2+1 phase shift algorithm. represents the intensity of the pixel point of the 2+1 phase shift algorithm; represents the intensity of the pixel point of the 2+1 phase shift algorithm; represents the intensity of the pixel point of the 2+1 phase shift algorithm;
[0056] Step 3.4.4, calculating the local intensity optimization index between formula (10) and the standard sinusoidal fringe pattern Step 3.4.4, calculating the local intensity optimization index between formula (10) and the standard sinusoidal fringe pattern :
[0057] (10)
[0058] In formula (10), I represents the intensity of the pixel point of the 2+1 phase shift algorithm, and represents the intensity of the pixel point of the 2+1 phase shift algorithm. represents the intensity of the pixel point of the 2+1 phase shift algorithm; represents the intensity of the pixel point of the 2+1 phase shift algorithm; represents the intensity of the pixel point of the 2+1 phase shift algorithm; represents the intensity of the pixel point of the 2+1 phase shift algorithm. The electronic device of the present application comprises a memory and a processor, and the memory is used for storing a program supporting the processor to execute the generation method, and the processor is configured to execute the program stored in the memory.
[0059] The computer readable storage medium of the present application stores a computer program, and when the computer program is run by a processor, the steps of the generation method are executed.
[0060] Compared with the prior art, the beneficial effects of the present application are reflected in:
[0061] 1. The original 2+1 phase shift algorithm is modified, which is more conducive to optimizing the binary fringe pattern and improving the optimization efficiency of the fringe pattern.
[0062] 2. A direct current optimization method is designed, which can effectively reduce the error caused by the direct current component, thereby improving the measurement accuracy.
[0063] 3. A comprehensive optimization method combining intensity, phase and direct current is designed, which can reduce the direct current error while ensuring that the fringe pattern can maintain a good state in structure and phase, thereby effectively improving the performance of the measurement system. BRIEF DESCRIPTION OF DRAWINGS
[0064] The flowchart of the present application;
[0065] Figure 1 The flowchart of the present application;
[0066] The flowchart of the present application; Figure 2 The flowchart of the present application;
[0067] Figure 3 A quality comparison chart of the binary sinusoidal fringe pattern of the present application. DETAILED DESCRIPTION
[0068] In this embodiment, a high-quality binary fringe generation method based on a 2+1 phase shift algorithm, as shown in the formula (1), includes the following steps: Figure 1
[0069] Step 1, using the Bayer dithering method to dither the standard sinusoidal fringe pattern, the Bayer dithering technology compares the original image with the two-dimensional threshold grid of the Bayer kernel, and then quantizes the original image according to the corresponding pixels in the Bayer kernel. Obtain the initial binary sinusoidal fringe pattern; cut part of the initial binary sinusoidal fringe pattern as patch A, and the column period of the patch A is the period number of the sinusoidal fringe pattern, and the row period is 2.
[0070] Step 2, pre-intensity optimization is performed on the patch A to obtain patch B;
[0071] Step 2.1, mutate (from 0 to 1, or 1 to 0) each pixel point in patch A in turn, and after tiling each time mutation patch A, obtain the first binary update pattern after mutation;
[0072] Step 2.2, Gaussian filtering (filter size is 5x5, standard deviation is 5 / 3 pixels) is performed on the first binary update pattern after mutation of the current pixel point, to obtain the filtered pattern as shown in formula (1) :
[0073] (1)
[0074] In formula (1): represents the gray value of the filtered pattern at the position; represents the frequency of the pattern ; represents the direct current component of at ; represents the amplitude of at .
[0075] Step 2.3, calculate the intensity root mean square error between the corresponding standard sinusoidal fringe pattern of and , and compare it with the intensity root mean square error between the pattern after mutation and filtering of the last pixel point and its corresponding standard sinusoidal fringe pattern, if the error is reduced, the current pixel point after mutation is retained; otherwise, the current pixel point before mutation is retained; thereby completing a round of mutation.
[0076] Step 2.4. Perform several rounds of mutation according to the process of Step 2.1-Step 2.3 until the root mean square error of intensity no longer changes, thereby taking the final mutated patch A as patch B.
[0077] Step 3. Perform comprehensive optimization on patch B to obtain patch C;
[0078] Step 3.1. Mutate each pixel point in patch B in turn (from 0 to 1, or 1 to 0), and after each mutation, tile the patch B periodically to obtain a second binary update pattern and a third binary update pattern with a phase difference of ;
[0079] Step 3.2. Perform Gaussian filtering (filter size 5x5, standard deviation 5 / 3 pixels) on the second binary update pattern and the third binary update pattern after mutation of the current pixel point to obtain a Gaussian filtered second binary update pattern and a Gaussian filtered third binary update pattern ; denote the computer-generated white light pattern as , thereby obtaining a complete set of patterns after mutation of the current pixel point using formula (2):
[0080] (2)
[0081] In formula (2): represents the gray value at ; represents the gray value at ; represents the gray value at ; represents the gray value at ; represents the gray value at ; represents the gray value at ; this set of expressions makes a few changes to the original 2+1 phase shift algorithm, so that only and need to be optimized, reducing the optimization time and the complexity of the optimization operation. Step 3.3. Calculate the global root mean square error of intensity according to formula (3):
[0082]
[0083] (3)
[0084] In formula (3): N and M represent the length and width of , respectively; is the gray value of a corresponding standard sinusoidal fringe pattern;
[0085] Step 3.4, calculating a local intensity optimization index of local structural similarity between the binary sinusoidal fringe pattern and its standard sinusoidal fringe pattern, including a brightness function, a contrast function and a structure function; in the intensity domain, the index can evaluate the local structural similarity between the defocused binary sinusoidal fringe pattern and its standard sinusoidal fringe pattern, thereby more comprehensively optimizing the binary sinusoidal fringe pattern; and its standard sinusoidal fringe pattern Step 3.4.1, calculating a brightness function between and
[0086] using formula (4) : :
[0087] (4)
[0088] In formula (4), represents the average intensity of , and is obtained by formula (5), represents the average intensity of ; represents the first parameter, which is 1 here;
[0089] (5)
[0090] In formula (5), represents the gray value of the pixel point of ; represents the total number of pixel points of .
[0091] Step 3.4.2, calculating a contrast function between and using formula (6) :
[0092] (6)
[0093] In formula (6), represents the second parameter, which is 1 here; represents the intensity standard deviation of , and is obtained by formula (7); represents the intensity standard deviation of ;
[0094] (7)
[0095] Step 3.4.3, calculating a structure function between and between the structure functions
[0096] (8)
[0097] In formula (8) : is the third parameter, which is taken as 1 here, is the intensity of the and , and is obtained from formula (9) :
[0098] (9)
[0099] In formula (9) : is the gray value of the pixel point of the .
[0100] Step 3.4.4, calculate the local intensity optimization index between and its standard sinusoidal fringe pattern using formula (10) :
[0101] (10)
[0102] In formula (10) : is the weighted value of the , which is taken as 1 here; is the weighted value of the , which is taken as 1 here; is the weighted value of the , which is taken as 1 here.
[0103] Step 3.5, calculate the phase of using formula (11) : so as to obtain the phase root mean square error of
[0104] (11)
[0105] In formula (11) : is the phase of ;
[0106] Compared with the original phase extraction formula of 2+1 phase shift algorithm, the formula here is changed a little, making the optimization process more concise;
[0107] (12)
[0108] In formula (12) : is the standard sinusoidal fringe pattern The phase value.
[0109] Step 3.6, calculate according to formula (13) DC component Thus, by using equation (14) to obtain Root mean square error of DC component :
[0110] (13)
[0111] In equation (13): express Complementary patterns; express DC component;
[0112] (14)
[0113] Step 3.7: Construct the comprehensive optimization objective function according to equation (15). :
[0114] (15)
[0115] In equation (15), , , , and All have 5 weighting factors, and the value range of each weighting factor is [0,1].
[0116] Step 3.8: Calculate the objective function of a complete pattern after the current pixel mutates, and compare it with the objective function of a complete pattern after the previous pixel mutates. If the objective function decreases, retain the current pixel after the mutation; otherwise, retain the current pixel before the mutation; thus completing one round of mutation.
[0117] Step 3.9: Perform several rounds of mutation according to the process of steps 3.1-3.8 until the objective function no longer changes, and then use the final mutated patch B as patch C; the optimization purpose is to make the defocused binary sinusoidal fringe pattern more sinusoidal; this objective function can solve the problem to the greatest extent and improve the quality of the binary sinusoidal fringe pattern.
[0118] Step 4: Increase the row period of patch A by one pixel to change the size of patch A, and determine whether the number of row periods of patch A exceeds the maximum value Max. If it does, it means that Max patches of different sizes are obtained; otherwise, return to step 2 and execute sequentially.
[0119] Step 5, calculate the phase values of the binary fringe patterns respectively composed of the Max patches C under different defocus degrees, and select the patch with the minimum root mean square error as the optimal patch, so as to tile the optimal patch into a complete fringe pattern, that is, a high-quality binary fringe pattern, as shown in Figure 2 ;
[0120] Step 6, in this embodiment, simulation experiments are performed using sinusoidal fringe patterns with periods T of 16, 48, 64 and 100 pixels, as shown in Figure 3 . Different sizes of filters are applied to realize different degrees of defocus, the filter size G is 5-15, and the standard deviation is ; wherein, G=5 represents the minimum defocus degree, G=15 represents the maximum defocus degree; and two other classical optimization algorithms (intensity optimization and phase optimization) are used for comparison, it can be seen from Figure 3 that the method has certain superiority.
[0121] In this embodiment, an electronic device includes a memory and a processor, the memory is used to store a program supporting the processor to execute the above method, and the processor is configured to execute the program stored in the memory.
[0122] In this embodiment, a computer readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to perform the steps of the above method.
Claims
1. A method for generating high-quality binary fringes based on a 2+1 phase shift algorithm, characterized in that, Includes the following steps: Step 1: Perform Bayer jitter on the standard sinusoidal fringe pattern to obtain an initial binary sinusoidal fringe pattern; based on the periodicity of the sinusoidal fringe pattern, extract a portion of the pattern from the initial binary sinusoidal fringe pattern as patch A, wherein the column period of patch A is the number of periods of the sinusoidal fringe pattern, and the row period is 2. Step 2: Perform pre-strength optimization on patch A to obtain patch B; Step 3: Perform comprehensive optimization on patch B to obtain patch C; Step 3.1: Sequentially mutate each pixel in patch B, and periodically tile patch B after each mutation to obtain a patch with... The second and third binary update patterns of the phase difference; Step 3.2: Apply Gaussian filtering to the second and third binary update patterns after the current pixel point mutation, respectively, to obtain the second binary update pattern after Gaussian filtering. The third binary update pattern after Gaussian filtering The computer-generated white light pattern is denoted as... Thus, using equation (2), a complete pattern after the mutation of the current pixel is obtained: (2) In formula (2): express exist place Grayscale value; express In the middle The grayscale value of the location; express In the middle The grayscale value of the location; express In the middle The grayscale value of the location; Step 3.3: Calculate the global root mean square error of intensity according to formula (3). : (3) In equation (3): N and M represent respectively Length and width; Is with The corresponding standard sine stripe pattern; Step 3.4: Calculate for evaluation and its standard sine stripe pattern Local strength optimization index of local structural similarity between ; Step 3.4 includes the following steps: Step 3.4.1: Calculate using equation (4) and brightness function between : (4) In equation (4), express The average strength is obtained from equation (5). express The average strength; Indicates the first parameter; (5) In equation (5), express The The grayscale value of each pixel; express The total number of pixels; Step 3.4.2: Calculate using equation (6) and Contrast function between : (6) In equation (6), Indicates the second parameter. express The strength standard deviation is obtained from equation (7); Indicate The standard deviation of strength; (7) Step 3.4.3: Calculate using equation (8) and Structure functions between : (8) In equation (8): Indicates the third parameter. express and The intensity covariance is obtained from equation (9): (9) In equation (9): express The The grayscale value of each pixel; Step 3.4.4: Calculate using equation (10) and its standard sine stripe pattern Local intensity optimization index : (10) In formula (10): express The weighted value; express The weighted value; express The weighted value; Step 3.5: Calculate using equation (11) phase Thus, by using equation (11) to obtain Root mean square error of phase : (11) In equation (11), express The phase; (12) In equation (12): Standard sine stripe pattern The phase value; Step 3.6, calculate according to formula (13) DC component Thus, by using equation (13) to obtain Root mean square error of DC component : (13) In equation (13): express Complementary patterns; express DC component; (14) Step 3.7: Construct the comprehensive optimization objective function according to equation (15). : (15) In equation (15), , , , and All have 5 weighting factors, and the value range of each weighting factor is [0,1]. Step 3.8: Calculate the objective function of a complete pattern after the current pixel mutates, and compare it with the objective function of a complete pattern after the previous pixel mutates. If the objective function decreases, retain the current pixel after the mutation; otherwise, retain the current pixel before the mutation; thus completing one round of mutation. Step 3.9: Perform several rounds of mutation according to the process of steps 3.1-3.8 until the objective function no longer changes, and then use the final mutated patch B as patch C; Step 4: Increase the row period of patch A by one pixel to change the size of patch A, and determine whether the number of row periods of patch A exceeds the maximum value Max. If it does, it means that Max patches C of different sizes are obtained; otherwise, return to step 2 and execute sequentially. Step 5: Calculate the phase value of the binary fringe pattern formed by Max patches C under different defocus levels, and select the patch with the smallest root mean square error as the optimal patch, so as to lay the optimal patch into a complete fringe pattern, which is a high-quality binary fringe pattern.
2. The method for generating high-quality binary fringes based on the 2+1 phase shift algorithm according to claim 1, characterized in that, Step 2 includes the following steps: Step 2.1: Perform mutation on each pixel in patch A in sequence, and periodically tile patch A after each mutation to obtain the first binary update pattern after one mutation. Step 2.2: Apply Gaussian filtering to the first binary update pattern after the current pixel point mutation to obtain the filtered pattern as shown in equation (1). : (1) In formula (1): Represents the filtered pattern In the middle The grayscale value of the location; Representing patterns The frequency; express exist DC component at that point, express exist Amplitude at that point; Step 2.3, Calculation and The root mean square error of the intensity between the corresponding standard sinusoidal fringe patterns is compared with the root mean square error of the intensity between the pattern after the previous pixel abruptly change and filtering and its corresponding standard sinusoidal fringe pattern. If the error decreases, the current pixel after the abrupt change is retained; otherwise, the current pixel before the abrupt change is retained; thus completing one round of abrupt change. Step 2.4: Perform several rounds of mutation according to the process of Steps 2.1-2.3 until the root mean square error of the strength no longer changes, and then use the final mutated patch A as patch B.
3. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing any of the generation methods of claims 1-2, the processor being configured to execute the program stored in the memory.
4. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the steps of any of the generation methods described in claims 1-2.
Citation Information
Patent Citations
High-quality binary stripe generation method based on multi-objective optimization jitter algorithm
CN111141232A
Three-dimensional fingerprint method based on unsupervised super-resolution
CN116721212A