A phase compensation method and device for sinusoidal grating projection system
The phase compensation method iteratively optimizes phase and distance estimates using a three-step phase shift method and compensation formula to correct phase errors in sinusoidal grating projection systems, improving accuracy for industrial applications.
Patent Information
- Application Number
- CN202410396995.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-03
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-04-03
AI Technical Summary
Phase shift profilometry methods face challenges in miniaturization due to high projector costs and difficulty in using industrial scenarios like pipeline endoscopes, leading to phase errors from horizontal displacement of LED-based structured light projection systems.
A phase compensation method using a three-step phase shift method to collect grayscale images from three groups of LED light sources at different positions, iteratively optimizing phase and distance estimates through a compensation formula to correct phase errors.
Enhances the accuracy of phase and distance calculations by compensating for phase errors in sinusoidal grating projection systems, making them suitable for industrial applications.
Smart Images

Figure CN118293825B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer vision, and in particular relates to a phase compensation method and device for a sinusoidal grating projection system. Background Art
[0002] Phase shift profilometry is an optical method commonly used for three-dimensional surface measurement. The basic principle of this method is to project a sinusoidal fringe pattern, which deforms the surface of the object being measured, and then use a camera to capture these deformed patterns. By changing the phase offset of the projected pattern, images at different phases can be obtained. By analyzing the phase difference between these images, the three-dimensional morphology information of the surface of the object being measured can be reconstructed. In practical applications, a projector is usually used to project a sequence of images with different phases. After phase resolution, these image sequences can obtain the phase information of each pixel, thereby deriving the distance information of the object surface.
[0003] Due to the high price and difficulty in miniaturization of projectors, the phase shift profilometry method is difficult to use in some industrial scenarios, such as pipeline endoscopes. In response to this problem, the patent application with application number CN201210249195.4 and titled "Stripe projection system for a probe with an intensity modulation element suitable for phase shift analysis" proposed a projection system that uses a sinusoidal grating as a structured light modulator and an LED array as a light source to project sinusoidal stripes of different phases by sequentially lighting up LEDs at different positions, thereby replacing the projector. However, in this system, since the position of the LED lit when projecting each sinusoidal stripe is different, it is equivalent to the structured light projection source undergoing a horizontal displacement while changing the projection phase, which will cause phase errors. Summary of the invention
[0004] In order to solve the above problems existing in the prior art, the present invention provides a phase compensation method and device for a sinusoidal grating projection system. The technical problem to be solved by the present invention is achieved by the following technical solutions:
[0005] A phase compensation method for a sinusoidal grating projection system, comprising:
[0006] Respectively collect grayscale images projected by three groups of light sources at different positions through gratings to a preset position, so as to obtain three pixel grayscale values at the preset position according to the grayscale images;
[0007] Calculating an initial phase estimation value using a three-step phase shift method according to the pixel grayscale value, and obtaining an initial distance estimation value according to the initial phase estimation value;
[0008] The initial phase estimation value and the initial distance estimation value are iteratively estimated according to a preset compensation formula to obtain an optimized phase estimation value and an optimized distance estimation value, and when the difference between the two optimized phase estimation values is less than a preset threshold, the difference is used as a compensation value, and the optimized phase estimation value is used as a phase value to achieve phase compensation.
[0009] In a specific embodiment, the light source is an LED light source, and the positions of the three groups of light sources are distributed along the same straight line, and the same straight line is parallel to the grating and the projection plane of the preset position.
[0010] In a specific embodiment, the distances between two adjacent groups of light sources are equal.
[0011] In a specific embodiment, the distance between the two adjacent groups of light sources is in a preset ratio to the length of each period of the grating.
[0012] In a specific implementation, the preset compensation formula is:
[0013]
[0014] in, d2 is the vertical distance from the light source to the grating, is the initial distance estimate, To optimize the phase estimation value, I1, I2, and I3 are the pixel grayscale values of the grayscale images projected to the preset positions by the three groups of light sources through the grating.
[0015] The present invention also provides a phase compensation device for a sinusoidal grating projection system, comprising:
[0016] An image acquisition module, used to respectively acquire grayscale images projected by three groups of light sources at different positions through a grating to a preset position, so as to obtain three pixel grayscale values at the preset position according to the grayscale images;
[0017] An initialization module, used to calculate an initial phase estimation value using a three-step phase shift method according to the pixel grayscale value, and obtain an initial distance estimation value according to the initial phase estimation value;
[0018] The iterative compensation module is used to iteratively estimate the initial phase estimation value and the initial distance estimation value according to a preset compensation formula to obtain an optimized phase estimation value and an optimized distance estimation value, and when the difference between the two optimized phase estimation values is less than a preset threshold, the difference is used as a compensation value, and the optimized phase estimation value is used as a phase value to achieve phase compensation.
[0019] In a specific embodiment, the light source is an LED light source, and the positions of the three groups of light sources are distributed along the same straight line, and the same straight line is parallel to the grating and the projection plane of the preset position.
[0020] In a specific embodiment, the distances between two adjacent groups of light sources are equal.
[0021] In a specific embodiment, the distance between the two adjacent groups of light sources is in a preset ratio to the length of each period of the grating.
[0022] In a specific implementation, the preset compensation formula is:
[0023]
[0024] in, d2 is the vertical distance from the light source to the grating, is the initial distance estimate, To optimize the phase estimation value, I1, I2, and I3 are the pixel grayscale values of the grayscale images projected to the preset positions by the three groups of light sources through the grating.
[0025] Beneficial effects of the present invention:
[0026] The present invention provides a phase compensation method for a sinusoidal grating projection system, which collects grayscale images of three groups of light sources at different positions projected to a preset position through a grating, respectively, so as to obtain three pixel grayscale values of the preset position according to the grayscale image; calculates an initial phase estimate value according to the pixel grayscale value using a three-step phase shift method, and obtains an initial distance estimate value according to the initial phase estimate value; iteratively estimates the initial phase estimate value and the initial distance estimate value according to a preset compensation formula to obtain an optimized phase estimate value and an optimized distance estimate value, and when the difference between the two optimized phase estimates is less than a preset threshold, the difference is used as a compensation value, and the optimized phase estimate value is used as a phase value to achieve phase compensation. The above method calculates the initial phase estimate value and the initial distance estimate value using the three-step phase shift method, and optimizes the initial phase estimate value and the initial distance estimate value in turn using an iterative optimization method, thereby compensating for the phase error of the sinusoidal grating projection system, thereby making the calculation of phase and distance more accurate.
[0027] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a schematic diagram of the optical path used in a sinusoidal grating projection system to project sinusoidal fringes onto an object;
[0029] Figure 2 It is a flow chart of a phase compensation method for a sinusoidal grating projection system provided by an embodiment of the present invention;
[0030] Figure 3It is a schematic diagram of a phase compensation device module for a sinusoidal grating projection system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.
[0032] Embodiment 1
[0033] In order to more clearly explain the embodiments of the present invention, the applicant first explains the defect generation process of the prior art, which is obtained by reverse calculation after the applicant discovers the technical defects. Figure 1 , Figure 1 This is a schematic diagram of the optical path used to project sinusoidal stripes onto an object in a sinusoidal grating projection system. The grating G represents the structured light modulator in the sinusoidal grating projection system, that is, the sinusoidal grating (top view). Taking the three-step phase shift as an example, O1, O2, and O3 represent three groups of LED light sources respectively. By lighting O1, O2, and O3 in sequence, three sinusoidal stripes with different phases can be projected onto object T. Taking point Q on object T as an example, the light emitted by O1 is modulated by grating G along ray O1Q and hits Q. Assuming that the intensity of the modulated light corresponds to the phase P1=φ, and the length of each period on grating G is p, it can be seen that the intensity of the light emitted by O2 hitting Q corresponds to the phase and so Where D1 is the distance from the intersection of O1Q on grating G to Q, and D2 is the distance from the intersection of O1Q on grating G to O1. According to the assumption of the phase shift method, in the case of three-step phase shift, if Then P2 should be equal to therefore The value should be However, L1 and p are the LED spacing and the length of each period on the grating G, which are fixed values. The value of varies with the distance of the object T from the grating, so it cannot be guaranteed The value of It can be seen that no matter what the value of L1,p is, it cannot be guaranteed Therefore, the phase of the sinusoidal fringes projected by the sinusoidal grating projection system has an error related to the object distance, and the phase calculated directly using the phase shift method is inaccurate.
[0034] Please continue to see Figure 2 , Figure 2 1 is a flow chart of a phase compensation method for a sinusoidal grating projection system provided by an embodiment of the present invention, comprising:
[0035] S1, respectively collecting grayscale images of three groups of light sources at different positions projected to a preset position through a grating, so as to obtain three pixel grayscale values of the preset position according to the grayscale images;
[0036] Before grayscale image acquisition, it is necessary to Figure 1 Set up the environment. Assume that the modulated light intensity corresponds to the phase P1 = φ. Then we know that the light intensity of the light emitted by O2 hitting Q corresponds to the phase and so Where D1 is the distance from the intersection of O1Q on grating G to Q, and D2 is the distance from the intersection of O1Q on grating G to O1. It can also be seen that the phase of the light emitted by O3 hitting Q corresponds to the phase exist When the three LEDs are turned on, the grayscale images formed by the sinusoidal stripes projected onto the object are captured respectively. This process requires that the positions of the three groups of light sources are distributed along the same straight line, the same straight line is parallel to the grating and the projection surface of the preset position, and the distances between two adjacent groups of light sources are equal, and the distances between two adjacent groups of light sources are in a preset ratio (e.g., 1:3) to the length of each period of the grating.
[0037] It can be further known that the pixel grayscale values corresponding to point Q on the object in the three grayscale images are as follows:
[0038] I1=a·cos(P1)+b=a·cos(φ)+b,
[0039]
[0040] Among them, a is the reflection coefficient of point Q on the object to the structured light, and b is the brightness of the ambient light.
[0041] S2, calculating an initial phase estimation value using a three-step phase shift method according to the pixel grayscale value, and obtaining an initial distance estimation value according to the initial phase estimation value;
[0042] Specifically, the phase calculation formula is: Then through φ 0 And the camera and projector internal parameters K cam ,K proj , distortion coefficient D cam ,D proj , the external parameter T between the camera and the projector cp Calculate the three-dimensional coordinates of point Q in the camera coordinate system And according to T cp Transform to the projector coordinate system The distance d1 from the Q point to the grating is obtained. It should be noted that the calculation process of the three-step phase shift method is a prior art and will not be described in detail here.
[0043] S3. Iteratively estimate the initial phase estimation value and the initial distance estimation value according to a preset compensation formula to obtain an optimized phase estimation value and an optimized distance estimation value, and when the difference between the two optimized phase estimation values is less than a preset threshold, use the difference as a compensation value, and use the optimized phase estimation value as a phase value to achieve phase compensation.
[0044] In order to achieve iterative optimization, this embodiment first deforms and simplifies the calculation formula of the pixel grayscale value corresponding to the Q point on the object of the three grayscale images, and obtains:
[0045]
[0046]
[0047]
[0048] in,
[0049] Will Expanding, we get:
[0050]
[0051]
[0052]
[0053] In order to eliminate b, the following calculation is performed:
[0054]
[0055]
[0056] Divide the above two equations and eliminate a:
[0057]
[0058] Then we can obtain:
[0059]
[0060]
[0061] because According to Get the right A more precise estimate of:
[0062]
[0063] From the above derivation, we can know that in this formula, d2 is the vertical distance from the light source to the grating, is the initial distance estimate, φ 1 To optimize the phase estimation value, I1, I2, and I3 are the pixel grayscale values of the grayscale images projected to the preset positions by the three groups of light sources through the grating.
[0064] That is to say, the above formula has introduced the iteration variable, so that the value after each iteration is closer to the ideal value. In practical applications, it is only necessary to set the corresponding iteration stop strategy according to the accuracy requirements of the specific application scenario. For example, in this implementation, the gradual iterative optimization of d1 and The estimates of After that, by comparing the difference between the two optimized phase estimates before and after (i.e., comparing φ n-1 With φ n The difference between the phase estimate and the phase difference) is less than the preset threshold t. If so, the iteration is stopped and the distance estimation value corresponding to the phase estimation value is calculated. If not, the iteration is continued until the stopping requirement is met. The size of the specific preset threshold t reflects the accuracy requirement.
[0065] A phase compensation method for a sinusoidal grating projection system in this embodiment uses a three-step phase shift method to calculate an initial phase estimation value and an initial distance estimation value, and uses an iterative optimization method to optimize the initial phase estimation value and the initial distance estimation value in turn, thereby compensating for the phase error of the sinusoidal grating projection system, thereby making the calculation of phase and distance more accurate.
[0066] The present invention also provides a phase compensation device for a sinusoidal grating projection system, see Figure 3 ,include:
[0067] An image acquisition module 1 is used to respectively acquire grayscale images of three groups of light sources at different positions projected to a preset position through a grating, so as to obtain three pixel grayscale values at the preset position according to the grayscale images;
[0068] Initialization module 2, used to calculate an initial phase estimation value according to the pixel gray value by using a three-step phase shift method, and obtain an initial distance estimation value according to the initial phase estimation value;
[0069] The iterative compensation module 3 is used to iteratively estimate the initial phase estimation value and the initial distance estimation value according to a preset compensation formula to obtain an optimized phase estimation value and an optimized distance estimation value, and when the difference between the two optimized phase estimation values is less than a preset threshold, the difference is used as a compensation value, and the optimized phase estimation value is used as a phase value to achieve phase compensation.
[0070] In a specific embodiment, the light source is an LED light source, and the positions of the three groups of light sources are distributed along the same straight line, and the same straight line is parallel to the grating and the projection plane of the preset position.
[0071] In a specific embodiment, the distances between two adjacent groups of light sources are equal.
[0072] In a specific embodiment, the distance between the two adjacent groups of light sources is in a preset ratio to the length of each period of the grating.
[0073] In a specific implementation, the preset compensation formula is:
[0074]
[0075] in, d2 is the vertical distance from the light source to the grating, is the initial distance estimate, φ 1 To optimize the phase estimation value, I1, I2, and I3 are the pixel grayscale values of the grayscale images projected to the preset positions by the three groups of light sources through the grating.
[0076] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification.
[0077] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in a claim. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0078] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A phase compensation method for a sinusoidal grating projection system, characterized in that: include: Respectively collect grayscale images projected by three groups of light sources at different positions through gratings to a preset position, so as to obtain three pixel grayscale values at the preset position according to the grayscale images; Calculating an initial phase estimation value using a three-step phase shift method according to the pixel grayscale value, and obtaining an initial distance estimation value according to the initial phase estimation value; The initial phase estimation value and the initial distance estimation value are iteratively estimated according to a preset compensation formula to obtain an optimized phase estimation value and an optimized distance estimation value, and when the difference between the two optimized phase estimation values is less than a preset threshold, the difference is used as a compensation value, and the optimized phase estimation value is used as a phase value to achieve phase compensation; the positions of the three groups of light sources are distributed along the same straight line, and the same straight line is parallel to the grating and the projection surface of the preset position; the distances between the two adjacent groups of light sources are equal; the distances between the two adjacent groups of light sources are in a preset ratio to the length of each period of the grating; The preset compensation formula is: in, d2 is the vertical distance from the light source to the grating, is the initial distance estimate, To optimize the phase estimation value, I1, I2, and I3 are the pixel grayscale values of the grayscale images projected to the preset positions by the three groups of light sources through the grating.
2. The phase compensation method for a sinusoidal grating projection system according to claim 1, characterized in that: The light source is an LED light source.
3. A phase compensation device for a sinusoidal grating projection system, characterized in that: include: An image acquisition module, used to respectively acquire grayscale images projected by three groups of light sources at different positions through a grating to a preset position, so as to obtain three pixel grayscale values at the preset position according to the grayscale images; An initialization module, used to calculate an initial phase estimation value using a three-step phase shift method according to the pixel grayscale value, and obtain an initial distance estimation value according to the initial phase estimation value; An iterative compensation module, used for iteratively estimating the initial phase estimation value and the initial distance estimation value according to a preset compensation formula to obtain an optimized phase estimation value and an optimized distance estimation value, and when the difference between the two optimized phase estimation values is less than a preset threshold, the difference is used as a compensation value, and the optimized phase estimation value is used as a phase value to achieve phase compensation; the positions of the three groups of light sources are distributed along the same straight line, and the same straight line is parallel to the grating and the projection surface of the preset position; the distances between the two adjacent groups of light sources are equal; the distances between the two adjacent groups of light sources are in a preset ratio to the length of each period of the grating; The preset compensation formula is: in, d2 is the vertical distance from the light source to the grating, is the initial distance estimate, To optimize the phase estimation value, I1, I2, and I3 are the pixel grayscale values of the grayscale images projected to the preset positions by the three groups of light sources through the grating.
4. The phase compensation device for a sinusoidal grating projection system according to claim 3, characterized in that: The light source is an LED light source.
