Pixel depth determination method, three-dimensional reconstruction method, system and electronic device
By using a coaxial system formed by a telecentric lens and a semi-transparent mirror, combined with the depth-difference modulation relationship, the problems of large space occupation and low accuracy in 3D reconstruction are solved, and high-precision pixel depth determination and 3D reconstruction are achieved.
Patent Information
- Application Number
- CN202310354735.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-22
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2043-03-22
AI Technical Summary
Existing technologies for 3D reconstruction suffer from problems such as large space occupation, limited accuracy, and limited depth of field, especially in narrow spaces where it is difficult to achieve high-precision object reconstruction.
A coaxial system is formed by a telecentric lens and a semi-transparent mirror. By acquiring projected images of the object under test at different focal lengths, the actual depth of field of the pixels is determined by the depth-differential modulation relationship. Combined with a telecentric zoom lens, image acquisition at different focal lengths is achieved, reducing space occupation and improving accuracy.
It improves the accuracy of pixel depth of field in 3D reconstruction, reduces space occupation, expands the depth of field range, and is suitable for high-precision reconstruction in narrow spaces.
Smart Images

Figure CN116385515B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of three-dimensional reconstruction technology, and in particular to a method and unit for determining pixel depth of field, a three-dimensional reconstruction method and system, an electronic device, and a computer-readable storage medium. Background Technology
[0002] Stereoscopic vision reconstruction of objects mainly relies on the parallax formed by different viewpoints and uses triangulation to measure and reconstruct the object's three-dimensional shape. However, when there are large changes in the height of the object's surface, this method will cause severe occlusion on the surface of the object being measured, resulting in shadows in some areas. It is difficult to obtain the three-dimensional data of the entire surface shape and cannot achieve complete 3D surface reconstruction. At the same time, this method occupies a lot of space, which will lead to inconvenience in measurement under conditions of limited space and narrow field of view. It is either very difficult to measure or requires the projector and camera to be extremely small.
[0003] While existing technologies also employ coaxial point cloud reconstruction algorithms, most are based on processing phase-shifted fringe modulation curve data, which still offers limited improvement in accuracy during 3D reconstruction. Alternatively, some technologies incorporate multiple cameras to enhance accuracy, but these methods require significant space and cannot reconstruct objects in confined spaces, especially for small devices. Summary of the Invention
[0004] Based on the above situation, the main objective of this invention is to provide a method and unit for determining pixel depth of field, a three-dimensional reconstruction method and system, an electronic device, and a computer-readable storage medium, so as to reduce the space occupation, improve the accuracy in three-dimensional reconstruction, and expand the depth of field range.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] A first aspect of the present invention provides a method for determining pixel depth of field in three-dimensional reconstruction, comprising the steps of:
[0007] S110: The striped image is transmitted through a telecentric lens and a semi-transparent mirror and then projected onto the surface of the object to be tested. The projected images reflected by the object to be tested are collected at two different focal lengths by the reflection of the telecentric zoom lens and the semi-transparent mirror. At each focal length, the object to be tested is placed at a preset position in the optical axis direction of the telecentric lens and several real-shot images are collected.
[0008] The depth of field for each pixel is determined as follows:
[0009] S120: Calculate the corresponding measured modulation degree based on several real-captured images at each focal length, subtract the two measured modulation degrees to obtain the measured differential modulation degree, and take the depth of field corresponding to the measured differential modulation degree in the corresponding depth of field-differential modulation degree relationship as the actual depth of field.
[0010] The depth-of-field-differential modulation relationship is obtained through a calibration step. In the calibration step, multiple sets of corresponding depth of field and modulation degrees are calibrated for each focal length. The modulation degrees of two focal lengths corresponding to the same depth of field are subtracted to obtain the calibrated differential modulation degree. The depth-of-field-differential modulation degree relationship is determined based on the multiple sets of corresponding depth of field and calibrated differential modulation degrees. The two focal lengths corresponding to the depth-of-field-differential modulation degree relationship are consistent with the two focal lengths corresponding to the measured differential modulation degree. The preset position is located within the depth of field range of the depth-of-field-modulation degree relationship.
[0011] Preferably, the calibration step includes the following steps:
[0012] S210: The striped image is transmitted through a telecentric lens and a semi-transparent mirror and then projected onto a calibration plate. The projected image reflected by the calibration plate is acquired at multiple calibration positions at each focal length through the reflection of the telecentric zoom lens and the semi-transparent mirror. Several calibration images are acquired at each calibration position for each focal length, and the multiple calibration positions are distributed along the optical axis of the telecentric lens.
[0013] S220: Using each of the calibration positions as the depth of field, calculate the calibration modulation degree pixel by pixel based on several calibration images at the same depth of field for each of the focal lengths, and use the difference between the two calibration modulation degrees at two different focal lengths for the same depth of field as the calibration differential modulation degree at these two focal lengths. Determine the depth of field-modulation degree relationship and the depth of field-differential modulation degree relationship based on the focal length, depth of field, calibration modulation degree, and calibration differential modulation degree corresponding to each pixel.
[0014] Preferably, the depth-of-field-differential modulation relationship is represented as a curve, and the part with the largest slope in each depth-of-field-differential modulation curve corresponding to each pixel is selected as the judgment segment; the preset position in step 110 is located in the judgment segment corresponding to the two focal lengths.
[0015] Preferably, both the depth-of-field-tone regulation relationship and the depth-of-field-difference tone regulation relationship are represented as curves, and the number of focal lengths in step S210 is greater than or equal to 3; step S220 includes the following steps:
[0016] S221: Calculate the calibration modulation degree pixel by pixel based on a number of calibration images with each focal length at the same depth of field, and calculate the difference between the two calibration modulation degrees of two adjacent focal lengths at the same depth of field as the calibration differential modulation degree. Determine the depth of field-modulation degree curve and the depth of field-differential modulation degree curve based on the focal length, the preset position, the calibration modulation degree, and the calibration differential modulation degree corresponding to each pixel.
[0017] S222: Select the part with the largest slope in each depth-of-field-differential modulation curve corresponding to each pixel as the judgment segment, select the average depth of field at the beginning and end of the judgment segment as the judgment depth of field, and take the modulation degree of the judgment depth of field on the depth-of-field-modulation curve corresponding to the depth-of-field-differential modulation curve as the judgment modulation degree. In this way, multiple judgment groups are obtained for each pixel. Each judgment group includes a first focal length and a second focal length, the depth-of-field-differential modulation curves corresponding to the two, the depth-of-field-modulation curve corresponding to the first focal length, and the judgment modulation degree.
[0018] In step S110, if the projection image on the object under test is also acquired at other focal lengths in step S210 through the reflection of the telecentric zoom lens and the semi-transparent semi-reflective mirror;
[0019] S120 includes the following steps:
[0020] S121: Select the i-th determination group corresponding to the undetermined pixel as the current determination group, and select several real-sampled images corresponding to the first focal length in the current determination group to calculate the first measured modulation index T. 实i Determine the first measured adjustment system T 实i Whether it is greater than or equal to the determination modulation T 判i If so, calculate the second measured modulation index T based on several real-shot images corresponding to the second focal length. 实i+1 The first actual measurement adjustment system T 预 i and the second measured regime T 预i+1 The difference in depth of field is taken as the actual depth of field of the pixel to be determined in the depth-difference modulation curve; otherwise, proceed to S122.
[0021] S122: Determine the first measured modulation index T 实i If the value is greater than the preset value, calculate the third measured modulation index T based on several real-shot images corresponding to the second focal length in the (i+1)th judgment group. 实i+2 The second actual measurement adjustment system T 实i+1 and the third actual measurement adjustment system T 实i+2The difference is taken as the actual depth of the pixel to be determined on the depth-difference modulation curve of the (i+1)th determination group; otherwise, i is incremented by 1, and the process returns to step S121 until the actual depth of the pixel to be determined is obtained.
[0022] Preferably, in step S222, the method for determining the determination segment includes:
[0023] Select a sub-segment from the peak to the trough in the depth-of-field differential modulation curve, and extract several portions of a preset length range from the sub-segment as pre-judgment sub-segments. Calculate the slope of each pre-judgment sub-segment, and select the pre-judgment sub-segment with the largest slope as the judgment segment.
[0024] Preferably, the plurality of calibration positions in step S210 are set at equal intervals, and the plurality of calibration positions at each focal length are consistent.
[0025] Preferably, the telecentric zoom lens is an electronic zoom lens; in steps S110 and S210, different focal lengths are achieved by adjusting the current of the electronic zoom lens.
[0026] Preferably, the test object and the calibration plate are placed on an electric displacement platform, and the calibration plate is positioned at different calibration positions by controlling the electric displacement platform.
[0027] A second aspect of the present invention provides a three-dimensional reconstruction method for reconstructing the object under test in three dimensions based on the actual depth of field of each pixel to be determined as specified above.
[0028] A third aspect of the present invention provides a pixel depth-of-field determination unit for three-dimensional reconstruction, comprising:
[0029] The acquisition module is used to project the striped image onto the surface of the object under test after it is transmitted through a telecentric lens and a semi-transparent semi-reflective mirror. The projected image reflected by the object under test is acquired at two different focal lengths through the telecentric zoom lens and the reflecting side of the semi-transparent semi-reflective mirror. At each focal length, the object under test is placed at a preset position in the optical axis direction of the telecentric lens and several real-time images are acquired.
[0030] The depth-of-field determination module is used to calculate the corresponding measured modulation degree based on several real-captured images at each focal length, subtract the two measured modulation degrees to obtain the measured differential modulation degree, and take the depth of field corresponding to the measured differential modulation degree in the corresponding depth-of-field-differential modulation degree relationship as the actual depth of field of the pixel to be determined. The two focal lengths corresponding to the depth-of-field-differential modulation degree relationship are consistent with the focal lengths corresponding to the measured differential modulation degree.
[0031] The calibration module is used to calibrate multiple sets of corresponding depth of field and modulation degree at each focal length, and to obtain the calibration differential modulation degree by subtracting the modulation degree at two focal lengths corresponding to the same depth of field, and to determine the depth of field-differential modulation degree relationship based on multiple sets of corresponding depth of field and calibration differential modulation degree.
[0032] The preset position is located within the depth range of the depth-to-focus relationship.
[0033] Preferably,
[0034] The acquisition module is also used to project the stripe image onto the calibration plate after it is transmitted through a telecentric lens and a semi-transparent mirror. The projected image on the calibration plate is acquired at multiple calibration positions at each focal length through the reflective side of the telecentric zoom lens and the semi-transparent mirror. Several calibration images are acquired at each calibration position for each focal length, and the multiple calibration positions are distributed along the optical axis of the telecentric lens.
[0035] The calibration module is further configured to use each calibration position as the depth of field, calculate the calibration modulation degree pixel by pixel based on several calibration images at the same depth of field with each focal length, and use the difference between the two calibration modulation degrees at two different focal lengths with the same depth of field as the calibration differential modulation degree, and determine the depth of field-modulation degree relationship and the depth of field-differential modulation degree relationship based on the focal length, depth of field, calibration modulation degree, and calibration differential modulation degree corresponding to each pixel.
[0036] Preferably, the acquisition module includes:
[0037] A projection device and a telecentric lens are coaxially arranged and interconnected, a telecentric zoom lens and an image acquisition device are coaxially arranged and interconnected, and a semi-transparent and semi-reflective mirror is provided. The optical axis of the telecentric lens and the optical axis of the telecentric zoom lens are perpendicular, and both are at a 45-degree angle to the semi-transparent and semi-reflective mirror. The transmission side of the semi-transparent and semi-reflective mirror faces the telecentric lens, and the reflection side faces the telecentric zoom lens.
[0038] Preferably, the acquisition module further includes an electric displacement platform, which is arranged along the optical axis of the telecentric lens and located on the reflecting side of the semi-transparent mirror.
[0039] Preferably, the acquisition module further includes a polarizer, which is disposed between the telecentric lens and the projection device, or on the light-emitting side of the telecentric lens.
[0040] A fourth aspect of the present invention provides a three-dimensional reconstruction system, comprising:
[0041] The determining unit described in any of the above items;
[0042] The reconstruction module is used to perform three-dimensional reconstruction of the object under test based on the actual depth of field of each pixel to be determined.
[0043] A fifth aspect of the present invention provides an electronic device including the three-dimensional reconstruction system described above.
[0044] Preferably, the electronic device includes a biomedical imaging device, an industrial testing device, or a microscopic imaging device.
[0045] A sixth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is capable of implementing the determination method or the three-dimensional reconstruction method as described in any of the preceding claims.
[0046] This invention forms a coaxial system using a semi-transparent, semi-reflective mirror. The telecentric lens and telecentric zoom lens allow the depth of field of each pixel in each acquired image to be ignored, while the actual depth of field of each pixel is determined by finding the correspondence between depth of field and differential modulation degree. This improves the accuracy of the depth of field of each pixel in 3D reconstruction, significantly enhancing the accuracy compared to using modulation degree curves. Furthermore, the telecentric zoom lens enables image acquisition at different focal lengths using the same device. Thus, only one acquisition device is needed to achieve image acquisition at different focal lengths, reducing space requirements and expanding the applicability of the method and system.
[0047] Other beneficial effects of the present invention will be explained in detail through the introduction of specific technical features and technical solutions in specific embodiments. Those skilled in the art should be able to understand the beneficial technical effects brought about by these technical features and technical solutions through the introduction of these technical features and technical solutions. Attached Figure Description
[0048] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. In the drawings:
[0049] Figure 1 A flowchart of a preferred embodiment of the determination method provided by the present invention;
[0050] Figure 2 A system diagram of a preferred embodiment of the determination system provided by the present invention;
[0051] Figure 3 A system diagram illustrating a preferred embodiment of the acquisition module in the determination system provided by the present invention;
[0052] Figure 4 A schematic diagram of a stripe image used in a preferred embodiment of the determination method provided by the present invention;
[0053] Figure 5In a preferred embodiment of the determination method provided by the present invention, depth-of-field-modulation curves and depth-of-field-differential modulation curves are obtained at two focal lengths;
[0054] Figure 6 In a preferred embodiment of the determination method provided by the present invention, depth-of-field-modulation curves and depth-of-field-differential modulation curves are obtained at multiple focal lengths;
[0055] Figures 7-9 The images show the results of reconstructing the same part of English letters on a plaster cast using different methods.
[0056] Figure 10 , Figure 11 It also demonstrates the effects of reconstructing the same part of a plane using different methods.
[0057] In the picture,
[0058] 100. Acquisition module; 10. Projection device; 20. Telecentric lens; 30. Telecentric zoom lens; 40. Image acquisition device; 50. Semi-transparent and semi-reflective mirror; 60. Calibration plate; 70. Electric displacement platform; 200. Depth of field determination module; 300. Calibration module. Detailed Implementation
[0059] The present invention is described below based on embodiments, but the present invention is not limited to these embodiments. In the following detailed description of the present invention, some specific details are described in detail, but well-known methods, processes, procedures, and elements are not described in detail in order to avoid obscuring the essence of the present invention.
[0060] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.
[0061] Unless the context explicitly requires it, the words "comprising," "including," and similar terms throughout the specification and claims should be interpreted as encompassing rather than being exclusive or exhaustive; that is, meaning "including but not limited to."
[0062] In the description of this invention, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0063] The pixel depth-of-field determination method and unit provided by this invention are used for 3D reconstruction in various application fields, such as 3D reconstruction in biomedical imaging equipment, industrial inspection equipment, or micro-forming equipment. Specifically, structured light with a set pattern is projected onto the surface of the object to be measured by the projection device 10, such as the stripe pattern in the stripe image below (see reference). Figure 4 The acquisition device 40, which works in conjunction with the projection device 10, acquires the structured light reflected from the surface of the object to be measured. Since the structured light is modulated on the surface of the object to be measured, the reflected structured light carries the surface information of the object to be measured. By demodulating the reflected structured light, the three-dimensional morphological information of the object to be measured can be obtained, and then the three-dimensional morphology of the surface of the object to be measured can be reconstructed.
[0064] The determining unit of the present invention, such as Figure 2 As shown, it includes a data acquisition module 100, which is used to acquire the structured light reflected from the surface of the object under test. Figure 3 As shown, the acquisition module 100 includes a projection device 10 and a telecentric lens 20, both coaxially arranged and interconnected, a telecentric zoom lens 30 and an image acquisition device 40, both coaxially arranged and interconnected, and a semi-transparent mirror 50. The optical axes of the telecentric lens 20 and the telecentric zoom lens 30 are perpendicular, and both are at a 45-degree angle to the semi-transparent mirror 50. The transmission side of the semi-transparent mirror 50 faces the telecentric lens 20, and the reflection side faces the telecentric zoom lens 30. That is, the telecentric lens 20 is mounted on the projection device 10, and the telecentric zoom lens 30 is mounted on the image acquisition device 40. Thus, the structured light projected by the projection device is emitted from the telecentric lens 20 and passes through the semi-transparent mirror 50 to illuminate a distant object, such as a calibration plate 60 or a test object located on the optical axis of the telecentric lens 20. Of course, the calibration plate 60 or the test object is located on the side of the semi-transparent mirror 50 away from the telecentric lens 20. The structured light reflected by the calibration plate 60 or the object under test is reflected by the semi-transparent mirror 50 and enters the telecentric zoom lens 30, where it is then acquired by the acquisition device 40. Since the telecentric zoom lens 30 is a zoom lens, during the actual acquisition or calibration process, once the positions of the projection device 10 and the acquisition device 40 are fixed, the relative positions of the projection device 10 and the acquisition device 40, as well as the relative positions with the semi-transparent mirror 50, are fixed throughout the acquisition of the structured light reflected from the object under test or the calibration plate. By adjusting the telecentric zoom lens 30, images of the calibration plate 60 or the surface of the object under test at different focal lengths can be acquired. However, during the calibration process, the calibration plate 60 needs to be placed at different calibration positions for image acquisition.
[0065] Specifically, this invention provides a method for determining pixel depth of field in 3D reconstruction, such as... Figure 1 As shown, the steps include:
[0066] S110: The fringe image is projected onto the surface of the object under test after transmission through a telecentric lens and a semi-transparent mirror. The projected images reflected from the object are acquired at two different focal lengths via reflection through a telecentric zoom lens and the semi-transparent mirror. At each focal length, the object is placed at a preset position along the optical axis of the telecentric lens, and several actual images are acquired. Thus, for this preset position, several actual images are obtained at each focal length. In other words, the structured light of the fringe image is irradiated by the telecentric lens onto the transmission surface of the semi-transparent mirror, then transmitted from the reflection surface of the semi-transparent mirror, projected onto the surface of the object under test, reflected by the object, and then irradiated onto the reflection surface of the semi-transparent mirror. After reflection, the light is acquired by the telecentric zoom lens (specifically, by the image acquisition device).
[0067] The depth of field is then determined pixel by pixel based on these captured images. The depth of field for each pixel is determined as follows:
[0068] S120: Calculate the corresponding measured modulation degree based on several real-captured images at each focal length. Subtract the measured modulation degree at two focal lengths to obtain the measured differential modulation degree. Use the depth of field corresponding to the measured differential modulation degree in the corresponding depth-difference modulation degree relationship as the actual depth of field, i.e., the actual depth of field of the pixel to be determined.
[0069] The depth-of-field-differential modulation degree relationship is obtained through a calibration step. In this step, multiple sets of corresponding depth-of-field and modulation degrees are calibrated for each focal length. The modulation degrees at two focal lengths corresponding to the same depth of field are subtracted to obtain the calibrated differential modulation degree. The depth-of-field-differential modulation degree relationship is determined based on these multiple sets of corresponding depth-of-field and calibrated differential modulation degrees. When determining the actual depth of field, the two focal lengths corresponding to the depth-of-field-differential modulation degree relationship are consistent with the two focal lengths corresponding to the measured differential modulation degree, and the preset position in step S110 is located within the depth-of-field range of this depth-of-field-modulation degree relationship. In other words, in step S120, the two focal lengths corresponding to the two sets of actual images acquired for calculating the measured differential modulation degree are consistent with the two focal lengths corresponding to the depth-of-field-differential modulation degree relationship used to determine the actual depth of field.
[0070] For example, in the pixel depth-of-field determination method of the present invention, multiple measurement groups are obtained in step S110. Several actual images in each measurement group correspond to a focal length, such that several actual images in the m-th measurement group correspond to the m-th focal length f. m In step S120, for several real-sampled images corresponding to each focal length, the measured modulation degree of the pixel to be determined is calculated, thereby obtaining the measured modulation degree of the pixel at that focal length. For example, based on several real-sampled images of the m-th measured group, the measured modulation degree of the pixel at the m-th focal length f is obtained. m Corresponding measured adjustment system T 实m Then calculate the m-th focal length f. m and the (m+1)th focal length fm+1 The corresponding measured differential modulation scheme D 实 m = T 实m -T 实m+1 Then, the measured differential modulation regime D is determined using the depth-of-field-differential modulation regime relationship at the corresponding focal length. m The depth of field corresponding to this relationship is taken as the actual depth of field of the pixel to be measured, such as the measured differential modulation degree D. 实m At the m-th focal length f m and the (m+1)th focal length f m+1 The depth of field corresponding to the depth of field-differential modulation relationship is the measured depth of field. Specifically, when only two focal lengths of actual images are acquired in step S110, m = 1, 2; when more than three focal lengths of actual images are acquired, m = 1, 2, ..., M (described in detail below).
[0071] This invention forms a coaxial system using a semi-transparent mirror 50, a projection device 10, and a data acquisition device 40. The telecentric lens 20 and the telecentric zoom lens 30 allow each pixel in the acquired image to ignore its depth information. The actual depth of each pixel is determined by finding the depth-differential modulation degree correspondence. This method of determining depth through the depth-differential modulation degree correspondence improves the accuracy of determining the depth of each pixel in 3D reconstruction compared to using the depth-modulation degree correspondence, thus significantly improving the accuracy of 3D reconstruction compared to using modulation degree curves. Furthermore, the telecentric zoom lens allows for image acquisition at different focal lengths using the same device. Therefore, only one data acquisition device is needed to achieve image acquisition at different focal lengths, reducing the system's space requirements and expanding the applicability of the pixel depth determination method and the determination unit.
[0072] The projected fringe image is a sinusoidal phase-shifted fringe image, which includes multiple stripes of alternating brightness and darkness, such as... Figure 4 As shown, the stripes are black and white, and the direction of each stripe can be vertical, or it can be arranged in other directions, such as horizontal. Theoretically, the denser the stripe image, the better the accuracy. Considering the resolution of the image acquisition device 40, preferably, the number of black and white stripe groups in the acquired image is between 35 and 60, such as 30, 40, 45, 50, 55, or 60 groups, so that the acquired image can achieve both high resolution and high accuracy in subsequent data processing.
[0073] Specifically, such as Figure 2 As shown, the calibration process includes the following steps:
[0074] S210: The fringe image is transmitted through the telecentric lens 20 and the semi-transparent mirror 50 and then projected onto the calibration plate 60. The projected images on the calibration plate 60 are acquired at multiple calibration positions at each focal length through reflection from the telecentric zoom lens 30 and the semi-transparent mirror 50. Several calibration images are acquired at each calibration position for each focal length, and these multiple calibration positions are distributed along the optical axis of the telecentric lens 20. In other words, in this step, the structured light of the fringe image is irradiated by the telecentric lens onto the transmission surface of the semi-transparent mirror, then transmitted from the reflection surface of the semi-transparent mirror, projected onto the surface of the object under test, reflected by the object surface, irradiated onto the reflection surface of the semi-transparent mirror, and then reflected by the telecentric zoom lens before being acquired (specifically, acquired by the image acquisition device).
[0075] S220: Using each calibration position as the depth of field, calculate the calibration modulation degree pixel-by-pixel based on several calibration images at the same depth of field for each focal length. The difference between the calibration modulation degrees for the same depth of field at two different focal lengths is taken as the calibration differential modulation degree. The depth-of-field modulation degree relationship and the depth-of-field differential modulation degree relationship are determined based on the focal length, depth of field, calibration modulation degree, and calibration differential modulation degree corresponding to each pixel. In other words, for each focal length, the calibration modulation degree corresponding to that depth of field is calculated based on several calibration images at the same depth of field. This yields multiple calibration modulation degrees for each focal length. Then, for the same depth of field, the difference between the calibration modulation degrees for two different focal lengths is calculated, and this difference is taken as the calibration differential modulation degree corresponding to those two focal lengths. Finally, the depth-of-field modulation degree relationship for the corresponding focal length is determined based on multiple sets of depth of field and calibration modulation degrees for each focal length. Finally, the depth-of-field differential modulation degree relationship for the two focal lengths is determined based on each set of depth of field and calibration differential modulation degree for each focal length.
[0076] The calibration plate 60 is a planar plate. The plane of the calibration plate 60 is perpendicular to the optical axis of the telecentric lens 20 and is located on the optical axis of the telecentric lens 20. Since the plane of the calibration plate 60 is perpendicular to the optical axis of the telecentric lens 20, the depth of field of each position of the plane is consistent with respect to the acquisition device. Therefore, after the structured light of the fringe image is projected onto the calibration plate 60, the structured light reflected by the calibration plate 60 is reflected by the semi-transparent mirror and then acquired by the acquisition device 40. Thus, the depth of field of each pixel in the same calibration image is consistent.
[0077] In the calibration process, step S210 is similar to step S110, except that the object to be tested is replaced by a calibration plate 60. Furthermore, multiple different calibration positions are set for each focal length, and several images are acquired at each calibration position. This results in multiple calibration groups. The several acquired images in each calibration group correspond to a focal length and a calibration position (or depth of field). For example, the nth calibration group includes images at the nth focal length f. nThis involves multiple corresponding calibration locations (or depths of field) and several calibration images corresponding to each calibration location (or depth of field). These calibration images are then processed. In step S220, for each calibration group, the modulation index of the pixel to be measured at that calibration location (or depth of field) is calculated based on the several calibration images corresponding to each calibration location (or depth of field). For example, in the nth calibration group, the modulation index of the pixel at the nth focal length f is calculated. n Several calibration images at each calibration location are processed to obtain the calibration modulation degree corresponding to that location, thereby obtaining the nth focal length f. n The corresponding sets of calibration positions and calibration adjustment degrees T 标n Then, based on the nth focal length f n The corresponding calibration positions and calibration adjustment units T 标n Determining the depth-of-field-modulation correspondence of this calibration group yields the nth focal length f. n The corresponding depth-of-field tonal correspondence; and based on the nth focal length f at the same calibration position. n Corresponding modulation system T 标n and the (n+1)th focal length f n+1 Corresponding calibration system T 标n+1 The calibration differential adjustment regime D at this calibration position can be obtained. 标n =T 标n -T 标n+1 Calculate the nth focal length f in this way n and the (n+1)th focal length f n+1 Each calibration position corresponds to a calibration differential modulation scheme. In this way, multiple sets of calibration positions and calibration differential modulation schemes are obtained for these two focal lengths. Then, the depth-of-field relationship between these two focal lengths is determined based on the multiple sets of calibration positions and calibration differential modulation schemes for these two focal lengths.
[0078] In step S210, when only calibration images at two focal lengths are acquired, n = 1, 2, as follows: Figure 5 As shown, depth-of-field-modulation curves (such as curve 1 and curve 2) and a differential modulation curve (such as curve 3) corresponding to two focal lengths are obtained respectively. When acquiring calibration images at more than three focal lengths, n = 1, 2, ..., N, where N is the number of focal lengths (described in detail below). In the embodiment where both steps S110 and S210 are acquired at two focal lengths, the two focal lengths in step S110 are the same as the two focal lengths in step S210.
[0079] In the above calibration steps, the depth-of-field to modulation index correspondence and the depth-of-field to differential modulation index correspondence can be in curve form, tabular form, or other forms. When in curve form, it can be obtained through curve fitting, with the horizontal axis representing depth of field (i.e., calibration position) and the vertical axis representing modulation index or differential modulation index. When in tabular form, a differential method can be used to obtain more correspondences between depth of field and modulation index, and between depth of field and differential modulation index. It is understood that in the various embodiments of the present invention (including the embodiments below), the modulation index and differential modulation index in the depth-of-field to modulation index curve and the depth-of-field to differential modulation index curve can be normalized before fitting to form curves. For ease of description and illustration, the following description uses curve form as an example.
[0080] In a preferred embodiment, the depth-of-field-differential modulation relationship is represented by a curve. The portion with the steepest slope in each depth-of-field-differential modulation curve corresponding to each pixel is selected as the determination segment. The preset position in step 110 is located in the determination segment corresponding to these two focal lengths, that is, the preset position is located in the depth-of-field region corresponding to the determination segment, such as... Figure 5 In the selection process, the chosen judgment segment is segment AB, and the depths of field corresponding to points A and B are Z and Z, respectively. A Z B The preset position is selected from Z. A ~Z B By selecting the section with the steepest slope as the judgment segment, the actual depth of field is determined from this judgment segment, thus improving the accuracy of the obtained depth of field and consequently the accuracy of the 3D reconstruction.
[0081] In embodiments of the present invention, calibration images at only two focal lengths can be acquired. Correspondingly, for the object under test, only actual images at two focal lengths are acquired. To improve the accuracy of determining the depth of field of each pixel, in a preferred embodiment of the present invention, calibration images with a focal length greater than or equal to 3 are acquired in step S210, that is, three or more focal lengths are selected in step S210. Of course, for each focal length, images are still acquired at multiple calibration locations, and several calibration images are acquired at each calibration location, that is, the number of focal lengths in step S210 is greater than or equal to 3. If the number of focal lengths is N, in actual calibration, the N focal lengths can be acquired in ascending order or in descending order. Of course, this order is not limited. In this embodiment, step S220 includes the following steps:
[0082] S221: Calculate the calibration modulation degree pixel-by-pixel based on several calibration images of each focal length at the same depth of field (i.e., the same calibration position). Calculate the difference between the calibration modulation degrees of two adjacent focal lengths at the same preset position as the calibration differential modulation degree. Determine the depth-of-field modulation degree curve and the depth-of-field differential modulation degree curve based on the focal length, preset position, calibration modulation degree, and calibration differential modulation degree corresponding to each pixel. S222: Select the segment with the steepest slope in each depth-of-field differential modulation degree curve corresponding to each pixel as the judgment segment. Select the average depth of field at the beginning and end of the judgment segment as the judgment depth of field. Take the modulation degree of the judgment depth on the depth-of-field differential modulation degree curve corresponding to the depth-of-field differential modulation degree curve as the judgment modulation degree. Thus, multiple judgment groups are obtained for each pixel. Each judgment group includes two focal lengths (first focal length and second focal length), the depth-of-field differential modulation degree curves corresponding to these two focal lengths, the depth-of-field modulation degree curve corresponding to the first focal length, and the judgment modulation degree. Among them, the depth-of-field-modulation curve corresponding to the first focal length is the depth-of-field-modulation curve obtained by using each calibration modulation degree as the minuend when determining the depth-of-field-differential modulation curve in this group.
[0083] As mentioned earlier, in step S221, for each calibration group, the modulation index of the pixel to be tested at that calibration position (or depth of field) is first calculated based on several calibration images corresponding to each calibration position (or depth of field). For example, for the nth calibration group, the modulation index of the pixel to be tested at the nth focal length f is calculated. n Several calibration images at each calibration location are processed to obtain the calibration modulation degree corresponding to that location, thereby obtaining the nth focal length f. n The corresponding sets of calibration positions and calibration adjustment degrees T 标n Then, based on the nth focal length f n The corresponding calibration positions and calibration adjustment units T 标n Determining the depth-of-field-modulation correspondence of this calibration group yields the nth focal length f. n The corresponding depth-of-field tonal correspondence; and based on the nth focal length f at the same calibration position. n Corresponding modulation system T 标n and the (n+1)th focal length f n+1 Corresponding calibration system T 标n+1 The calibration differential adjustment regime D at this calibration position can be obtained. 标n =T 标n -T 标n+1 Calculate the nth focal length f in this way n and the (n+1)th focal length f n+1Each calibration position corresponds to a calibration differential modulation scheme. This yields multiple sets of calibration positions and calibration differential modulation schemes for these two focal lengths. Then, based on these multiple sets of calibration positions and calibration differential modulation schemes for these two focal lengths, the depth-of-field relationship between these two focal lengths and the calibration differential modulation scheme is determined. It can be seen that step S221 yields N sets of calibration positions for the nth focal length f. n The corresponding depth-of-field toning system correspondence (i.e., T) 标n Follow Z 标n (Relationship of changes), N-1 focal lengths f n and the (n+1)th focal length f n+1 The corresponding depth-of-field-differential modulation system correspondence (i.e., D) 标n Follow Z 标n (the relationship of change), such as Figure 6 In the graph, the horizontal axis represents depth of field, and the vertical axis represents modulation degree (specifically, for ease of plotting, the vertical axis in the graph is a normalized modulation degree). Curves 4-7 illustrate the depth of field-modulation degree correspondence for four different focal lengths, and curves 8-10 illustrate three depth of field-differential modulation degree correspondences. For the same depth of field, the vertical axis of curve 10 is the difference between the vertical axes of curves 7 and 6 at that depth of field; the vertical axis of curve 9 is the difference between the vertical axes of curves 6 and 5 at that depth of field; and the vertical axis of curve 8 is the difference between the vertical axes of curves 5 and 4 at that depth of field. In step S222, the depth of field is determined based on each depth of field-differential modulation degree curve, and then the modulation degree is determined based on the depth of field-modulation degree curve, such as based on the nth focal length f. n and the (n+1)th focal length f n+1 The corresponding nth depth-of-field-tone curve determines the depth of field for judgment. This involves selecting the segment with the steepest slope (the judgment segment) from this curve, and then selecting the average depth of field value at both ends of that judgment segment. For example, if the coordinates of the two ends are (Z... 标min D 标min ), (Z 标max D 标max ),like Figure 6 As shown, the depth of field Z is determined. 标判 = (Z_min + Z_standard) max ) / 2; then, based on the nth depth-to-modulation curve, the modulation index T is determined, i.e., Z. 标判 On the ordinate of the depth-of-field tonal curve, Figure 6In this diagram, the portion of curve 10 in region 3, the portion of curve 9 in region 2, and the portion of curve 8 in region 1 are respectively designated as the judgment segments corresponding to their respective curves. Taking the judgment segment corresponding to curve 10 as an example, the coordinates of its two ends are shown. Using this method, executing step S222 can obtain N-1 judgment groups corresponding to each pixel. Each judgment group includes the same content, including two focal lengths, the depth-of-field-differential modulation curves corresponding to these two focal lengths, the judgment modulation, and the depth-of-field-calibration modulation curve corresponding to one focal length. For example, in the i-th judgment group, it includes the first focal length f... i Second focal length f i+1 Two focal lengths, the corresponding depth-of-field tonal curves for these two focal lengths (i.e., the i-th depth-of-field tonal curve), and the first focal length f. i The corresponding depth-of-field-modulation curve (i.e., the i-th depth-of-field-modulation curve), and the determination modulation T. 标判i .
[0084] After obtaining the judgment group, in step S110, two focal lengths of one of the judgment groups can be selected for actual image acquisition. In this embodiment, step S120 selects the depth-difference modulation curve in the judgment group. Alternatively, step S110 can also acquire actual images at each focal length as in step S210. That is, in step S110, if the projection image on the object under test is also acquired at other focal lengths in step S210 through reflection from the telecentric zoom lens and the semi-transparent mirror, i.e., for each of the N focal lengths, several actual images are acquired at each preset position, then step S120 includes the following steps:
[0085] S121: Select the i-th decision group corresponding to the undetermined pixel as the current decision group, and select the first focal length f in the current decision group. i The first measured modulation index T is calculated from several corresponding real-shot images. 实i Determine the first measured adjustment system T 实i Whether it is greater than or equal to the modulation index T 判i If so, according to the second focal length f i+1 The second measured modulation index T is calculated from several corresponding real-shot images. 实i+1 The first actual measurement adjustment system T 预i With the second actual measurement adjustment system T 实i+1 The difference between the depth of field and the depth of field corresponding to the depth of field-differential modulation degree curve in the current determination group is taken as the actual depth of field of the pixel to be determined; otherwise, execute S122, that is, the first measured modulation degree T. 实i Less than the judgment modulation T 判i Execute step S122;
[0086] S122: Determine the first measured adjustment regime T 实iIf it is greater than the preset value, then according to the second focal length f in the (i+1)th judgment group. i+2 The third measured modulation index T is calculated from several corresponding real-shot images. 实i+2 The second actual measurement adjustment system T 实i+1 (also the second focal length f in the i-th judgment group) i+1 (corresponding actual measurement adjustment system) and the third actual measurement adjustment system T 实i+2 The difference is used as the depth of field corresponding to the depth-differential modulation curve in the (i+1)th determination group, which is taken as the actual depth of field of the pixel to be determined; otherwise, i is incremented by 1, and the process returns to step S121 until the actual depth of field of the pixel to be determined is obtained.
[0087] In the above steps, the initial value of i is 1.
[0088] In other words, in this embodiment, before determining the depth of field of a pixel to be determined using the depth-of-field-differential modulation curve, it is first determined which depth-of-field-differential modulation curve will make the depth of field determination more accurate. Specifically, starting from one of the multiple decision groups obtained from calibration, the depth-of-field-differential modulation in each decision group is judged until a definite depth-of-field-differential modulation curve is found. This method can further improve the accuracy of the actual depth of field, thereby improving the accuracy of 3D reconstruction.
[0089] Where i = 1, 2, ..., N-1. The preset value is a number close to 0 but greater than 0, such as 0.01, 0.02 or 0.005, etc., preferably 0.01.
[0090] In the above embodiments, the segment from the peak to the trough in the depth-of-field-differential modulation curve can be directly selected as the determination segment. In a preferred embodiment of the present invention, the method for determining the determination segment includes: selecting a sub-segment from the peak to the trough in the depth-of-field-differential modulation curve; extracting several portions of a preset length range from the sub-segment as pre-judgment segments; calculating the slope of each pre-judgment segment; and selecting the pre-judgment segment with the largest slope as the determination segment. By using this method, selecting the shorter segment with the steepest curve change as the determination segment can further improve the accuracy of depth-of-field determination, thereby improving the accuracy of 3D reconstruction.
[0091] In the above embodiments, the preset position is selected from the depth of field range corresponding to each determination segment. Preferably, the preset position is the same for different focal lengths in step S110.
[0092] It should be noted that in the above embodiments, when the depth-to-modulation relationship and the depth-to-differential modulation relationship are presented in other forms such as tables, the above determination segment can be selected from the part of the depth-to-differential modulation relationship where the differential modulation changes with the depth of field.
[0093] In step S110, the number of actual images acquired at each focal length can be equal or unequal, such as k1 images for each focal length. Similarly, in step S210, the number of calibration images acquired at different focal lengths and different calibration positions can be equal or unequal, such as k2 images for each calibration position.
[0094] In the above embodiments, the modulation index of a pixel (x, y) is calculated based on several images (such as calibration images or actual captured images) at a certain position at a certain focal length using the following formulas (1) and (2):
[0095]
[0096] I j (x,y)=I0+C(x,y)cos(2πfx+2jπ / L+φ0); (2)
[0097] Where I0 is the background light intensity, C(x,y) represents the contrast of the projected stripe image, f and φ0 represent the spatial frequency and initial phase of the projected stripes, respectively, L is the total number of corresponding images, such as k1 images in step S110 and k2 images in step S210; j is the image number; I j Let be the light intensity of the j-th image.
[0098] In step S210, the multiple calibration positions can be set at equal intervals along the optical axis of the telecentric lens, or they can be set at non-equal intervals. These calibration positions may include the location of the focal plane corresponding to each focal length. The multiple calibration positions at each focal length can be the same, or different multiple calibration positions can be selected for each focal length. Preferably, in step S210, the multiple calibration positions corresponding to each focal length are set at equal intervals, and the multiple calibration positions at each focal length are the same, so as to simplify the procedure when obtaining the depth-of-field-modulation degree correspondence and depth-of-field-differential modulation degree in step S220.
[0099] Preferably, the telecentric zoom lens is an electronic zoom lens. In steps S110 and S210, different focal lengths are achieved by adjusting the current of the electronic zoom lens. This allows for convenient image acquisition at different focal lengths by adjusting the lens's current, increasing the ease of image acquisition. For example, in the above embodiment, -35mA, 0mA, and 35mA can be selected to achieve three different focal lengths.
[0100] The multiple calibration positions in step S210 above can be achieved manually. In a preferred embodiment, the acquisition module further includes an electric displacement platform 70. The object to be tested and the calibration plate 70 can be placed on the electric displacement platform 70 respectively. The electric displacement platform 70 is set along the optical axis of the telecentric lens 20, so that its displacement direction is coaxial with the optical axis of the telecentric lens 20, and the electric displacement platform 70 is located on the reflecting side of the semi-transparent mirror 50. In this embodiment, the calibration plate 60 is placed in different calibration positions by controlling the electric displacement platform 70. Of course, after the calibration step, the calibration plate 70 can be replaced with the object to be tested, and the object to be tested can be placed on the electric displacement platform 70.
[0101] The present invention also provides a three-dimensional reconstruction method, which performs three-dimensional reconstruction of the object under test based on the actual depth of each pixel to be determined as determined in any of the above embodiments.
[0102] The three-dimensional reconstruction method of this invention can achieve better three-dimensional reconstruction results. Among them, Figures 7-9 The images show reconstructions of the same portion of English letters on a plaster cast of the object being tested. Figure 7 A grayscale image taken by the camera. Figure 8 This is a 3D reconstructed image obtained using the existing method of determining pixel depth of field using a single depth-modulation curve. Figure 9 The image is a 3D reconstructed image obtained using the pixel depth-of-field determination method of the present invention; Figure 10 , Figure 11 It also shows an image reconstructed from the same part of a plane as the object under test. Figure 10 This is a 3D reconstructed image obtained using the existing method of determining pixel depth of field using a single depth-modulation curve. Figure 11 This is a 3D reconstructed image obtained using the pixel depth-of-field determination method of the present invention. Figures 7-11 A comparison of the various images clearly shows that the three-dimensional reconstruction image obtained using the method of this invention has a better effect.
[0103] The present invention also provides a pixel depth-of-field determination unit in 3D reconstruction, such as... Figure 2 and Figure 3 As shown, it includes:
[0104] The acquisition module 100 is used to implement step S110, that is, the striped image is projected onto the surface of the object to be tested after being transmitted through the telecentric lens and the semi-transparent semi-reflective mirror, and the reflected image of the object to be tested is acquired at two different focal lengths through the reflection of the telecentric zoom lens and the semi-transparent semi-reflective mirror. At each focal length, the object to be tested is placed at a preset position in the optical axis direction of the telecentric lens and several real-time images are acquired.
[0105] The depth of field determination module 200 is used to implement step S120, that is, to calculate the corresponding measured modulation degree according to several real images under each focal length, subtract the two measured modulation degrees to obtain the measured differential modulation degree, and take the depth of field corresponding to the measured differential modulation degree in the corresponding depth of field-differential modulation degree relationship as the actual depth of field of the pixel to be determined.
[0106] The calibration module 300 is used to calibrate multiple sets of corresponding depth of field and modulation degree at each focal length. The modulation degree at two focal lengths corresponding to the same depth of field is subtracted to obtain the calibrated differential modulation degree. The depth of field-differential modulation degree relationship is determined based on multiple sets of corresponding depth of field and calibrated differential modulation degree.
[0107] The depth-of-field determination module 2 is electrically connected to both the acquisition module 100 and the calibration module 300, and the acquisition module 100 is connected to the calibration module 300. The two focal lengths corresponding to the depth-of-field-differential modulation degree relationship are consistent with the two focal lengths corresponding to the measured differential modulation degree, and the preset position is located in the depth-of-field interval of the depth-of-field-modulation degree relationship.
[0108] Furthermore, the acquisition module 100 is also used for image acquisition in the calibration step, that is, to execute step S210, which projects the striped image onto the calibration plate after transmission through the telecentric lens and the semi-transparent mirror, and acquires the projected image reflected on the calibration plate at multiple calibration positions at each focal length through reflection by the telecentric zoom lens and the semi-transparent mirror. The calibration module 300 is also used to execute step S220, which uses each calibration position as the depth of field, calculates the calibration modulation degree pixel by pixel based on several calibration images at the same depth of field (i.e., calibration position) at each focal length, and uses the difference between two calibration modulation degrees at two different focal lengths at the same depth of field as the calibration differential modulation degree, and determines the depth-of-field modulation degree relationship and the depth-of-field differential modulation degree relationship based on the focal length corresponding to each pixel, the depth of field, the calibration modulation degree, and the calibration differential modulation degree.
[0109] Continue to refer to Figure 3 As described above, the acquisition module 100 includes: a projection device 10 and a telecentric lens 20 coaxially arranged and interconnected, a telecentric zoom lens 30 and an image acquisition device 40 coaxially arranged and interconnected, and a semi-transparent mirror 50. The optical axis of the telecentric lens 20 and the optical axis of the telecentric zoom lens 30 are perpendicular, and both are at a 45-degree angle to the semi-transparent mirror 50. Using this acquisition module 100 can improve the accuracy of 3D reconstruction while minimizing the space occupied by the module, thus increasing the flexibility of reconstructing the object under test in confined spaces. Furthermore, the acquisition module 100 also includes an electrically driven displacement platform 70, which is arranged along the optical axis of the telecentric lens 20 and located on the reflecting side of the semi-transparent mirror 50.
[0110] The projection device 10 can be a projector, and the image acquisition device 40 can be a camera. In some projection devices 10, the intensity of the light they project is too high. In order to prevent damage to the image acquisition device 40 and improve the quality of the acquired image, preferably, the acquisition module 100 also includes a polarizer. The polarizer is disposed between the telecentric lens 20 and the projection device 10, or disposed on the light-emitting side of the telecentric lens 20.
[0111] The present invention also provides a three-dimensional reconstruction system, including a determining unit and a reconstruction module as described in any of the above embodiments. The reconstruction module is connected to the determining unit and is used to perform three-dimensional reconstruction of the object under test based on the actual depth of each pixel to be determined.
[0112] The present invention also provides an electronic device including the three-dimensional reconstruction system described in the above embodiments. This electronic device includes a biomedical imaging device, an industrial inspection device, or a microscopic forming device. The electronic device employing this three-dimensional reconstruction system can improve imaging accuracy, thereby enhancing the precision of medical diagnosis or operation when applied to biomedical imaging devices, improving detection accuracy when applied to industrial inspection devices, and providing a more intuitive and realistic view of the observed object when applied to microscopic imaging devices, thus facilitating further image analysis.
[0113] In addition, the present invention provides a computer-readable storage medium, such as a chip or optical disc, on which a computer program is stored. When the computer program is executed by a processor, it can implement the determination method or the three-dimensional reconstruction method described in any of the above embodiments.
[0114] It will be understood by those skilled in the art that the above-described preferred solutions can be freely combined and superimposed without conflict. The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings; for example, two consecutively indicated blocks may actually be executed substantially in parallel, or sometimes in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. The numbering of each step in this document is for ease of explanation and reference only and is not intended to limit the order of execution. The specific execution order is determined by the technology itself, and those skilled in the art can determine various permissible and reasonable orders based on the technology itself.
[0115] It should be noted that the use of step numbers (letters or numbers) to refer to certain specific method steps in this invention is merely for the purpose of convenience and brevity in description, and is by no means intended to restrict the order of these method steps. Those skilled in the art will understand that the order of the relevant method steps should be determined by the technology itself and should not be unduly restricted by the existence of step numbers. Those skilled in the art can determine various permissible and reasonable orderings of steps based on the technology itself.
[0116] Those skilled in the art will understand that, without conflict, the above-mentioned preferred solutions can be freely combined and superimposed.
[0117] It should be understood that the above embodiments are merely exemplary and not restrictive. Various obvious or equivalent modifications or substitutions that can be made by those skilled in the art regarding the above details without departing from the basic principles of the present invention will be included within the scope of the claims of the present invention.
Claims
1. A method for determining pixel depth of field in 3D reconstruction, characterized in that, Including the following steps: S110: The striped image is transmitted through a telecentric lens and a semi-transparent mirror and then projected onto the surface of the object to be tested. The projected images reflected by the object to be tested are collected at two different focal lengths by the reflection of the telecentric zoom lens and the semi-transparent mirror. At each focal length, the object to be tested is placed at a preset position in the optical axis direction of the telecentric lens and several real-shot images are collected. The depth of field for each pixel is determined as follows: S120: Calculate the corresponding measured modulation degree based on several real-captured images at each focal length, subtract the two measured modulation degrees to obtain the measured differential modulation degree, and take the depth of field corresponding to the measured differential modulation degree in the corresponding depth of field-differential modulation degree relationship as the actual depth of field. The depth-of-field-differential modulation relationship is obtained through a calibration step. In the calibration step, multiple sets of corresponding depth of field and modulation degrees are calibrated for each focal length. The modulation degrees of two focal lengths corresponding to the same depth of field are subtracted to obtain the calibrated differential modulation degree. The depth-of-field-differential modulation degree relationship is determined based on the multiple sets of corresponding depth of field and calibrated differential modulation degrees. The two focal lengths corresponding to the depth-of-field-differential modulation degree relationship are consistent with the two focal lengths corresponding to the measured differential modulation degree. The preset position is located within the depth of field range of the depth-of-field-modulation degree relationship.
2. The determination method according to claim 1, characterized in that, The calibration process includes the following steps: S210: The striped image is transmitted through a telecentric lens and a semi-transparent mirror and then projected onto a calibration plate. The projected image reflected by the calibration plate is acquired at multiple calibration positions at each focal length through the reflection of the telecentric zoom lens and the semi-transparent mirror. Several calibration images are acquired at each calibration position for each focal length, and the multiple calibration positions are distributed along the optical axis of the telecentric lens. S220: Using each of the calibration positions as the depth of field, calculate the calibration modulation degree pixel by pixel based on several calibration images at the same depth of field for each of the focal lengths, and use the difference between the two calibration modulation degrees at two different focal lengths for the same depth of field as the calibration differential modulation degree at these two focal lengths. Determine the depth of field-modulation degree relationship and the depth of field-differential modulation degree relationship based on the focal length, depth of field, calibration modulation degree, and calibration differential modulation degree corresponding to each pixel.
3. The determination method according to claim 2, characterized in that, The depth-of-field-differential modulation relationship is represented by a curve. The part with the largest slope in each depth-of-field-differential modulation curve corresponding to each pixel is selected as the judgment segment. The preset position in step 110 is located in the judgment segment corresponding to the two focal lengths.
4. The determination method according to claim 2, characterized in that, Both the depth-of-field-tone regulation relationship and the depth-of-field-differential tone regulation relationship are represented by curves; the number of focal lengths in step S210 is greater than or equal to 3; step S220 includes the following steps: S221: Calculate the calibration modulation degree pixel by pixel based on a number of calibration images with each focal length at the same depth of field, and calculate the difference between the two calibration modulation degrees of two adjacent focal lengths at the same depth of field as the calibration differential modulation degree. Determine the depth of field-modulation degree curve and the depth of field-differential modulation degree curve based on the focal length, the preset position, the calibration modulation degree, and the calibration differential modulation degree corresponding to each pixel. S222: Select the part with the largest slope in each depth-of-field-differential modulation curve corresponding to each pixel as the judgment segment, select the average depth of field at the beginning and end of the judgment segment as the judgment depth of field, and take the modulation degree of the judgment depth of field on the depth-of-field-modulation curve corresponding to the depth-of-field-differential modulation curve as the judgment modulation degree. In this way, multiple judgment groups are obtained for each pixel. Each judgment group includes a first focal length and a second focal length, the depth-of-field-differential modulation curves corresponding to the two, the depth-of-field-modulation curve corresponding to the first focal length, and the judgment modulation degree. In step S110, if the projection image on the object under test is also acquired at other focal lengths in step S210 through the reflection of the telecentric zoom lens and the semi-transparent semi-reflective mirror; S120 includes the following steps: S121: Select the i-th determination group corresponding to the undetermined pixel as the current determination group, and select several real-sampled images corresponding to the first focal length in the current determination group to calculate the first measured modulation index T. 实i Determine the first measured adjustment system T 实i Whether it is greater than or equal to the determination modulation T 判i If so, calculate the second measured modulation index T based on several real-shot images corresponding to the second focal length. 实i+1 The first actual measurement adjustment system T 预 i and the second measured regime T 预i+1 The difference in depth of field is taken as the actual depth of field of the pixel to be determined in the depth-difference modulation curve; otherwise, proceed to S122. S122: Determine the first measured modulation index T 实i If the value is greater than the preset value, calculate the third measured modulation index T based on several real-shot images corresponding to the second focal length in the (i+1)th judgment group. 实i+2 The second actual measurement adjustment system T 实i+1 and the third actual measurement adjustment system T 实i+2 The difference is taken as the actual depth of the pixel to be determined on the depth-difference modulation curve of the (i+1)th determination group; otherwise, i is incremented by 1, and the process returns to step S121 until the actual depth of the pixel to be determined is obtained.
5. The determination method according to claim 4, characterized in that, In step S222, the method for determining the determination segment includes: Select a sub-segment from the peak to the trough in the depth-of-field differential modulation curve, and extract several portions of a preset length range from the sub-segment as pre-judgment sub-segments. Calculate the slope of each pre-judgment sub-segment, and select the pre-judgment sub-segment with the largest slope as the judgment segment.
6. The determination method according to claim 2, characterized in that, In step S210, the multiple calibration positions are set at equal intervals, and the multiple calibration positions at each focal length are consistent.
7. The determination method according to claim 1, characterized in that, The telecentric zoom lens is an electronic zoom lens; in steps S110 and S120, different focal lengths are achieved by adjusting the current of the electronic zoom lens.
8. The determining method according to any one of claims 1-7, characterized in that, The test object and the calibration plate are respectively placed on an electric displacement platform, and the calibration plate is positioned at different calibration positions by controlling the electric displacement platform.
9. A three-dimensional reconstruction method, characterized in that, The object under test is reconstructed in three dimensions by using the actual depth of field of each pixel to be determined according to any one of claims 1-8.
10. A pixel depth-of-field determination unit in three-dimensional reconstruction, characterized in that, include: The acquisition module is used to project the striped image onto the surface of the object under test after it is transmitted through a telecentric lens and a semi-transparent semi-reflective mirror. The projected image reflected by the object under test is acquired at two different focal lengths through the telecentric zoom lens and the reflecting side of the semi-transparent semi-reflective mirror. At each focal length, the object under test is placed at a preset position in the optical axis direction of the telecentric lens and several real-time images are acquired. The depth-of-field determination module is used to calculate the corresponding measured modulation degree based on several real-captured images at each focal length, subtract the two measured modulation degrees to obtain the measured differential modulation degree, and take the depth of field corresponding to the measured differential modulation degree in the corresponding depth-of-field-differential modulation degree relationship as the actual depth of field of the pixel to be determined. The two focal lengths corresponding to the depth-of-field-differential modulation degree relationship are consistent with the focal lengths corresponding to the measured differential modulation degree. The calibration module is used to calibrate multiple sets of corresponding depth of field and modulation degree at each focal length, and to obtain the calibration differential modulation degree by subtracting the modulation degree at two focal lengths corresponding to the same depth of field, and to determine the depth of field-differential modulation degree relationship based on multiple sets of corresponding depth of field and calibration differential modulation degree. The preset position is located within the depth range of the depth-to-focus relationship.
11. The determining unit according to claim 10, characterized in that, The acquisition module is also used to project the stripe image onto the calibration plate after it is transmitted through a telecentric lens and a semi-transparent mirror. The projected image on the calibration plate is acquired at multiple calibration positions at each focal length through the reflective side of the telecentric zoom lens and the semi-transparent mirror. Several calibration images are acquired at each calibration position for each focal length, and the multiple calibration positions are distributed along the optical axis of the telecentric lens. The calibration module is further configured to use each calibration position as the depth of field, calculate the calibration modulation degree pixel by pixel based on several calibration images at the same depth of field with each focal length, and use the difference between the two calibration modulation degrees at two different focal lengths with the same depth of field as the calibration differential modulation degree, and determine the depth of field-modulation degree relationship and the depth of field-differential modulation degree relationship based on the focal length, depth of field, calibration modulation degree, and calibration differential modulation degree corresponding to each pixel.
12. The determining unit according to claim 10 or 11, characterized in that, The acquisition module includes: A projection device and a telecentric lens are coaxially arranged and interconnected, a telecentric zoom lens and an image acquisition device are coaxially arranged and interconnected, and a semi-transparent and semi-reflective mirror is provided. The optical axis of the telecentric lens and the optical axis of the telecentric zoom lens are perpendicular, and both are at a 45-degree angle to the semi-transparent and semi-reflective mirror. The transmission side of the semi-transparent and semi-reflective mirror faces the telecentric lens, and the reflection side faces the telecentric zoom lens.
13. The determining unit according to claim 12, characterized in that, The acquisition module also includes an electric displacement platform, which is arranged along the optical axis of the telecentric lens and located on the reflecting side of the semi-transparent mirror.
14. The determining unit according to claim 12, characterized in that, The acquisition module also includes a polarizer, which is disposed between the telecentric lens and the projection device, or on the light-emitting side of the telecentric lens.
15. A three-dimensional reconstruction system, characterized in that, include: The determining unit as described in any one of claims 10-14; The reconstruction module is used to perform three-dimensional reconstruction of the object under test based on the actual depth of field of each pixel to be determined.
16. An electronic device, characterized in that, Includes the three-dimensional reconstruction system as described in claim 15.
17. The electronic device according to claim 16, characterized in that, The electronic device includes biomedical imaging equipment, industrial testing equipment, or microscopic imaging equipment.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it can implement the determination method as described in any one of claims 1-8 or the three-dimensional reconstruction method as described in claim 9.