Space phase coding method based on binary pattern
After generating an initial binary periodic image, an updated binary periodic image is obtained by line shifting, forming a binary periodic moving image group. The binary periodic moving image group is then projected and acquired. Phase calculation is performed directly using the binary encoding of the binary periodic projected image, which solves the problem of low reconstruction accuracy in high dynamic range scenes in traditional structured light 3D reconstruction technology, and improves reconstruction accuracy and speed.
Patent Information
- Application Number
- CN202511130477.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-13
- Publication Date
- 2025-11-28
AI Technical Summary
Traditional structured light 3D reconstruction technology has low reconstruction accuracy in high dynamic range scenes and cannot be effectively applied to objects with diffuse reflective surfaces.
After generating an initial binary periodic image, an updated binary periodic image is obtained by line shifting, forming a binary periodic moving image group. The binary periodic moving image group is then projected and acquired. Through binary periodic projection and synthesis, phase calculation is directly performed using the binary encoding of the binary periodic projected image to obtain phase encoding information in space. This method is suitable for measurement in high dynamic range scenes and improves reconstruction accuracy.
After generating an initial binary periodic image, an updated binary periodic image is obtained by line shifting, forming a binary periodic moving image group. The binary periodic moving image group is then projected and acquired to obtain a binary periodic projected image. Phase calculation is performed directly using the binary encoding of the binary periodic projected image, which improves the robustness of the camera's acquired information. This method is suitable for measurement in high dynamic range scenes, improves reconstruction accuracy, and the projection speed through binary encoding is relatively fast, without a significant increase in the number of projected patterns.
Smart Images

