A high-speed structured light three-dimensional reconstruction method based on speckle-phase shift composite coding
By employing a speckle-phase-shift composite coding method, combined with a multi-feature joint matching similarity function and sub-pixel-level fitting, the problem of large number of encoded images and low matching efficiency in existing binocular structured light 3D reconstruction is solved, achieving efficient and robust 3D reconstruction results.
Patent Information
- Application Number
- CN202611235669.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-11-24
AI Technical Summary
Existing binocular structured light 3D reconstruction methods suffer from problems such as a large number of encoded images, low matching efficiency, and poor robustness. They are particularly prone to mismatches and reconstruction distortions in complex curved surfaces and weak texture scenes.
A speckle-phase-shift composite coding method is adopted. By projecting random speckle patterns and N-step phase-shift sinusoidal stripe patterns, and combining the zero-mean normalized cross-correlation similarity of the left and right speckle images, an initial matching is performed. A multi-feature joint matching similarity function is constructed, the candidate matching search interval is adaptively adjusted, and sub-pixel-level fitting is performed to improve the matching accuracy.
It reduces the number of encoded images, improves matching efficiency and robustness, enhances matching stability and 3D reconstruction accuracy in complex scenes, and is suitable for high-speed, high-precision 3D measurement.
Smart Images

Figure CN123160760A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine vision and optical 3D measurement technology, and relates to a high-speed structured light 3D reconstruction method and system based on speckle-phase shift composite coding. Background Technology
[0002] Existing binocular structured light 3D reconstruction methods typically achieve 3D coordinate recovery by projecting phase-shifting fringes, Gray codes, random speckle patterns, or combinations thereof, combined with monocular or binocular stereo vision models. Phase-shifting fringes provide high-precision phase information, Gray codes and other auxiliary encoding methods can be used for phase unwrapping or correspondence determination, and random speckle patterns can provide local texture features. However, existing technologies still have the following shortcomings: (1) Existing methods of multi-image encoding, such as phase-shifting fringes combined with Gray code, usually require the projection and acquisition of a large number of images, resulting in a large number of encoded patterns, which increases the acquisition time and makes it difficult to meet the requirements of high-speed three-dimensional measurement. (2) Existing binocular structured light matching methods usually require global or semi-global search within a large parallax range, resulting in a large number of candidate matching points, making it difficult to balance matching efficiency and robustness. (3) Existing methods mostly rely on single phase information or single speckle texture information for matching. When relying solely on phase information, they are easily affected by phase periodicity and encapsulation characteristics. When relying solely on speckle or grayscale texture, they are difficult to directly meet the sub-pixel level fine matching requirements. Therefore, in scenarios such as complex curved surfaces and weak textures, mismatch and local reconstruction distortion are likely to occur.
[0003] Therefore, how to reduce the number of structured light encoded images while fully integrating the high-precision advantage of phase information and the unique advantage of speckle texture information, narrowing the binocular matching search range, reducing matching ambiguity caused by phase periodicity, and improving the matching robustness and reconstruction accuracy of complex curved surfaces, weak textures, and local discontinuous regions are technical problems that urgently need to be solved in the field of binocular structured light 3D reconstruction. Summary of the Invention
[0004] The purpose of this invention is to solve the problems of low image acquisition efficiency, large number of candidate matching points leading to search redundancy, and low matching accuracy due to reliance on single phase information or single speckle texture information in the prior art. This invention provides a high-speed structured light 3D reconstruction method and system based on speckle-phase shift composite coding.
[0005] To achieve the above objectives, the present invention employs the following technical solution: A high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding includes the following steps: Random speckle patterns and N-step phase-shifted sinusoidal fringe patterns are sequentially projected onto the surface of the object to be tested, and the corresponding left speckle image sequence, right speckle image sequence, left phase-shifted fringe image sequence, and right phase-shifted fringe image sequence are obtained. Window similarity matching is performed based on the left and right speckle image sequences to determine the initial matching position of each pixel to be matched in the right speckle image, and the matching confidence of the pixel to be matched is calculated based on the window similarity. With the initial matching position of each pixel to be matched in the right speckle image as the center, a candidate matching search interval is constructed, and the half width of the candidate matching search interval is determined by combining the matching confidence. Phase consistency similarity, texture similarity, and continuity similarity are calculated sequentially for the left phase-shifted stripe image sequence and the right phase-shifted stripe image sequence. Based on each similarity value, a multi-feature joint matching similarity function is constructed. The joint matching similarity of each candidate matching position within the candidate matching search interval is calculated based on the multi-feature joint matching similarity function. The matching position corresponding to the maximum value of the joint matching similarity is marked as the candidate matching position. The joint matching similarity of the candidate matching position and its adjacent positions is fitted to sub-pixel level to obtain the sub-pixel level matching position. The sub-pixel level disparity is calculated based on the difference in the horizontal coordinate between the pixel to be matched and the sub-pixel level matching position. The three-dimensional coordinates of the object under test are calculated based on sub-pixel parallax and the device parameters of image acquisition.
[0006] A further improvement of the present invention is that: The process of sequentially projecting random speckle patterns and N-step phase-shifted sinusoidal fringe patterns onto the surface of the object under test, and obtaining the corresponding left speckle image sequence, right speckle image sequence, left phase-shifted fringe image sequence, and right phase-shifted fringe image sequence, includes: Random speckle patterns and N-step phase-shifted sinusoidal fringe patterns are sequentially projected onto the surface of the object to be tested. A calibrated binocular camera is used to simultaneously acquire preliminary left speckle images, right speckle images, left phase-shifted fringe image sequences, and right phase-shifted fringe image sequences. Distortion correction and epipolar correction were performed on the preliminary left speckle image, right speckle image, left phase-shifted fringe image sequence, and right phase-shifted fringe image sequence, respectively, to obtain the corrected left speckle image, right speckle image, left phase-shifted fringe image sequence, and right phase-shifted fringe image sequence.
[0007] The step of performing window similarity matching based on the left and right speckle images to determine the initial matching position of each pixel to be matched in the right speckle image includes: For each pixel to be matched in the left speckle image, multiple candidate matching positions are set on the horizontal epipolar line with the same ordinate as the pixel to be matched in the right speckle image. Construct a corresponding right speckle window centered on each candidate matching position, calculate the window similarity between the left speckle window and each right speckle window, obtain the window similarity sequence for each candidate matching position, and select the candidate matching position corresponding to the maximum similarity as the initial matching position of the pixel to be matched in the right speckle image. The calculation of the matching confidence score of the pixels to be matched based on window similarity includes: For each pixel to be matched in the left speckle image, the maximum similarity and the second maximum similarity are determined from the window similarity sequence, and the peak reliability is determined based on the maximum similarity. The peak discrimination is determined based on the difference between the maximum similarity and the second largest similarity. The peak reliability and peak discrimination are then fused to obtain the matching confidence of the pixels to be matched.
[0008] The next step calculates the phase consistency similarity, texture similarity, and continuity similarity of the left and right phase-shifted stripe image sequences, and constructs a multi-feature joint matching similarity function based on each similarity value, including: The wrapping phase of each pixel is calculated based on the left phase-shifted fringe image sequence and the right phase-shifted fringe image sequence; Within the candidate matching search interval corresponding to each pixel to be matched, the phase consistency similarity is calculated for each candidate matching position in combination with the wrapping phase. Calculate texture similarity based on the grayscale information of corresponding regions in the left and right phase-shifted stripe image sequences; The continuity similarity is calculated based on the candidate lateral offset of the candidate matching position relative to the pixel to be matched and the obtained lateral offset distribution of the neighboring pixels. We construct a multi-feature joint matching similarity function for each candidate matching position by weighted fusion of phase consistency similarity, texture similarity, and continuity similarity.
[0009] The calculation of the three-dimensional coordinates of the object under test based on sub-pixel-level parallax and image acquisition device parameters includes: Based on subpixel-level parallax and binocular camera calibration parameters, the three-dimensional coordinates of points on the surface of the object under test are calculated using a binocular stereo vision triangulation model to obtain the three-dimensional point cloud data of the object's surface.
[0010] A high-speed structured light 3D reconstruction system based on speckle-phase-shift composite coding includes: The image sequence acquisition module is used to sequentially project random speckle patterns and N-step phase-shifted sinusoidal fringe patterns onto the surface of the object under test, and acquire the corresponding left speckle image sequence, right speckle image sequence, left phase-shifted fringe image sequence and right phase-shifted fringe image sequence. The initial matching module is used to perform window similarity matching based on the left speckle image sequence and the right speckle image sequence, determine the initial matching position of each pixel to be matched in the right speckle image, and calculate the matching confidence of the pixel to be matched based on the window similarity. An adaptive search module is used to construct a candidate matching search interval centered on the initial matching position of each pixel to be matched in the right speckle image, and to determine the half width of the candidate matching search interval by combining the matching confidence. The multi-feature similarity calculation module is used to sequentially calculate the phase consistency similarity, texture similarity, and continuity similarity of the left phase-shifted stripe image sequence and the right phase-shifted stripe image sequence, and construct a multi-feature joint matching similarity function based on each similarity value; The subpixel fitting module is used to calculate the joint matching similarity of each candidate matching position within the candidate matching search interval based on the multi-feature joint matching similarity function, mark the matching position corresponding to the maximum value of joint matching similarity as the candidate matching position, perform subpixel fitting on the joint matching similarity of the candidate matching position and its adjacent positions to obtain the subpixel-level matching position, and calculate the subpixel-level disparity based on the abscissa difference between the pixel to be matched and the subpixel-level matching position. The 3D reconstruction module is used to calculate the 3D coordinates of the object under test based on subpixel-level parallax and device parameters acquired from image acquisition.
[0011] A computer program product includes a computer program that, when executed by a processor, implements any one of the methods described.
[0012] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of any of the methods described above.
[0013] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the methods described herein.
[0014] Compared with the prior art, the present invention has the following beneficial effects: This invention discloses a high-speed structured light 3D reconstruction method based on speckle-phase-shift composite coding. By introducing a single random speckle image, the method utilizes the zero-mean normalized cross-correlation similarity between the left and right speckle images to perform initial matching of pixels to be matched, obtaining the corresponding initial matching positions. These initial matching positions are then used as prior information for subsequent phase-shift fine matching, reducing reliance on multiple auxiliary coding patterns such as Gray codes and improving the matching efficiency of 3D reconstruction. Furthermore, the matching confidence of each pixel to be matched is calculated to characterize the reliability of the initial speckle matching results. For pixels with high matching confidence, a smaller candidate matching search interval is used; for pixels with low matching confidence, a larger candidate matching search interval is used. This allows for adaptive adjustment of the subsequent fine matching search range based on the initial matching reliability of different pixels, achieving a balance between matching efficiency and robustness. Within the adaptive candidate matching search interval, phase consistency similarity, texture similarity, and continuity similarity are calculated for each candidate matching position, and a multi-feature joint matching similarity function is constructed. By fusing the above-mentioned multiple similarity information, the periodic ambiguity caused by single phase information is reduced, the ability to distinguish candidate matching positions is enhanced, and isolated mismatch points and local jump errors are suppressed, thereby improving the stability of fine matching and the accuracy of 3D reconstruction in complex scenes. This invention can reduce the number of structured light coded images, narrow the binocular matching search range, and improve the quality of 3D reconstruction. It is suitable for high-speed, high-precision binocular structured light 3D measurement scenarios. Attached Figure Description
[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a structural diagram of a high-speed structured light 3D reconstruction system based on speckle-phase shift composite coding disclosed in this invention; Figure 2 This is a flowchart of a high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding disclosed in this invention; Figure 3a This is a schematic diagram illustrating the matching confidence calculation principle disclosed in this invention; Figure 3b This is a schematic diagram of the ZNCC similarity distribution with a distinct single peak disclosed in this invention; Figure 3c This is a schematic diagram of the ZNCC similarity distribution with low overall similarity disclosed in this invention; Figure 3dThis is a schematic diagram of the ZNCC similarity distribution with multiple peaks as disclosed in this invention; Figure 4 This is a schematic diagram illustrating the variation relationship of the half-width of the candidate matching search interval corresponding to different pixel confidence levels in this invention. Figure 5 The diagram shows the experimental results of a complex scene disclosed in this invention, where (a) is the reconstruction result of a plaster statue, (b) is the reconstruction result of a small ball, (c) is the reconstruction result of a wall plane, and (d) is the reconstruction result of a water cup. Figure 6 This is a schematic diagram comparing the 3D reconstruction results of the method of the present invention with those of existing algorithms, where (a) is the reconstruction result of the pure speckle algorithm, (b) is the reconstruction result of the phase-shift + Gray code algorithm, and (c) is the reconstruction result of the method of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0018] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0019] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0020] In the description of the embodiments of the present invention, it should be noted that if terms such as "upper," "lower," "horizontal," or "inner" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of the invention is in use, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. Furthermore, terms such as "first" and "second" are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0021] Furthermore, the use of the term "horizontal" does not imply that the component must be absolutely horizontal, but rather that it can be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal than "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0022] In the description of the embodiments of the present invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention according to the specific circumstances.
[0023] The present invention will now be described in further detail with reference to the accompanying drawings: See Figures 1 to 6 This invention discloses a high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding, which projects random speckle patterns onto the surface of the object under test using a projection device. A phase-shifting sinusoidal fringe pattern is generated, and images are simultaneously acquired using a binocular camera. After distortion correction and epipolar correction, window similarity matching is performed based on the speckle image to obtain the initial matching position and matching confidence. The candidate search range for phase-shifting fine matching is adaptively determined based on the matching confidence, and a joint matching similarity function is constructed by combining wrapping phase, texture information, and continuity similarity to determine the optimal matching position. Furthermore, sub-pixel level disparity is obtained through sub-pixel fitting, and the 3D coordinates of the object under test are recovered. This invention can reduce the number of encoded images, narrow the matching search range, and improve 3D reconstruction efficiency, matching accuracy, and adaptability to complex scenes.
[0024] Example 1 This invention discloses a high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding, comprising the following steps: Step 1: Use a projection device to project random speckle patterns and N-step phase-shift sinusoidal fringe patterns onto the surface of the object to be tested in sequence, and use a binocular camera to simultaneously acquire the left and right image sequences corresponding to the random speckle patterns and N-step phase-shift sinusoidal fringe patterns. Step 2: Perform distortion correction and epipolar correction on the left and right image sequences so that corresponding pixels in the corrected left and right images have the same vertical coordinate and are located on the same horizontal epipolar line. Step 3: For each pixel to be matched in the left speckle image, set multiple candidate matching positions on the horizontal epipolar line with the same ordinate as the pixel to be matched in the right speckle image. Calculate the speckle window similarity between the left speckle window corresponding to the pixel to be matched and the right speckle window corresponding to each candidate matching position. Determine the candidate matching position corresponding to the maximum speckle window similarity as the initial matching position of the pixel to be matched, and obtain the initial set of pixel matching point pairs between the left and right images. Step 4: For each pixel to be matched in the left image, determine the maximum and second largest values from the speckle window similarity between the pixel to be matched and each candidate matching position in the right image, determine the peak reliability based on the maximum value, determine the peak discrimination based on the difference between the maximum and second largest values, and fuse the peak reliability and peak discrimination to obtain the matching confidence of the pixel to be matched. Step 5: Using the initial matching position of each pixel to be matched in the right image as the center, construct a candidate matching search interval on the horizontal epipolar line with the same vertical coordinate, and adaptively determine the half width of the candidate matching search interval according to the matching confidence of the corresponding pixel to be matched. Step 6: Based on the left and right image sequences corresponding to the N-step phase-shifted sinusoidal fringe pattern, calculate the wrapping phase of each pixel in the left and right images respectively; Step 7: Within the candidate matching search interval corresponding to each pixel to be matched, for each candidate matching position, calculate the phase consistency similarity based on the wrapping phase of the corresponding pixels in the left and right images, calculate the texture similarity based on the grayscale information of the corresponding regions in the left and right images, and calculate the continuity similarity based on the candidate lateral offset of the candidate matching position relative to the pixel to be matched and the obtained lateral offset distribution of the neighboring pixels. Step 8: Perform weighted fusion of the phase consistency similarity, texture similarity, and continuity similarity to construct a multi-feature joint matching similarity function corresponding to each candidate matching position; Step 9: Determine the candidate matching position corresponding to the maximum value of joint matching similarity within the candidate matching search interval, and perform sub-pixel fitting on the joint matching similarity corresponding to the candidate matching position and its adjacent candidate matching positions; determine the sub-pixel level matching position based on the peak position of the fitted joint matching similarity, and calculate the sub-pixel level disparity based on the abscissa difference between the pixel to be matched and the sub-pixel level matching position. Step 10: Calculate the three-dimensional coordinates of the object under test using a binocular stereo vision triangulation model based on the subpixel-level parallax and the calibration parameters of the binocular camera.
[0025] Example 2 This invention discloses a high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding, comprising the following steps: First, the experimental platform description reveals that the experimental platform in this embodiment includes: Processor: Intel i7-12700; Memory: 32 GB RAM; Software environment: Commonly used industrial-grade image processing software; Binocular camera: Industrial-grade binocular camera; Projector: DLP projector.
[0026] Step 1: Structured light pattern projection and image acquisition The projection device sequentially projects single random speckle patterns onto the surface of the object being measured, and The left and right cameras simultaneously acquire corresponding left and right speckle images and left and right phase-shifted stripe image sequences, forming a phase-shifted sinusoidal fringe pattern.
[0027] The random speckle pattern is a spatially encoded pattern composed of random gray-level points, random binary points, or pseudo-random texture units, used to form local texture features on the surface of the object under test. Its projection intensity can be expressed as:
[0028] in, The projection intensity function is generated randomly or pseudo-randomly.
[0029] The expression for projecting N-step phase-shifted sinusoidal fringes is:
[0030] in, For background light intensity, In order to adjust the system, The phase to be determined. In this embodiment... .
[0031] The left and right cameras simultaneously acquire random speckle images. and phase-shifted stripe image sequences ,in, This represents the left speckle image. This represents the right speckle image. This represents a left-phase-shifted fringe image. This represents a right-shifted fringe image.
[0032] Step 2: Image Preprocessing For the results obtained in step 1 and phase-shifted stripe image sequences Distortion correction and epipolar correction are performed. Specifically: Step 2.1: Generate the distortion correction and epipolar correction mapping relationship between the left and right images based on the dual-targeting parameters, and remap the left and right images to obtain the corrected left and right speckle images. and the corrected left and right phase-shifted stripe image sequence ; Step 2.2: In the corrected left and right images, corresponding pixels are located on the same horizontal epipolar line, that is, the corresponding pixels satisfy... Therefore, the matching search between the left and right images is transformed from a two-dimensional search to a one-dimensional search along the horizontal direction.
[0033] Step 3: Initial matching of random speckle patterns against Each pixel to be matched in At the same horizontal epipolar line in the right speckle image Multiple candidate matching positions are set above Pixels to be matched Construct a left speckle window centered on the center. and based on each candidate matching position Construct the corresponding right speckle window centered on the center. Calculate separately and The ZNCC similarity of the speckle windows between the pixels is calculated and sorted from largest to smallest. The candidate matching position corresponding to the highest ZNCC value is determined as the initial matching position of the pixel to be matched in the right image, denoted as . The ZNCC value ranked first is recorded as the best matching similarity. The second-ranked ZNCC value is recorded as the suboptimal matching pixel. The similarity is .
[0034] Step 4: Calculate the matching confidence score Based on the aforementioned matching confidence calculation formula, the maximum similarity is determined according to the candidate matching similarity sequences. Second largest similarity Peak discrimination Peak reliability confidence component Peak discrimination confidence component And calculate the matching confidence level. See Figures 3a to 3d .
[0035] Specifically, the zero-mean normalized cross-correlation similarity between the left speckle window centered on the pixel to be matched and the right speckle windows corresponding to each candidate matching position on the horizontal epipolar line of the right image is calculated using the following formula:
[0036] The maximum similarity is determined according to the following formula:
[0037] Furthermore, the second-largest similarity is determined according to the following formula:
[0038] Peak discrimination is calculated based on the difference between the maximum and second-largest similarities:
[0039] Calculate the peak reliability confidence component based on the maximum similarity:
[0040] Calculate the peak discrimination confidence component based on the peak discrimination score:
[0041] By fusing the peak reliability confidence component and the peak discrimination confidence component, the matching confidence of the pixel to be matched is obtained:
[0042] in, This represents the set of pixel offsets within the speckle window. This represents the grayscale value of the pixel within the left speckle window. This represents the grayscale value of the pixel within the right speckle window. and These represent the average gray values of the corresponding left and right speckle windows, respectively. Represents the leftmost image pixels The speckle window centered on the image pixels to the right The zero-mean normalized cross-correlation similarity between speckle windows centered on the center.
[0043] Indicates the pixels in the right image that are to be matched with those in the left image. The set of x-coordinates of candidate matching positions located on the same horizontal polar line. This represents an x-coordinate in the set of candidate matching positions, and the coordinates of the corresponding candidate matching position in the right image are... .
[0044] and These represent the maximum and second-largest values of the zero-mean normalized cross-correlation similarity corresponding to each candidate matching position, respectively. This indicates that the second largest value is taken from the zero-mean normalized cross-correlation similarity corresponding to each candidate matching position. This represents the peak discriminant between the maximum and second-highest similarity.
[0045] This represents the minimum acceptable zero-mean normalized cross-correlation peak threshold, and . This represents the peak discrimination reference threshold, and ; Indicates the variable Limited to the range Inside. This represents the peak reliability confidence component. This represents the peak discrimination confidence component. This represents the matching confidence of the pixel to be matched, and .
[0046] Step 5: Determining the adaptive candidate matching search interval Centered on the initial matching position of the pixel to be matched in the right image, and adaptively determined based on the matching confidence, the half-width of the candidate matching search interval is shown below. Figure 4 .
[0047] Specifically, the coordinates are The half width of the candidate matching search interval corresponding to the pixel to be matched Determined according to the following formula:
[0048] in, Indicates coordinates as The matching confidence of the pixels to be matched, and . and These represent the preset minimum search interval half-width and maximum search interval half-width, respectively, in pixels. . Indicates the window adjustment index, and . This indicates rounding up. Taking the initial matching position of the pixel to be matched in the right image as the center, the range is extended left and right along the same horizontal polar line. 1 pixel, forming a width of A candidate matching search range of pixels.
[0049] Step 6: Wrap Phase Calculation according to Formula for calculating the wrapping phase from a phase-shifting fringe image, and calculating the left wrapping phase image separately. and right wrap phase diagram .
[0050] Step 7: Multi-feature similarity calculation For each candidate matching position, calculate phase consistency similarity, texture similarity, and continuity similarity.
[0051] Step 8: Multi-feature joint matching A weighted fusion of phase consistency similarity, texture similarity, and continuity similarity is constructed to create a multi-feature joint matching similarity function. For each pixel to be matched in the left image, the joint matching similarity corresponding to each candidate matching position within its candidate matching search interval is calculated, and the candidate matching position corresponding to the maximum value of the joint matching similarity is determined as the pixel-level optimal matching position for that pixel. The joint matching similarity is denoted as .
[0052] Specifically: The multi-feature joint matching similarity function is constructed according to the following formula:
[0053] This represents the multi-feature joint matching similarity between the pixel to be matched and the candidate matching position. This represents the phase consistency similarity calculated based on the wrapping phase of corresponding pixels in the left and right images. This represents the texture similarity calculated based on the grayscale information of the image regions corresponding to the pixel to be matched and the candidate matching position. This represents the continuity similarity calculated based on the candidate lateral offset and the average lateral offset of the neighborhood, where: Phase consistency similarity is defined as:
[0054]
[0055] Texture similarity is defined as:
[0056] Continuous similarity is defined as:
[0057] in, Represents the pixels to be matched in the left image. The wrapping phase. Indicates the candidate matching position in the right image The wrapping phase. This indicates that the phase difference is normalized to... Within the range. This represents the wrapping phase difference between the pixel to be matched in the left image and the candidate matching position in the right image. For phase consistency attenuation parameters, and .
[0058] Indicates the number of phase-shifted fringe images. Here is the texture similarity attenuation parameter, and .
[0059] Continuous similarity is defined as The neighborhood average lateral offset is defined as follows: . Indicates the pixel to be matched The set of neighboring pixels, Represents the set of neighboring pixels One of the neighboring pixels. Represents neighboring pixels The corresponding obtained lateral offset, This represents the average lateral offset of neighboring pixels. It is a continuous decay parameter, and .
[0060] , and Let represent the weight coefficients of phase consistency similarity, texture similarity, and continuity similarity, respectively, and satisfy the following:
[0061] and: , , Multi-feature joint matching similarity The larger the value, the higher the degree of matching between the pixel to be matched and the candidate matching position.
[0062] Step 9: Determine the subpixel-level matching position.
[0063] Pixel-level optimal matching position Calculate with center and Corresponding joint matching similarity and Sub-pixel offsets are obtained by fitting a three-point parabola:
[0064]
[0065] Step 10: 3D coordinate reconstruction.
[0066] Based on subpixel-level parallax and binocular camera calibration parameters, the three-dimensional coordinates of points on the surface of the object under test are calculated using a binocular stereo vision triangulation model, thereby obtaining the three-dimensional point cloud data of the object's surface.
[0067] Based on the principle of binocular stereo vision triangulation: .in, The focal length of the camera; The binocular baseline length; This is subpixel parallax.
[0068]
[0069] Further, spatial coordinates are obtained:
[0070]
[0071] in, The primary point coordinates are used to obtain the final 3D point cloud data of the object.
[0072] Furthermore, to verify the effectiveness of the method of the present invention in terms of matching accuracy, computational efficiency and adaptability to complex scenarios, a verification experiment was conducted on the same experimental platform as in Example 2.
[0073] This invention discloses a high-speed structured light 3D reconstruction system based on speckle-phase shift composite coding, comprising: The image sequence acquisition module is used to sequentially project random speckle patterns and N-step phase-shifted sinusoidal fringe patterns onto the surface of the object under test, and acquire the corresponding left speckle image sequence, right speckle image sequence, left phase-shifted fringe image sequence and right phase-shifted fringe image sequence. The initial matching module is used to perform window similarity matching based on the left speckle image sequence and the right speckle image sequence, determine the initial matching position of each pixel to be matched in the right speckle image, and calculate the matching confidence of the pixel to be matched based on the window similarity. An adaptive search module is used to construct a candidate matching search interval centered on the initial matching position of each pixel to be matched in the right speckle image, and to determine the half width of the candidate matching search interval by combining the matching confidence. The multi-feature similarity calculation module is used to sequentially calculate the phase consistency similarity, texture similarity, and continuity similarity of the left phase-shifted stripe image sequence and the right phase-shifted stripe image sequence, and construct a multi-feature joint matching similarity function based on each similarity value; The subpixel fitting module is used to calculate the joint matching similarity of each candidate matching position within the candidate matching search interval based on the multi-feature joint matching similarity function, mark the matching position corresponding to the maximum value of joint matching similarity as the candidate matching position, perform subpixel fitting on the joint matching similarity of the candidate matching position and its adjacent positions to obtain the subpixel-level matching position, and calculate the subpixel-level disparity based on the abscissa difference between the pixel to be matched and the subpixel-level matching position. The 3D reconstruction module is used to calculate the 3D coordinates of the object under test based on subpixel-level parallax and device parameters acquired from image acquisition.
[0074] Experiment 1: Ablation Experiment and Innovation Link Validation To verify the contribution of each component module of the present invention to the final performance, comparative experiments were conducted by removing the random speckle initial matching module, the adaptive candidate search interval generation module, and the multi-feature joint matching module respectively.
[0075] The formula for calculating the search space compression ratio is as follows:
[0076] The out-of-limit rate represents the proportion of points whose absolute value of the plane fitting residual exceeds a preset threshold out of the total number of points. In this embodiment, the out-of-limit threshold is set to 1 mm, i.e.:
[0077] in, The distance error from the point to the fitted plane, For error exceeding Table 1 Ablation Experiment Results
[0078] Experimental results show that random speckle initial matching significantly reduces the search space, decreasing the average number of candidates from 385.31 to 16.53, achieving a search space compression rate of 95.71%, while simultaneously increasing the effective matching rate to 96.35%. Building upon this, the introduction of an adaptive candidate search interval further enhances the search space compression rate to 96.59%, reduces the planar RMSE from 3.41 mm to 2.05 mm, and lowers the out-of-limit rate from 83.50% to 37.26%. Further integration of phase consistency constraints, texture similarity constraints, and continuity constraints, combined with sub-pixel optimization, yields the best performance in the complete scheme of this invention, achieving an effective matching rate of 96.78%, reducing the planar RMSE to 0.375 mm, and lowering the out-of-limit rate to 3.44%. The experimental results verify that the random speckle initial matching module, the adaptive candidate search interval module, and the multi-feature joint matching module all play a positive role in improving matching efficiency, robustness, and 3D reconstruction accuracy.
[0079] Furthermore, from global phase matching, initial random speckle matching, initial random speckle matching + adaptive candidate search interval to the complete scheme of this invention, the performance indicators show a progressively improving trend. This indicates that this invention is not simply a superposition of functional modules, but rather forms a cascaded collaborative mechanism of initial speckle matching, confidence feedback, adaptive search space, and multi-feature joint matching. This collaborative mechanism can simultaneously reduce the search space, improve the effective matching rate, reduce planar reconstruction errors, and decrease the proportion of large error points, thereby verifying the overall collaborative effect of the technical solution of this invention.
[0080] Experiment 2: Window Adjustment Index Experiment To verify the window adjustment index in step S5 The impact on system performance was assessed by selecting different... The value was tested.
[0081] Table 2 Parameter Experiment Results
[0082] Experimental results show that, with As the number of candidates increases, the adaptive candidate matching search interval gradually shrinks, with the average number of candidates decreasing from 16.43 to 8.59, further compressing the search space; however, when... As the search area continued to increase, it shrank too quickly, causing the plane RMSE to increase from 0.220 mm to 0.273 mm, and the over-limit rate to increase from 0.47% to 1.32%. This indicates that the search area was too large. This reduces the probability of retaining true matching points, thus lowering reconstruction accuracy. Considering both search efficiency and matching accuracy, Pick Within this range, better overall performance can be obtained, and this embodiment is preferred. As a default parameter.
[0083] Experiment 3: Joint Similarity Weight Experiment To verify the rationality of phase consistency similarity, texture similarity, and continuity similarity, an experimental analysis was conducted on the joint matching weight of multiple features.
[0084] Table 3. Experimental Results of Weighting
[0085] Experimental results show that when only phase consistency similarity is used, the planar RMSE reaches 2.05 mm, and the out-of-limit rate reaches 37.26%, indicating that single phase information is easily affected by the ambiguity of stripe periodicity, resulting in mismatches. With the introduction of texture similarity and continuity similarity, the reconstruction accuracy is significantly improved. When the weight combination is... At this point, the planar RMSE decreased to 0.333 mm, and the overshoot rate decreased to 2.82%, achieving the best overall performance. Further increasing the continuity constraint weight caused both RMSE and overshoot rate to rebound, indicating that excessively strong smoothing constraints weaken the ability to preserve true disparity changes in edge regions. Experimental results validate the complementarity and rationality of joint optimization of phase consistency similarity, texture similarity, and continuity similarity, proving that the multi-feature joint matching module proposed in this invention can effectively improve the accuracy and robustness of 3D reconstruction.
[0086] Experiment 4: Complex Scene Experiment To verify the applicability of this invention in complex scenarios, experiments were conducted using different types of targets. The test objects included plaster sculptures, small balls, wall surfaces, and water glasses, representing complex curved surfaces, standard geometric targets, regular planar targets, and irregular targets, respectively.
[0087] Figure 5 The 3D reconstruction results under different scenarios are presented. As can be seen from the figures, the present invention can effectively restore the 3D shape of different types of targets, maintaining good continuity and integrity for complex curved surfaces, edge regions, and local detailed structures. Experimental results show that the 3D reconstruction method based on speckle-phase-shift composite coding proposed in this invention has good scene adaptability and reconstruction robustness, and can meet the 3D measurement needs in complex scenarios.
[0088] Experiment 5: Comparison Experiment with Existing Technologies To further verify the advancement of the technical solution of this invention, a comparative experiment was conducted with existing typical 3D reconstruction methods. The comparison methods included: pure speckle algorithm and phase-shift + Gray code algorithm.
[0089] Table 4 Comparison of the number of images required for different 3D reconstruction methods
[0090] Three-dimensional reconstruction experiments were conducted on the three methods under the same experimental platform, the same test target, and the same data acquisition conditions. The reconstructed point cloud results were then compared and analyzed.
[0091] Figure 6 The 3D reconstruction results of different algorithms are presented. As can be seen from the figures, while the pure speckle algorithm requires only a single image to complete 3D reconstruction, the reconstruction result contains many noise points and local missing data. The phase-shift + Gray code algorithm achieves high reconstruction accuracy, but requires acquiring 11 images, resulting in a large number of codes and impacting reconstruction efficiency. In contrast, this invention uses only 5 images to obtain continuous and complete 3D point cloud results, effectively reducing the number of projected images while ensuring reconstruction quality and improving system measurement efficiency.
[0092] Experimental results show that the present invention outperforms existing comparative methods in terms of reconstruction integrity, detail preservation capability, and coding efficiency, verifying the effectiveness and advancement of the technical solution of the present invention.
[0093] Its core innovations and advantages are as follows: (1) Use random speckle images to establish initial matching relationships and reduce the number of coded patterns. This invention introduces a single random speckle image and uses the zero-mean normalized cross-correlation similarity between the left and right speckle images to perform initial matching of the pixels to be matched, obtaining the corresponding initial matching position. This initial matching position is then used as prior information for subsequent phase-shift fine matching. This method reduces the reliance on multiple auxiliary coding patterns such as Gray codes, improving the matching efficiency of 3D reconstruction.
[0094] (2) An adaptive search mechanism based on matching confidence is proposed. This invention calculates the matching confidence of each pixel to be matched based on the best matching similarity, the second-best matching similarity, and the peak discrimination between the two, to characterize the reliability of the initial speckle matching result. For pixels with high matching confidence, a smaller candidate matching search interval is used; for pixels with low matching confidence, a larger candidate matching search interval is used. This invention can adaptively adjust the subsequent fine-matching search range according to the initial matching reliability of different pixels, achieving a balance between matching efficiency and matching robustness.
[0095] (3) Achieving fine matching by fusing phase consistency similarity, texture similarity and continuity similarity. This invention calculates phase consistency similarity, texture similarity, and continuity similarity for each candidate matching position within the adaptive candidate matching search interval, and constructs a multi-feature joint matching similarity function. By fusing the above-mentioned multiple similarity information, the periodic ambiguity caused by single phase information is reduced, the discriminative ability of candidate matching positions is enhanced, and isolated mismatch points and local jump errors are suppressed, thereby improving the stability of fine matching and the accuracy of 3D reconstruction in complex scenes.
[0096] (4) Forming a cascaded collaborative mechanism of “speckle initial matching - confidence evaluation - adaptive search - multi-feature joint matching - sub-pixel reconstruction”. Unlike existing schemes that simply combine speckle matching, phase shift measurement, or binocular stereo matching, this invention constructs a cascaded collaborative binocular structured light matching mechanism. In this mechanism, random speckle images are used to obtain initial matching positions and provide positional priors for subsequent fine matching. Matching confidence is used to evaluate the reliability of the initial matching results, and an adaptive search module dynamically generates candidate matching search intervals based on the initial matching positions and matching confidence. A multi-feature joint matching module fuses phase, texture, and continuity information within this constrained search interval for fine matching, and a sub-pixel fitting module further obtains sub-pixel level disparity. The various stages exhibit clear information transmission and functional synergy relationships.
[0097] In summary, this invention can reduce the number of structured light encoded images, narrow the binocular matching search range, reduce matching ambiguity caused by wrap phase periodicity, and improve matching robustness, disparity accuracy and 3D reconstruction quality in complex scenes. It is suitable for high-speed, high-precision binocular structured light 3D measurement scenarios.
[0098] A schematic diagram of a terminal device according to an embodiment of the present invention. The terminal device of this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the various method embodiments described above. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the various device embodiments described above.
[0099] The computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention.
[0100] The terminal device can be a desktop computer, laptop computer, cloud server, or other device with strong computing power. The terminal device may include, but is not limited to, a processor and memory.
[0101] The optimal choice for the processor is a multi-core high-speed central processing unit (CPU).
[0102] The memory can be used to store the computer program and / or module. The processor implements various functions of the terminal device by running or executing the computer program and / or module stored in the memory and calling the data stored in the memory.
[0103] If the modules / units integrated into the terminal device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0104] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A high-speed structured light 3D reconstruction method based on speckle-phase-shift composite coding, characterized in that, Includes the following steps: Random speckle patterns and N-step phase-shifted sinusoidal fringe patterns are sequentially projected onto the surface of the object to be tested, and the corresponding left speckle image sequence, right speckle image sequence, left phase-shifted fringe image sequence, and right phase-shifted fringe image sequence are obtained. Window similarity matching is performed based on the left and right speckle image sequences to determine the initial matching position of each pixel to be matched in the right speckle image, and the matching confidence of the pixel to be matched is calculated based on the window similarity. With the initial matching position of each pixel to be matched in the right speckle image as the center, a candidate matching search interval is constructed, and the half width of the candidate matching search interval is determined by combining the matching confidence. Phase consistency similarity, texture similarity, and continuity similarity are calculated sequentially for the left phase-shifted stripe image sequence and the right phase-shifted stripe image sequence. Based on each similarity value, a multi-feature joint matching similarity function is constructed. The joint matching similarity of each candidate matching position within the candidate matching search interval is calculated based on the multi-feature joint matching similarity function. The matching position corresponding to the maximum value of the joint matching similarity is marked as the candidate matching position. The joint matching similarity of the candidate matching position and its adjacent positions is fitted to sub-pixel level to obtain the sub-pixel level matching position. The sub-pixel level disparity is calculated based on the difference in the horizontal coordinate between the pixel to be matched and the sub-pixel level matching position. The three-dimensional coordinates of the object under test are calculated based on sub-pixel parallax and the device parameters of image acquisition.
2. The high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding according to claim 1, characterized in that, The process of sequentially projecting random speckle patterns and N-step phase-shifted sinusoidal fringe patterns onto the surface of the object under test, and obtaining the corresponding left speckle image sequence, right speckle image sequence, left phase-shifted fringe image sequence, and right phase-shifted fringe image sequence, includes: Random speckle patterns and N-step phase-shifted sinusoidal fringe patterns are sequentially projected onto the surface of the object to be tested. A calibrated binocular camera is used to simultaneously acquire preliminary left speckle images, right speckle images, left phase-shifted fringe image sequences, and right phase-shifted fringe image sequences. Distortion correction and epipolar correction were performed on the preliminary left speckle image, right speckle image, left phase-shifted fringe image sequence, and right phase-shifted fringe image sequence, respectively, to obtain the corrected left speckle image, right speckle image, left phase-shifted fringe image sequence, and right phase-shifted fringe image sequence.
3. The high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding according to claim 1, characterized in that, The step of performing window similarity matching based on the left and right speckle images to determine the initial matching position of each pixel to be matched in the right speckle image includes: For each pixel to be matched in the left speckle image, multiple candidate matching positions are set on the horizontal epipolar line with the same ordinate as the pixel to be matched in the right speckle image. Construct a corresponding right speckle window centered on each candidate matching position, calculate the window similarity between the left speckle window and each right speckle window, obtain the window similarity sequence for each candidate matching position, and select the candidate matching position corresponding to the maximum similarity as the initial matching position of the pixel to be matched in the right speckle image.
4. The high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding according to claim 3, characterized in that, The calculation of the matching confidence score of the pixels to be matched based on window similarity includes: For each pixel to be matched in the left speckle image, the maximum similarity and the second maximum similarity are determined from the window similarity sequence, and the peak reliability is determined based on the maximum similarity. The peak discrimination is determined based on the difference between the maximum similarity and the second largest similarity. The peak reliability and peak discrimination are then fused to obtain the matching confidence of the pixels to be matched.
5. The high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding according to claim 1, characterized in that, The next step calculates the phase consistency similarity, texture similarity, and continuity similarity of the left and right phase-shifted stripe image sequences, and constructs a multi-feature joint matching similarity function based on each similarity value, including: The wrapping phase of each pixel is calculated based on the left phase-shifted fringe image sequence and the right phase-shifted fringe image sequence; Within the candidate matching search interval corresponding to each pixel to be matched, the phase consistency similarity is calculated for each candidate matching position in combination with the wrapping phase. Calculate texture similarity based on the grayscale information of corresponding regions in the left and right phase-shifted stripe image sequences; The continuity similarity is calculated based on the candidate lateral offset of the candidate matching position relative to the pixel to be matched and the obtained lateral offset distribution of the neighboring pixels. We construct a multi-feature joint matching similarity function for each candidate matching position by weighted fusion of phase consistency similarity, texture similarity, and continuity similarity.
6. The high-speed structured light 3D reconstruction method based on speckle-phase shift composite coding according to claim 1, characterized in that, The calculation of the three-dimensional coordinates of the object under test based on sub-pixel-level parallax and image acquisition device parameters includes: Based on subpixel-level parallax and binocular camera calibration parameters, the three-dimensional coordinates of points on the surface of the object under test are calculated using a binocular stereo vision triangulation model to obtain the three-dimensional point cloud data of the object's surface.
7. A high-speed structured light 3D reconstruction system based on speckle-phase-shift composite coding, characterized in that, include: The image sequence acquisition module is used to sequentially project random speckle patterns and N-step phase-shifted sinusoidal fringe patterns onto the surface of the object under test, and acquire the corresponding left speckle image sequence, right speckle image sequence, left phase-shifted fringe image sequence and right phase-shifted fringe image sequence. The initial matching module is used to perform window similarity matching based on the left speckle image sequence and the right speckle image sequence, determine the initial matching position of each pixel to be matched in the right speckle image, and calculate the matching confidence of the pixel to be matched based on the window similarity. An adaptive search module is used to construct a candidate matching search interval centered on the initial matching position of each pixel to be matched in the right speckle image, and to determine the half width of the candidate matching search interval by combining the matching confidence. The multi-feature similarity calculation module is used to sequentially calculate the phase consistency similarity, texture similarity, and continuity similarity of the left phase-shifted stripe image sequence and the right phase-shifted stripe image sequence, and construct a multi-feature joint matching similarity function based on each similarity value; The subpixel fitting module is used to calculate the joint matching similarity of each candidate matching position within the candidate matching search interval based on the multi-feature joint matching similarity function, mark the matching position corresponding to the maximum value of joint matching similarity as the candidate matching position, perform subpixel fitting on the joint matching similarity of the candidate matching position and its adjacent positions to obtain the subpixel-level matching position, and calculate the subpixel-level disparity based on the abscissa difference between the pixel to be matched and the subpixel-level matching position. The 3D reconstruction module is used to calculate the 3D coordinates of the object under test based on subpixel-level parallax and device parameters acquired from image acquisition.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-6.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1-6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1-6.