Figure CN121032784A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of structured light coding, in particular to a spatial phase coding method based on binary pattern. BACKGROUND
[0002] Structured light three-dimensional reconstruction technology has the advantages of non-contact, high precision and high speed, and is widely used in industrial detection, reverse engineering, cultural relic protection and medical health fields. Traditional structured light three-dimensional reconstruction technology mostly adopts stripe projection technology. The traditional stripe projection technology usually projects sinusoidal stripe patterns or cosine stripe patterns, and is mainly suitable for diffuse reflection surface objects. For high dynamic range surfaces, the reconstruction accuracy is low due to insufficient camera dynamic range. SUMMARY
[0003] The technical problem to be solved by the present application is to provide a spatial phase coding method based on binary pattern, which is suitable for high dynamic range scene measurement and improves the reconstruction accuracy.
[0004] To solve the above technical problems, the purpose of the present application is achieved by the following technical scheme: a spatial phase coding method based on binary pattern is provided, comprising the following steps: setting a pixel period and a projection resolution, generating an initial binary period image according to the pixel period and the projection resolution, wherein the number of pixels occupied by 0 and 1 in a single pixel period of the initial binary period image is not less than one; processing the initial binary period image by line shifting to obtain a plurality of updated binary period images; arranging the initial binary period image and the plurality of updated binary period images in sequence to form a binary period moving image group; projecting and collecting the binary period moving image group on a measured object to obtain a binary period projection image; and synthesizing the binary period projection image and performing phase calculation to obtain a folded phase image.
[0005] The further technical scheme is that the initial binary period image is moved in the same direction according to the interval of one pixel.
[0006] The further technical scheme is that the phase calculation after synthesizing the binary period projection image comprises: synthesizing the binary period projection image by using the following formula to obtain the synthesized phase shift image:
[0007]
[0008] In the formula, I ci represents the i-th synthesized phase shift image, δ i represents the phase shift amount of the i-th phase shift image, j represents the serial number of the binary period projection image, and M represents the total number of binary period projection images.
[0009] Further technical solutions of the application are as follows: the phase unwrapping after the synthesis of the binary periodic projection images includes: performing phase unwrapping on the synthesized phase shift images by using a phase shift unwrapping formula, wherein the phase shift unwrapping formula is as follows:
[0010]
[0011] wherein, φ represents the folded phase, M represents the total number of the binary periodic projection images, j represents the serial number of the binary periodic projection images, N represents the total number of the phase shift images, i represents the serial number of the phase shift images, and I represents the i-th phase shift image. i represents the i-th phase shift image after the synthesis.
[0012] Further technical solutions of the application are as follows: after the folded phase image is obtained, the spatial phase encoding method based on the binary pattern further includes: performing phase unwrapping on the folded phase image to obtain an unwrapped phase image.
[0013] Further technical solutions of the application are as follows: the phase unwrapping on the folded phase image includes: projecting a plurality of Gray code images and collecting corresponding Gray code projection images; and performing phase unwrapping on the folded phase image in combination with the plurality of Gray code projection images.
[0014] Further technical solutions of the application are as follows: before the plurality of Gray code images are projected and the corresponding Gray code projection images are collected, the spatial phase encoding method based on the binary pattern further includes: according to the obtained folded phase image, in time sequence, in combination with a Gray code encoding principle, a plurality of Gray code images are generated.
[0015] Further technical solutions of the application are as follows: the phase unwrapping on the folded phase image includes: generating a second initial binary periodic image with a different period width from the initial binary periodic image; processing the second initial binary periodic image by using a line shift method to obtain a second group of binary periodic shift images; projecting the second group of binary periodic shift images and collecting corresponding second binary periodic projection images, performing phase unwrapping on the second binary periodic projection images after the synthesis, and obtaining a second folded phase image; and performing phase unwrapping on the folded phase image and the second folded phase image by using a double-frequency heterodyne algorithm or a multi-frequency heterodyne algorithm.
[0016] The beneficial technical effects of this invention are as follows: The spatial phase encoding method based on binary patterns of this invention generates an initial binary periodic image, then obtains an updated binary periodic image by line shifting, forming a binary periodic moving image group. The binary periodic moving image group is then projected and acquired to obtain a binary periodic projected image. The phase can be directly calculated using the binary encoding of the binary periodic projected image to obtain the phase encoding information in space. The robustness of the camera's acquired information is improved through the binary encoding illumination method, making it suitable for measurement in high dynamic range scenes and improving reconstruction accuracy. Furthermore, the binary encoding is fast during projection, and the number of projected patterns does not increase significantly, which is beneficial for improving the speed of 3D reconstruction. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A schematic flowchart of a spatial phase encoding method based on binary patterns provided in an embodiment of the present invention;
[0019] Figure 2 A schematic diagram of a phase-shifted image synthesized from a binary periodic projection image when the phase shift is 0, provided by the spatial phase coding method based on binary patterns in an embodiment of the present invention.
[0020] Figure 3 A schematic diagram of a phase-shifted image synthesized from a binary periodic projection image when the phase shift is π / 2, provided by the spatial phase coding method based on binary patterns according to an embodiment of the present invention.
[0021] Figure 4 A schematic diagram of a folded phase diagram provided in an embodiment of the present invention;
[0022] Figure 5 for Figure 4 The phase encoding diagram corresponding to row 150 of the folded phase diagram shown. Detailed Implementation
[0023] 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, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] Please see Figure 1 ,Figure 1 This is a flowchart illustrating a spatial phase encoding method based on binary patterns provided in an embodiment of the present invention. The spatial phase encoding method based on binary patterns includes the following steps:
[0025] S10: Set the pixel period and projection resolution, and generate an initial binary periodic image based on the pixel period and projection resolution, wherein the number of pixels occupied by 0 and 1 in a single pixel period of the initial binary periodic image is not less than one.
[0026] In this context, a pixel period is the pixel sequence corresponding to a single period when the pixels in the image are arranged periodically. In the initial binary periodic image, the number of pixels with 0 and the number of pixels with 1 within a single pixel period are both at least one. The number of pixels in a pixel period is equal to the period width. The duty cycle of the initial binary periodic image can be set to 50%, resulting in an even number of pixels in the pixel period. Furthermore, the number of pixels with 0 and the number of pixels with 1 within a pixel period are equal. Therefore, in the generated initial binary periodic image, the number of pixels with 0 and the number of pixels with 1 each occupy half of the period width. By generating the initial binary periodic image, the grayscale value of each pixel in the image is either 0 or 1, allowing for direct phase calculation through binary encoding. The number of updated binary periodic images can be determined based on the number of pixels in the pixel period (i.e., the period width). For example, when the number of pixels in the pixel period (i.e., the period width) is set to M, that is, the number of pixels in the pixel sequence corresponding to a single period is M, then there are M pixels arranged in a single period. The initial binary periodic image includes multiple pixel sequences, and each pixel sequence is a pixel sequence obtained by arranging M pixels in sequence. Then, the initial binary periodic image needs to be processed by line shifting M-1 times to obtain M-1 updated binary periodic images. The number of pixel periods in the initial binary periodic image can be determined based on the projection resolution and the number of pixels in the pixel period (i.e., the period width). For example, when the number of pixels in the pixel period (i.e., the period width) is set to 20, and the projection resolution is set to 400×300, the initial binary periodic image has 20 pixel periods. That is, the initial binary periodic image includes 20 sequentially arranged pixel periods. The pixel period can be such that the gray level of the first 10 columns of pixels is 1 and the gray level of the last 10 columns of pixels is 0. Then the initial binary periodic image can be such that the gray level of columns 1 to 10 of pixels is 1, the gray level of columns 11 to 20 of pixels is 0, the gray level of columns 21 to 30 of pixels is 1, the gray level of columns 31 to 40 of pixels is 1, and so on.
[0027] Of course, in some embodiments, when the number of pixels in the pixel period (i.e., the period width) is 20, the pixel period of the initial binary periodic image is such that the gray level of the first 6 columns of pixels is 1, the gray level of the 7th to 16th columns of pixels is 0, and the gray level of the 17th to 20th columns of pixels is 1, so that the phase increases from 0.
[0028] S20: The initial binary periodic image is processed by line shifting to obtain multiple updated binary periodic images;
[0029] S30: Arrange the initial binary periodic image and multiple updated binary periodic images in sequence to form a binary periodic moving image group;
[0030] S40: Project and acquire the binary periodic moving image group onto the object under test to obtain a binary periodic projected image; then project the initial binary periodic image and each updated binary periodic image of the binary periodic moving image group onto the object under test in sequence, and acquire the projection to obtain multiple corresponding binary periodic projected images.
[0031] S50: Synthesize the binary periodic projection image and then perform phase calculation to obtain the folded phase map.
[0032] In this process, binary periodic projection image synthesis refers to sequentially synthesizing the binary periodic projection images corresponding to the acquired binary periodic moving image group. Line-shifting is a method that generates different coded patterns by changing the position, orientation, or phase of the binary pattern. The binary pattern can move along a certain direction (such as horizontal or vertical) or change its phase (i.e., its starting position). Multiple images with different binary coded information are obtained through line-shifting. When projected onto the object under test, different deformations occur due to the shape differences of the object's surface. Therefore, by sequentially projecting each image from the binary periodic moving image group onto the object, each image will produce a specific deformation due to the shape of the object's surface. The determined coded information of the binary images results in better phase robustness of the projected images. The spatial phase encoding method based on binary patterns generates an initial binary periodic image, then uses a line shifting method to obtain an updated binary periodic image, forming a binary periodic moving image group. The binary periodic moving image group is then projected and acquired to obtain a binary periodic projected image. The phase can be directly calculated using the binary encoding of the binary periodic projected image to obtain the phase encoding information in space. The robustness of the camera's acquired information is improved through binary encoding illumination, making it suitable for measurements in high dynamic range scenes and improving reconstruction accuracy. Furthermore, binary encoding is fast during projection, and the number of projected patterns does not increase significantly, which is beneficial for improving the speed of 3D reconstruction.
[0033] Preferably, in one embodiment, the process of processing the initial binary periodic image by line shifting in step S20 specifically includes:
[0034] The pixels of the initial binary periodic image are moved sequentially in the same direction at one-pixel intervals.
[0035] In this method, the pixels of the initial binary periodized image can be shifted to the right sequentially. When the number of pixels in the pixel period is 20, and the pixel period of the initial binary periodized image is such that the grayscale of the first 10 columns of pixels is 1 and the grayscale of the 10th column of pixels is 0, the pixel period of the first updated binary periodized image obtained through line shifting is such that the grayscale of the first column of pixels is 0, the grayscale of the second to 11th columns of pixels is 1, and the grayscale of the 12th to 20th columns of pixels is 0. Therefore, the pixel period of the second updated binary periodized image obtained through line shifting is... The first two columns of pixels have a grayscale value of 0, the 3rd to 12th columns have a grayscale value of 1, and the 13th to 20th columns have a grayscale value of 0. And so on. The pixel period of the nineteenth updated binary period image obtained by line shifting is that the first nine columns of pixels have a grayscale value of 1, the 10th to 19th columns have a grayscale value of 0, and the 20th column has a grayscale value of 1. The initial binary period image, the first updated binary period image, the second updated binary period image to the nineteenth updated binary period image are arranged in sequence to form a binary period moving image group.
[0036] Specifically, step S50, which involves synthesizing the binary periodic projection image and then performing phase calculation, includes:
[0037] The binary periodic projection image is synthesized using formula (1) to obtain the synthesized phase-shifted image:
[0038]
[0039] In the formula, I ci δ represents the i-th phase-shifted image after synthesis. i Let represent the phase shift of the i-th phase-shifted image, j represent the index of the binary periodic projection image, and M represent the total number of binary periodic projection images. The total number of binary periodic projection images is the same as the number of pixels in the pixel period.
[0040] The goal of phase resolution is to extract the phase information of the object's surface from the phase-shifted image synthesized from the acquired binary periodic projection images. This phase information reflects the phase change caused by light reflection on the object's surface and is directly related to the object's surface shape. Phase resolution mainly uses multiple binary images with different phase shifts to calculate the phase value of each pixel. These phase values form a phase map, and the phase value of each pixel represents the height or shape change of that point relative to a reference plane. When the phase shift is 0, the phase-shifted image synthesized from the binary periodic projection images looks like... Figure 2 As shown, when the phase shift is π / 2, the phase-shifted image synthesized from the binary periodic projection image is as follows. Figure 3 As shown.
[0041] Specifically, step S50, which involves synthesizing the binary periodic projection image and then performing phase calculation, further includes:
[0042] The phase shift of the synthesized phase-shifted image is calculated using a phase shift calculation formula, which is as follows:
[0043]
[0044] In the formula, Let M represent the folded phase value, j represent the total number of binary periodic projection images, N represent the total number of phase-shifted images, and i represent the phase-shifted image number. i This represents the i-th phase-shifted image after synthesis.
[0045] When the total number of binary periodic projection images is 20 (i.e., the number of pixels in a pixel period is 20) and the total number of phase-shifted images is 20, the resulting folded phase map can be obtained as follows: Figure 4 As shown, Figure 4 The horizontal line in the middle represents the 150th row of the folded phase map. The phase encoding result corresponding to the 150th row of the folded phase map is as follows: Figure 5 As shown.
[0046] Specifically, after obtaining the folded phase map in step S50, the spatial phase encoding method based on binary patterns further includes:
[0047] The folded phase map is expanded to obtain the expanded phase map.
[0048] The purpose of phase unrolling is to eliminate the folding phenomenon of phase values in the folded phase diagram and obtain a continuous phase diagram.
[0049] Specifically, in some embodiments, the phase unfolding of the folded phase map includes:
[0050] Project multiple Gray code images and acquire the corresponding Gray code projection images;
[0051] Phase unfolding is performed by combining the folded phase map with multiple Gray code projection maps.
[0052] In this process, the folded phase map is combined with the corresponding Gray code projection map to perform phase unrolling. The Gray code projection map provides additional spatial information, which can help determine the correct order of phase values in the continuous change process. By comparing the folded phase map and the Gray code projection map, the jump points of phase values can be identified, and the phase values can be corrected accordingly to obtain a continuous phase map.
[0053] Specifically, before projecting multiple Gray code images and acquiring the corresponding Gray code projection images, the spatial phase encoding method based on binary patterns further includes:
[0054] Based on the obtained folded phase diagram, multiple Gray code diagrams are generated according to the timing sequence and the Gray code encoding principle.
[0055] The process involves generating a Gray code image based on the folded phase map obtained through phase calculation. First, the Gray code is generated by combining the grayscale values of pixels corresponding to each phase of the folded phase map with the Gray code encoding principle. Then, the Gray code is generated by combining the grayscale values of pixels corresponding to each two phases of the folded phase map with the Gray code encoding principle. This process is repeated for each three phases of the folded phase map, until the Gray code for each phase of all periods of the folded phase map is obtained, generating the final Gray code image. The number of Gray code images is equal to the number of pixel periods in the image.
[0056] Of course, in another embodiment, the phase unfolding of the folded phase map includes:
[0057] Generate a second initial binary periodic image with a period width different from the initial binary periodic image; wherein the number of pixels occupied by 0 and the number of pixels occupied by 1 in a single pixel period of the second initial binary periodic image are both not less than one.
[0058] The second initial binary periodic image is processed by line shifting to obtain multiple updated second binary periodic images. The second initial binary periodic image and the multiple updated second binary periodic images are arranged in sequence to obtain the second binary periodic moving image group.
[0059] Projecting a second binary periodic moving image group and acquiring the corresponding second binary periodic projected image, then synthesizing the second binary periodic projected image and performing phase calculation to obtain a second folded phase map; wherein, synthesizing the second binary periodic projected image means synthesizing the second binary periodic projected image corresponding to each acquired second binary periodic moving image group according to the image group respectively.
[0060] Phase unfolding is performed on the folded phase map and the second folded phase map using a dual-frequency heterodyne algorithm or a multi-frequency heterodyne algorithm.
[0061] There can be one or more second initial binary periodic images with period widths different from the initial binary periodic image, and each second initial binary periodic image has a different period width. Since the period width of each second initial binary periodic image is different from the period width of the initial binary periodic image, folded phase images with different period widths can be obtained through binary encoded images with different period widths. When there is only one second initial binary periodic image with a period width different from the initial binary periodic image, the dual-frequency heterodyne method is used for phase unwrapping; when there are multiple second initial binary periodic images with period widths different from the initial binary periodic image, the multi-frequency heterodyne method is used for phase unwrapping.
[0062] In summary, the spatial phase encoding method based on binary patterns of the present invention generates an initial binary periodic image, then uses a line shifting method to obtain an updated binary periodic image, forming a binary periodic moving image group. This group is then projected and acquired to obtain a binary periodic projected image. The phase can then be directly calculated using the binary encoding of the projected image to obtain spatial phase encoding information. The binary encoding illumination method improves the robustness of camera acquisition information, making it suitable for measurements in high dynamic range scenes and improving reconstruction accuracy. Furthermore, the binary encoding is fast during projection, and the number of projected patterns does not significantly increase, which is beneficial for improving the speed of 3D reconstruction.
[0063] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A spatial phase encoding method based on binary patterns, characterized in that, Includes the following steps: Set the pixel period and projection resolution, and generate an initial binary periodic image based on the pixel period and projection resolution, wherein the number of pixels occupied by 0 and 1 in a single pixel period of the initial binary periodic image is not less than one; The initial binary periodic image is processed by line shifting to obtain multiple updated binary periodic images; The initial binary periodic image and multiple updated binary periodic images are arranged sequentially to form a binary periodic moving image group; A binary periodic moving image group is used to project and acquire images of the object under test, thereby obtaining a binary periodic projection image. The binary periodic projection images are synthesized and then phase calculation is performed to obtain a folded phase map.
2. The spatial phase encoding method based on binary patterns according to claim 1, characterized in that, The process of processing the initial binary periodic image by line shifting is specifically as follows: The pixels of the initial binary periodic image are moved sequentially in the same direction at one-pixel intervals.
3. The spatial phase encoding method based on binary patterns according to claim 1, characterized in that, The step of synthesizing the binary periodic projection image and then performing phase calculation includes: The following formula is used to synthesize the binary periodic projection image to obtain the synthesized phase-shifted image: In the formula, I ci δ represents the i-th phase-shifted image after synthesis. i Let represent the phase shift of the i-th phase-shifted image, j represent the index of the binary periodic projection image, and M represent the total number of binary periodic projection images.
4. The spatial phase encoding method based on binary patterns according to claim 3, characterized in that, The step of synthesizing the binary periodic projection image and then performing phase calculation includes: The phase shift of the synthesized phase-shifted image is calculated using a phase shift calculation formula, which is as follows: In the formula, Let M represent the total number of binary periodic projection images, j represent the index of the binary periodic projection image, N represent the total number of phase-shifted images, and i represent the index of the phase-shifted image. i This represents the i-th phase-shifted image after synthesis.
5. The spatial phase encoding method based on binary patterns according to claim 1, characterized in that, After obtaining the folded phase map, the spatial phase encoding method based on binary patterns further includes: The folded phase map is expanded to obtain the expanded phase map.
6. The spatial phase encoding method based on binary patterns according to claim 5, characterized in that, The phase unrolling of the folded phase map includes: Project multiple Gray code images and acquire the corresponding Gray code projection images; Phase unfolding is performed by combining the folded phase map with multiple Gray code projection maps.
7. The spatial phase encoding method based on binary patterns according to claim 6, characterized in that, Before projecting multiple Gray code images and acquiring the corresponding Gray code projection images, the spatial phase encoding method based on binary patterns further includes: Based on the obtained folded phase diagram, multiple Gray code diagrams are generated according to the timing sequence and the Gray code encoding principle.
8. The spatial phase encoding method based on binary patterns according to claim 5, characterized in that, The phase unrolling of the folded phase map includes: Generate a second initial binary periodic image with a period width different from the initial binary periodic image; The second initial binary periodic image is processed by line shifting to obtain the second binary periodic moving image group; Project the second binary periodic moving image group and acquire the corresponding second binary periodic projected image. After synthesizing the second binary periodic projected image, perform phase calculation to obtain the second folded phase map. Phase unfolding is performed on the folded phase map and the second folded phase map using a dual-frequency heterodyne algorithm or a multi-frequency heterodyne algorithm.