# Gamma Precorrection and Phase Error Compensation Methods Based on Three-Frequency with Three-Phase Shift

Authors: Wei Feng; Shaojing Tang; Shinan Xu; Tong Qu; Daxing Zhao
Journal: International Journal of Optics
 (2021)

---

## Abstract

Digital fringe projection measurement technology has been widely used in computer vision and optical three-dimensional (3D) measurement. Considering the phase error caused by the gamma distortion and nonlinear error, the active gamma precorrection and phase error compensation methods based on the three-frequency with three-phase shifts are designed to reversely solve the initial phase and accurately compensate phase error. On the one hand, the gamma coefficient of the measurement system depends on precoding two groups of fringe sequences with different gamma coefficients to calculate the corresponded proportional coefficient of harmonic component. On the other hand, the phase error compensation method is designed to compensate the phase error and improve the accuracy and speed of phase calculation after gamma correction. Experiments show that the proposed precalibration gamma coefficient method can effectively reduce the sinusoidal error in nearly 80 percent which only needs fewer fringe patterns. Compared with the traditional three-frequency with four-phase shift method, the proposed method not only has higher phase accuracy and better noise resistance but also has good robustness and flexibility, which is not limited to the gamma distortion model.


---

## Body

## 1. Introduction

Digital fringe projection measurement technology has been widely used in computer vision and optical three-dimensional (3D) measurement because of the advantages in their noncontact operation and full-field inspection [1]. A series of preencoded sinusoidal fringes are projected onto the measured surface, and the sinusoidal fringes are modulated by the height distribution of the measured surface, also known as the deformed fringe; then, the phase method based on the multifrequency heterodyne is used to demodulate and calculate the phase distribution to obtain the 3D information of measured surface. This technology makes the structured light system more adaptive to operate. However, the brightness transfer function between the camera and the projector is not linear during the measurement process, and its gray function is usually nonlinear. Then, the nonlinear response of the input signal will become the large error source, which usually refers to the nonlinear gamma effect of the projection device. Gamma distortion will directly lead to the high harmonic component in the deformed fringes, which will affect the quality of the phase solution and bring measurement error to the 3D information. More digital fringe patterns may reduce some high-order harmonic components and improve the measurement accuracy, but the more the projected fringe patterns, the slower the measurement speed, which is not desirable for high-speed measurement. Therefore, it is of great significance to correct the nonlinear gamma distortion and compensate phase error by projecting less fringe patterns and simultaneously maintaining the phase quality.At present, many scholars have carried out a lot of related research studies on the nonlinear correction and phase error compensation [2–8]. In general, the gamma correction method needs to calibrate the light intensity transfer function between the projector and the camera to correct the encoded fringe patterns which will be projected onto the measured surface. For example, Guo et al. [2] had estimated the gamma coefficient and corrected the phase by analyzing the cumulative distribution characteristics of the sinusoidal function, but this method assumed that the fullfiled gamma distortion coefficient of the fringe pattern must be the same constant. The discrete Fourier transform was used, and only two fringe patterns were needed to calibrate the gamma coefficient, but additional factors in many spaces would bring calibration gamma error [3]. On the contrary, the phase error compensation method had collected the sinusoidal fringe which had been modulated by the measured surface, and then, the gamma error model was established to compensate the phase error. Huang et al. [4] had proposed double three-step phase shifts’ technique to reduce the influence of gamma effect, but the optimization algorithm needed high-computational complexity and more phase shifts’ fringe patterns. Moreover, a method based on the statistical law with look-up-table (LUT) was put forward, but it needed to precalibrate the error distribution to construct the LUT or estimate the error coefficient [5]. In addition, the defocused method no longer projected sinusoidal fringe patterns but needed binary fringe patterns in the defocused mode of the projector. Li et al. [6] had introduced the defocus factor of the projection equipment. However, this method needed to project at least sixteen fringe patterns to accurately estimate the coefficients of Fourier series, and the whole gamma precalibration process was time-consuming. The high-speed 3D shape measurement method for dynamic scenes by using bifrequency tripolar pulse-width-modulation fringe projection was designed to generate ideal fringe patterns with slight defocus, but the gamma correction of projector and camera response nonlinearity would also affect the phase unwrapping [7]. A six-step phase-shifting technique for a structured light measurement system with an off-the-shelf projector was proposed to compensate the gamma nonlinearity, but the method was no longer applicable if the measurement setup included a special projector with a gamma value greater than four [8]. In a word, the current approaches still have certain limitations [9–15]. For example, too many fringes are needed to calculate the gamma coefficient, but the process is complicated; the phase error compensation needs to calculate each phase error, and the number of phase shifts is also limited, so the calculation process is cumbersome.Aiming at the problem of the gamma effect and phase error compensation in digital fringe projection measurement, we propose a precoded method to calibrate the gamma coefficient which depends on precoding two groups of fringe sequences with different gamma values and calculating the corresponding harmonic component proportional coefficient. Moreover, a phase error compensation method based on the three-frequency with three-phase shifts’ heterodyne and phase offset is designed to reversely solve the initial phase and compensate the phase error. The experiment indicates that our method not only needs less projected fringe patterns and can effectively achieve high precision precalibration gamma coefficient but also can break through the limitation of the gamma distortion model and be compensated well, which will make the measurement system more flexible and operate easily.The rest of this paper is organized as follows. Section2 demonstrates the proposed method, which includes the principle of precoding calibration gamma coefficient and three-frequency with three-phase shifts’ error correction and compensation method. Section 3 describes the experiments and results in detail. Conclusions are presented in Section 4.


## 2. Methods

### 2.1. Principle of Precoding Calibration Gamma Coefficient

In the digital fringe projection measurement system, gamma distortion will lead to the distortion of sinusoidal fringe, as shown in Figure1, and the gray level of the n steps phase shifts patterns captured by the camera can be expressed aswhere (x, y) is the coordinate point in the captured image, M (x, y) is the ambient light intensity and usually calculated as a constant coefficient, B (x, y) is the modulation intensity of the fringe, and f is the spatial frequency of the fringe. φ(x, y) is the phase to be demodulated, which is calculated by equation (2), θn (x, y) is the phase shifts value, γ is the gamma coefficient of the measurement system, and Bk is the k (k = 1, 2, 3, …, N) order harmonic component coefficient of the sinusoidal fringe signal, n = 0, 1, …, N-1 is the phase shifts sequence number, and N is the maximum phase shifts’ steps.Figure 1
The schematic diagram of the distortion gamma sinusoidal signals.(1)Inx,y=Mx,y+Bx,y×cos2πfx+φx,y+θnx,yγ,=Mx,y+∑k=−∞+∞Bkx,ycosk×2πfx+φx,y+θnx,y,(2)φx,y=arctan∑n=1NInx,ysin2πn−1/N∑n=1NInx,ycos2πn−1/N,Formula (1) denotes that the gamma effect will cause the nonsinusoidal signal error of original fringe patterns and high-order harmonic components, and the coefficients of each order harmonic component are essentially functions of coefficient γ in the measurement system [16]. Therefore, the precoding calibration algorithm is designed to calculate the gamma coefficients γ and complete the precalibration gamma correction of the measurement in this paper. The principle can be described as follows.WhenBk ≠ 0, the ratio of the k + 1- and k-order harmonic component of the sinusoidal signal can be expressed as(3)Bk+1Bk=γ−kγ+k+1.Formula (3) has established the relationship between the gamma coefficient γ and the harmonic component coefficients Bk to compensate the nonlinear of the distorted sinusoidal fringes. It is further proved that Bk converges uniformly for any γ > 0 and the amplitude of harmonic component decreases rapidly with the increase of harmonic order. Therefore, if γ is an integer, the harmonic component which is higher than γ will not be generated. Since the estimation of higher order harmonic components has the error which increases the harmonic order, it is necessary to calibrate the gamma coefficient γ of the measurement system with smaller harmonic coefficient.The gamma coefficientγ will be obtained and calibrated through formula (3). Therefore, the idea of precoding correction is adopted to use the calibrated gamma coefficient to correct sinusoidal fringes in advance on the projection pixel plane. The nonsinusoidal fringes with gamma correction are generated on the projection plane so that the fringes are sinusoidal under the influence of the nonlinear gamma effect of the projector.With further analysis, formula (3) is derived and calculated from the gamma distortion model of the measurement system. In the process of actual measurement, there is also defocusing problem of the projection equipment [7, 17]. Therefore, the Gaussian model of point diffusion function (PDF) was used to describe defocus to perfect the gamma nonlinear model of the projection equipment [18]. The mathematical relationship between the fringe harmonic coefficient Bk∧and the harmonic coefficient Bk caused by gamma effect can be expressed as(4)Bk+1∧Bk∧=exp−2πσ22k+1f02×Bk+1Bk=exp−2πσ22k+1f02γ−kγ+k+1.Bk+1∧ and Bk∧can be obtained from the spatial discrete Fourier transform of the sinusoidal fringe pattern. If the period of projected fringe and measurement system parameter are not changed, the parameters will not be changed in the actual measurement process. Then, the exponential term in formula (4) can be regarded as a constant. However, the solution of the two-variable defocusing factors σ and gamma coefficient γ requires two sets of equations, so two coefficients γ1 and γ2 are preencoded on the projection pixel plane. Since the projected fringes are nonsinusoidal fringes, two sets of digital fringe patterns are obtained through the nonlinear output of the projector. On the basis of the above analysis, we set k = 1, and γ can be calculated by formulas (5) and (6):(5)B∧2γ1B∧1γ1=exp−6πσ2f02γγ1−1γγ1+2,B∧2γ2B∧1γ2=exp−6πσ2f02γγ2−1γγ2+2,(6)K−1γ1γ2γ2+2Kγ2−Kγ1−2γ1+γ2γ=2K−1,where K is the result of dividing the left end of formula (5). It can be seen that K will produce a small change because of the approximate calculation of the harmonic coefficient, which leads to the large change in the gamma calibration. Since the inconsistent performance of the hardware equipment, the gamma coefficient γ should be within one to three in the actual measurement process. If the precoding selected values γ1 and γ2 are too closer or the reciprocal of precoding value and the real value are close, there will be a large error in the gamma calibration. Our algorithm steps are shown in Figure 2.Step 1: precode the fringe pattern sequences. Two groups of digital fringe pattern sequences with different Gamma coefficients (i.e.,γ1 = 0.60 and γ2 = 1.00) are precoded, and each group has twelve patterns.Step 2: project the fringe pattern sequences. Precoding phase shifts’ fringe pattern sequences are sequentially projected to calibrate the plane.Step 3: capture the fringe pattern sequences. The precoding phase shifts’ pattern sequences are captured by the camera, and the correspondingK values are calculated through formula (5).Step 4: calculate the gamma coefficientγ from formula (6).Step 5: generate corrected fringe patterns.γ is precoded into subsequent projection fringe patterns, that is, the fringe pattern with corrected gamma coefficient is generated and projected to the reference plane in turn.Step 6: end.Figure 2
The flowchart of the proposed calibration algorithm of the gamma coefficient.Moreover, it is worth noting that the proposed method can correct the gamma effect of the measurement system to a certain extent and improve the measurement accuracy, but the active precoding method still has inevitable phase errors, so we propose a method to solve the phase error problem in Section2.2.


### 2.2. Three-Frequency with Three-Phase Shifts’ Error Correction and Compensation Method

In digital fringe projection measurement technology, multifrequency heterodynes based on the phase shifts’ method is usually used to calculate the phase, but it needs to establish the gamma model, and the proposed precoding gamma coefficient calibration will also inevitably lead to the phase error. Therefore, a phase error compensation method based on the three-frequency with three-phase shifts and phase offset is designed to compensate the phase error and improve the accuracy of phase calculation after gamma correction. Our method not only effectively reduces the noise interference but also reduces the number of projection fringe patterns and improves the measurement speed, and it will be widely used in various 3D measurement fields by further research.


#### 2.2.1. Reverse Calculation Initial Phase Method Based on Three-Frequency with Three-Phase Shifts

The multifrequency heterodyne method usually projects sinusoidal fringe pattern sequence with multifrequency to measure the object, and then, a set of phase distribution with smaller frequency will be obtained from their heterodyne calculation [19, 20]. Therefore, it is necessary to select both the sinusoidal fringe with appropriate frequency and the appropriate period T1, T2, and T3. Then, the period width after superposition is larger than the width of projected fringe pattern, that is, T123 > 1. The projection width of the projector is 1140 pixels in our experiment. Considering the above two factors and making the numbers of projected fringe patterns as less as possible, the three-frequency with the three-phase shifts’ method is designed to increase the measurement speed, that is, each group of fringe sequences has three-phase shifts with different frequencies. The period width of the three-frequency fringe patterns with three-phase shifts is(7)T1=14pixelsT2=15pixelsT3=16pixels(8)Te=T1×T2T2−T1.The superposition periodTe can be calculated by formula (8), and the equivalent period after superposition can be solved as(9)T12=210pixels,T23=240pixels,T123=1680pixels.The three-frequency with four-phase shifts’ method needs to project three groups of fringe patterns with different frequencies, and 12 fringe patterns are used to calculate the phase by the four-step phase shifts’ method. In the actual measurement process, the measurement speed and noise factors also need to be considered. Therefore, the three-frequency with three-phase shifts’ method is proposed, that is, the projector projects three groups of fringe patterns with different frequencies to calculate the phase by three-phase shifts’ method. So, only a total of 9 fringe patterns are needed, which can obviously improve the measurement speed. Meanwhile, unlike the traditional multifrequency heterodyne using heterodyne phase Φ123 to reconstruct 3D information, we proposed that the initial phase is calculated by using three-frequency with three-phase shifts’ reverse solution, which can reduce the phase error. For the three-step phase shifts, the increment of each phase shift is(10)In=Ia+Ibcosφ+2qπ3,q=0,1,2,where In represents the intensity distribution of the fringe pattern, Ia is the intensity mean, Ib represents the amplitude modulation, and φ is the initial phase. Then, the theoretical value of the wrapped phase can be solved as(11)φ=arctan3I1−I32I2−I1−I3.Reverse solution of the initial phase is calculated from the final heterodyne phase Φ123; then, the absolute phase is calculated reversely corresponding to the second and the first heterodyne phases, so the absolute phase is finally obtained corresponding to the initial wrapped phase. The absolute phase with small period will be used for 3D reconstruction.The key to the reverse solution of the initial phase is to calculate the seriesk (x, y) of each the wrapped phase and the corresponding equivalent period. The solution of the series k (x, y) is adopted as the following two formulas:(12)kx,y=roundTA/TB×ΦA−φB2π,(13)kx,y=floorTA/TBΦA−φB2π+0.5,where round represents rounding, ΦA represents the absolute phase calculated by the fringe pattern with larger period, φB is the wrapped phase to be obtained, TA is the larger period, TB is the smaller period, and floor represents the downward rounding. Formula (12) is used to reduce the noise interference when the noise of the fringe pattern is large and calculate the corresponding series k (x, y). Formula (13) is used when the noise of the fringe pattern is small.The absolute phase can be obtained from(14)Φx,y=φx,y+2π×kx,y.The reverse calculation initial phase method based on three-frequency with three-phase shifts’ algorithm is described as follows:Step 1: the absolute phase Φ123 (x, y) is used to unwrap the wrapped phase φ23(x, y), the series k23(x, y) is obtained by formula (12), and the absolute phase Φ23 (x, y) is obtained by formula (14).Step 2: the absolute phase Φ23 (x, y) is used to unwrap the wrapped phase φ12(x, y), the series k12(x, y) is obtained by formula (12), and the absolute phase Φ12 (x, y) is obtained by formula (14).Step 3: the absolute phase Φ12 (x, y) is used to unwrap the wrapped phase φ3(x, y), the series k3(x, y) is obtained by formula (12), and the absolute phase Φ3 (x, y) is obtained by formula (14).Step 4: the absolute phase Φ3(x, y) is used to unwrap the wrapped phase φ2(x, y), the series k2 (x, y) is obtained by formula (12), and the absolute phase Φ2 (x, y) is obtained by formula (14).Step 5: the absolute phase Φ2(x, y) is used to unwrap the wrapped phase φ1(x, y), the series k1 (x, y) is obtained by formula (12), and the absolute phaseΦ1 (x, y) is obtained by formula (14).Step 6: the obtainedk1 (x, y) in the Step 5 is combined with wrapped phase of the first set of frequencies. The absolute phase of the first of frequencies is calculated by formula (14), that is, the absolute phase Φfinal(x, y) is required for reconstruction.


#### 2.2.2. Phase Error Compensation Method Based on Phase Offset

As mentioned above, this paper proposes a reverse solution of initial phase based on three-frequency with three-phase shifts’ method. Although the solution of the absolute phase is fast and robust, the distortion of the sinusoidal fringe pattern caused by nonlinear response of acquisition equipment and gamma nonlinearity of projection equipment will also lead to the phase error. Hence, the compensation algorithm based on the phase offset is proposed for three-frequency with three-phase shifts’ method.In order to facilitate the analysis and process of the image, the gray level of the fringe patterns can be represented by(15)Inx,y=A+Bcos2πfx+φx,y+δn,where A corresponds the direct current (DC) term and ambient light intensity reflected by the object and B represents the modulation or contrast of the fringes; they are usually constant. f is the frequency of sinusoidal fringe, φ (x, y) only contains phase information, and δn represents the phase shifts of the fringe pattern. During the experiment, we use the three-frequency with the three-phase shifts’ method, so the specific phase shifts values are −2π/3, 0, 2π/3.The intensity distribution of the projected fringe pattern can be expressed by(16)Ipx,y=fpInx,y,where fp is the projector mapping function relationship between the input signal and the output signal. Assuming that the intensity of ambient light on the measured surface is Ia and the reflectivity of the measured surface is r, so the light intensity distribution captured by the photosensitive elements of the industrial camera is(17)Irx,y=rIpx,y+Iax,y.Similarly, iffc is used as the nonlinear response function between the input and output signals of the industrial camera and the ambient light intensity is Ia′, the output image of the camera can be expressed as(18)Icx,y=fcIrx,y+Ia′x,y.When the camera produces the phenomenon of energy ratio imbalance in the process of photoelectric signal conversion, the conversion function of the camera is a nonlinear function. Factors that have the greatest influence on camera nonlinear response include second-order and third-order nonlinear signal response. Therefore, the nonlinear response of the camera can be expressed by(19)Icx,y=q3Irx,y+Ia′x,y3+q2Irx,y+Ia′x,y2+q1Irx,y+Ia′x,y+q0.q3, q2, q1, and q0 are the fitting coefficients. If the gamma coefficient γ of the measurement system is considered and formula (19) is substituted into formulas (18) and (16), then it will be transferred as follows:(20)Icx,y=k3Inx,y3γ+k2Inx,y2γ+k1Inx,yγ+k0.k3, k2, k1, and k0 are also the fitting coefficients after transformation calculation in formula (20). It is concluded that there is actually a nonlinear response of order 3γ in the measurement system. On the contrary, the higher order nonlinearity of the system can be represented through the higher harmonics of the system. Therefore, the image response equation of the measurement system can be expressed as(21)Icx,y=fInx,y=A+∑k=1kAkcoskφx,y+δn,where Ak is the harmonic coefficient and k is the maximum number of harmonics. Furthermore, through these above derivations, the phase distribution of the phase diagram can be calculated:(22)φx,y=−arctan∑N=0N−1A+∑k=1kAkcoskφx,y+δnsinδn∑N=0N−1A+∑k=1kAkcoskφx,y+δncosδn.Generally, the error with more than the fifth harmonic is small and negligible, so the value range ofk is generally less than 5. The three-step phase shifts method was used to calculate the principal phase in the experiment, and the calculation of the wrapped phase is expressed by(23)φx,y=arctanA1sinφx,y−A2sin2φx,y+A4sin4φx,y−A5sin5φx,yA1cosφx,y−A2cos2φx,y+A4cos4φx,y−A5cos5φx,y,where Ai (i = 1, 2, 4, 5) is the coefficient of the i order harmonic. The ideal phase can be expressed as(24)φx,y=φ′x,y−Δφx,yThe phase error is able to be obtained by combining formulas (23) and (24):(25)Δφx,y=arctan−A2−A1sin3φx,y−A5sin6φx,yA1+A2+A4cos3φx,y+A5cos5φx,y≅−m1sin3φx,y−m2sin6φx,ywhere m1 and m2 are constants and m2 is negligible compared with m1; then, formula (25) can be expressed as(26)Δφx,y≅−m1sin3φx,yIf we do not consider the influence of the fifth harmonic, we should fit the phase error formula as follows:(27)Δφx,y≅−m1sin3φx,y1+cos3φx,yIn the experiment,−m1/1+cos3φx,y is constant fluctuation in 2π period, so we set k=−m1/1+cos3φx,y; then, the phase error can be expressed as follows:(28)Δφx,y≅ksin3φx,yAccording to the above analysis, the phase error is determined by phaseφ and parameter k in our method. If an initial phase offset is introduced into the phase shifts’ fringe pattern, the phase error will also change accordingly.The core idea of the proposed method is that the sequence of fringe patterns with an initial phase offset difference ofπ/3 is designed, that is, a set of compensation fringe patterns should be added on the basis of the projection fringe pattern sequence. The phase error of the corresponding wrapped phase can be expressed as follows:(29)Δφ′x,y≅ksin3φx,y−π3≅−ksin3φx,yIt is not difficult to find that the phase error has the equation Δφ(x, y) + Δφ′(x, y) = 0. Therefore, if there are three different periods and −π/3 initial phase offsets for the projection fringe patterns, it has nine patterns. The sinusoidal fringe pattern has a phase angle difference of 2π/3; then, the corresponded original wrapped phase and the wrapped phase of the compensation fringe are calculated by the three-step phase shifts’ method. After that, two groups of wrapped phases are added together. The phase error due to the gamma nonlinear effects of the projector is eliminated. After a lot of experiments, the k value is Nπ, and N is the maximum phase shifts’ numbers obtained during the measurement.


## 2.1. Principle of Precoding Calibration Gamma Coefficient

In the digital fringe projection measurement system, gamma distortion will lead to the distortion of sinusoidal fringe, as shown in Figure1, and the gray level of the n steps phase shifts patterns captured by the camera can be expressed aswhere (x, y) is the coordinate point in the captured image, M (x, y) is the ambient light intensity and usually calculated as a constant coefficient, B (x, y) is the modulation intensity of the fringe, and f is the spatial frequency of the fringe. φ(x, y) is the phase to be demodulated, which is calculated by equation (2), θn (x, y) is the phase shifts value, γ is the gamma coefficient of the measurement system, and Bk is the k (k = 1, 2, 3, …, N) order harmonic component coefficient of the sinusoidal fringe signal, n = 0, 1, …, N-1 is the phase shifts sequence number, and N is the maximum phase shifts’ steps.Figure 1
The schematic diagram of the distortion gamma sinusoidal signals.(1)Inx,y=Mx,y+Bx,y×cos2πfx+φx,y+θnx,yγ,=Mx,y+∑k=−∞+∞Bkx,ycosk×2πfx+φx,y+θnx,y,(2)φx,y=arctan∑n=1NInx,ysin2πn−1/N∑n=1NInx,ycos2πn−1/N,Formula (1) denotes that the gamma effect will cause the nonsinusoidal signal error of original fringe patterns and high-order harmonic components, and the coefficients of each order harmonic component are essentially functions of coefficient γ in the measurement system [16]. Therefore, the precoding calibration algorithm is designed to calculate the gamma coefficients γ and complete the precalibration gamma correction of the measurement in this paper. The principle can be described as follows.WhenBk ≠ 0, the ratio of the k + 1- and k-order harmonic component of the sinusoidal signal can be expressed as(3)Bk+1Bk=γ−kγ+k+1.Formula (3) has established the relationship between the gamma coefficient γ and the harmonic component coefficients Bk to compensate the nonlinear of the distorted sinusoidal fringes. It is further proved that Bk converges uniformly for any γ > 0 and the amplitude of harmonic component decreases rapidly with the increase of harmonic order. Therefore, if γ is an integer, the harmonic component which is higher than γ will not be generated. Since the estimation of higher order harmonic components has the error which increases the harmonic order, it is necessary to calibrate the gamma coefficient γ of the measurement system with smaller harmonic coefficient.The gamma coefficientγ will be obtained and calibrated through formula (3). Therefore, the idea of precoding correction is adopted to use the calibrated gamma coefficient to correct sinusoidal fringes in advance on the projection pixel plane. The nonsinusoidal fringes with gamma correction are generated on the projection plane so that the fringes are sinusoidal under the influence of the nonlinear gamma effect of the projector.With further analysis, formula (3) is derived and calculated from the gamma distortion model of the measurement system. In the process of actual measurement, there is also defocusing problem of the projection equipment [7, 17]. Therefore, the Gaussian model of point diffusion function (PDF) was used to describe defocus to perfect the gamma nonlinear model of the projection equipment [18]. The mathematical relationship between the fringe harmonic coefficient Bk∧and the harmonic coefficient Bk caused by gamma effect can be expressed as(4)Bk+1∧Bk∧=exp−2πσ22k+1f02×Bk+1Bk=exp−2πσ22k+1f02γ−kγ+k+1.Bk+1∧ and Bk∧can be obtained from the spatial discrete Fourier transform of the sinusoidal fringe pattern. If the period of projected fringe and measurement system parameter are not changed, the parameters will not be changed in the actual measurement process. Then, the exponential term in formula (4) can be regarded as a constant. However, the solution of the two-variable defocusing factors σ and gamma coefficient γ requires two sets of equations, so two coefficients γ1 and γ2 are preencoded on the projection pixel plane. Since the projected fringes are nonsinusoidal fringes, two sets of digital fringe patterns are obtained through the nonlinear output of the projector. On the basis of the above analysis, we set k = 1, and γ can be calculated by formulas (5) and (6):(5)B∧2γ1B∧1γ1=exp−6πσ2f02γγ1−1γγ1+2,B∧2γ2B∧1γ2=exp−6πσ2f02γγ2−1γγ2+2,(6)K−1γ1γ2γ2+2Kγ2−Kγ1−2γ1+γ2γ=2K−1,where K is the result of dividing the left end of formula (5). It can be seen that K will produce a small change because of the approximate calculation of the harmonic coefficient, which leads to the large change in the gamma calibration. Since the inconsistent performance of the hardware equipment, the gamma coefficient γ should be within one to three in the actual measurement process. If the precoding selected values γ1 and γ2 are too closer or the reciprocal of precoding value and the real value are close, there will be a large error in the gamma calibration. Our algorithm steps are shown in Figure 2.Step 1: precode the fringe pattern sequences. Two groups of digital fringe pattern sequences with different Gamma coefficients (i.e.,γ1 = 0.60 and γ2 = 1.00) are precoded, and each group has twelve patterns.Step 2: project the fringe pattern sequences. Precoding phase shifts’ fringe pattern sequences are sequentially projected to calibrate the plane.Step 3: capture the fringe pattern sequences. The precoding phase shifts’ pattern sequences are captured by the camera, and the correspondingK values are calculated through formula (5).Step 4: calculate the gamma coefficientγ from formula (6).Step 5: generate corrected fringe patterns.γ is precoded into subsequent projection fringe patterns, that is, the fringe pattern with corrected gamma coefficient is generated and projected to the reference plane in turn.Step 6: end.Figure 2
The flowchart of the proposed calibration algorithm of the gamma coefficient.Moreover, it is worth noting that the proposed method can correct the gamma effect of the measurement system to a certain extent and improve the measurement accuracy, but the active precoding method still has inevitable phase errors, so we propose a method to solve the phase error problem in Section2.2.


## 2.2. Three-Frequency with Three-Phase Shifts’ Error Correction and Compensation Method

In digital fringe projection measurement technology, multifrequency heterodynes based on the phase shifts’ method is usually used to calculate the phase, but it needs to establish the gamma model, and the proposed precoding gamma coefficient calibration will also inevitably lead to the phase error. Therefore, a phase error compensation method based on the three-frequency with three-phase shifts and phase offset is designed to compensate the phase error and improve the accuracy of phase calculation after gamma correction. Our method not only effectively reduces the noise interference but also reduces the number of projection fringe patterns and improves the measurement speed, and it will be widely used in various 3D measurement fields by further research.


### 2.2.1. Reverse Calculation Initial Phase Method Based on Three-Frequency with Three-Phase Shifts

The multifrequency heterodyne method usually projects sinusoidal fringe pattern sequence with multifrequency to measure the object, and then, a set of phase distribution with smaller frequency will be obtained from their heterodyne calculation [19, 20]. Therefore, it is necessary to select both the sinusoidal fringe with appropriate frequency and the appropriate period T1, T2, and T3. Then, the period width after superposition is larger than the width of projected fringe pattern, that is, T123 > 1. The projection width of the projector is 1140 pixels in our experiment. Considering the above two factors and making the numbers of projected fringe patterns as less as possible, the three-frequency with the three-phase shifts’ method is designed to increase the measurement speed, that is, each group of fringe sequences has three-phase shifts with different frequencies. The period width of the three-frequency fringe patterns with three-phase shifts is(7)T1=14pixelsT2=15pixelsT3=16pixels(8)Te=T1×T2T2−T1.The superposition periodTe can be calculated by formula (8), and the equivalent period after superposition can be solved as(9)T12=210pixels,T23=240pixels,T123=1680pixels.The three-frequency with four-phase shifts’ method needs to project three groups of fringe patterns with different frequencies, and 12 fringe patterns are used to calculate the phase by the four-step phase shifts’ method. In the actual measurement process, the measurement speed and noise factors also need to be considered. Therefore, the three-frequency with three-phase shifts’ method is proposed, that is, the projector projects three groups of fringe patterns with different frequencies to calculate the phase by three-phase shifts’ method. So, only a total of 9 fringe patterns are needed, which can obviously improve the measurement speed. Meanwhile, unlike the traditional multifrequency heterodyne using heterodyne phase Φ123 to reconstruct 3D information, we proposed that the initial phase is calculated by using three-frequency with three-phase shifts’ reverse solution, which can reduce the phase error. For the three-step phase shifts, the increment of each phase shift is(10)In=Ia+Ibcosφ+2qπ3,q=0,1,2,where In represents the intensity distribution of the fringe pattern, Ia is the intensity mean, Ib represents the amplitude modulation, and φ is the initial phase. Then, the theoretical value of the wrapped phase can be solved as(11)φ=arctan3I1−I32I2−I1−I3.Reverse solution of the initial phase is calculated from the final heterodyne phase Φ123; then, the absolute phase is calculated reversely corresponding to the second and the first heterodyne phases, so the absolute phase is finally obtained corresponding to the initial wrapped phase. The absolute phase with small period will be used for 3D reconstruction.The key to the reverse solution of the initial phase is to calculate the seriesk (x, y) of each the wrapped phase and the corresponding equivalent period. The solution of the series k (x, y) is adopted as the following two formulas:(12)kx,y=roundTA/TB×ΦA−φB2π,(13)kx,y=floorTA/TBΦA−φB2π+0.5,where round represents rounding, ΦA represents the absolute phase calculated by the fringe pattern with larger period, φB is the wrapped phase to be obtained, TA is the larger period, TB is the smaller period, and floor represents the downward rounding. Formula (12) is used to reduce the noise interference when the noise of the fringe pattern is large and calculate the corresponding series k (x, y). Formula (13) is used when the noise of the fringe pattern is small.The absolute phase can be obtained from(14)Φx,y=φx,y+2π×kx,y.The reverse calculation initial phase method based on three-frequency with three-phase shifts’ algorithm is described as follows:Step 1: the absolute phase Φ123 (x, y) is used to unwrap the wrapped phase φ23(x, y), the series k23(x, y) is obtained by formula (12), and the absolute phase Φ23 (x, y) is obtained by formula (14).Step 2: the absolute phase Φ23 (x, y) is used to unwrap the wrapped phase φ12(x, y), the series k12(x, y) is obtained by formula (12), and the absolute phase Φ12 (x, y) is obtained by formula (14).Step 3: the absolute phase Φ12 (x, y) is used to unwrap the wrapped phase φ3(x, y), the series k3(x, y) is obtained by formula (12), and the absolute phase Φ3 (x, y) is obtained by formula (14).Step 4: the absolute phase Φ3(x, y) is used to unwrap the wrapped phase φ2(x, y), the series k2 (x, y) is obtained by formula (12), and the absolute phase Φ2 (x, y) is obtained by formula (14).Step 5: the absolute phase Φ2(x, y) is used to unwrap the wrapped phase φ1(x, y), the series k1 (x, y) is obtained by formula (12), and the absolute phaseΦ1 (x, y) is obtained by formula (14).Step 6: the obtainedk1 (x, y) in the Step 5 is combined with wrapped phase of the first set of frequencies. The absolute phase of the first of frequencies is calculated by formula (14), that is, the absolute phase Φfinal(x, y) is required for reconstruction.


### 2.2.2. Phase Error Compensation Method Based on Phase Offset

As mentioned above, this paper proposes a reverse solution of initial phase based on three-frequency with three-phase shifts’ method. Although the solution of the absolute phase is fast and robust, the distortion of the sinusoidal fringe pattern caused by nonlinear response of acquisition equipment and gamma nonlinearity of projection equipment will also lead to the phase error. Hence, the compensation algorithm based on the phase offset is proposed for three-frequency with three-phase shifts’ method.In order to facilitate the analysis and process of the image, the gray level of the fringe patterns can be represented by(15)Inx,y=A+Bcos2πfx+φx,y+δn,where A corresponds the direct current (DC) term and ambient light intensity reflected by the object and B represents the modulation or contrast of the fringes; they are usually constant. f is the frequency of sinusoidal fringe, φ (x, y) only contains phase information, and δn represents the phase shifts of the fringe pattern. During the experiment, we use the three-frequency with the three-phase shifts’ method, so the specific phase shifts values are −2π/3, 0, 2π/3.The intensity distribution of the projected fringe pattern can be expressed by(16)Ipx,y=fpInx,y,where fp is the projector mapping function relationship between the input signal and the output signal. Assuming that the intensity of ambient light on the measured surface is Ia and the reflectivity of the measured surface is r, so the light intensity distribution captured by the photosensitive elements of the industrial camera is(17)Irx,y=rIpx,y+Iax,y.Similarly, iffc is used as the nonlinear response function between the input and output signals of the industrial camera and the ambient light intensity is Ia′, the output image of the camera can be expressed as(18)Icx,y=fcIrx,y+Ia′x,y.When the camera produces the phenomenon of energy ratio imbalance in the process of photoelectric signal conversion, the conversion function of the camera is a nonlinear function. Factors that have the greatest influence on camera nonlinear response include second-order and third-order nonlinear signal response. Therefore, the nonlinear response of the camera can be expressed by(19)Icx,y=q3Irx,y+Ia′x,y3+q2Irx,y+Ia′x,y2+q1Irx,y+Ia′x,y+q0.q3, q2, q1, and q0 are the fitting coefficients. If the gamma coefficient γ of the measurement system is considered and formula (19) is substituted into formulas (18) and (16), then it will be transferred as follows:(20)Icx,y=k3Inx,y3γ+k2Inx,y2γ+k1Inx,yγ+k0.k3, k2, k1, and k0 are also the fitting coefficients after transformation calculation in formula (20). It is concluded that there is actually a nonlinear response of order 3γ in the measurement system. On the contrary, the higher order nonlinearity of the system can be represented through the higher harmonics of the system. Therefore, the image response equation of the measurement system can be expressed as(21)Icx,y=fInx,y=A+∑k=1kAkcoskφx,y+δn,where Ak is the harmonic coefficient and k is the maximum number of harmonics. Furthermore, through these above derivations, the phase distribution of the phase diagram can be calculated:(22)φx,y=−arctan∑N=0N−1A+∑k=1kAkcoskφx,y+δnsinδn∑N=0N−1A+∑k=1kAkcoskφx,y+δncosδn.Generally, the error with more than the fifth harmonic is small and negligible, so the value range ofk is generally less than 5. The three-step phase shifts method was used to calculate the principal phase in the experiment, and the calculation of the wrapped phase is expressed by(23)φx,y=arctanA1sinφx,y−A2sin2φx,y+A4sin4φx,y−A5sin5φx,yA1cosφx,y−A2cos2φx,y+A4cos4φx,y−A5cos5φx,y,where Ai (i = 1, 2, 4, 5) is the coefficient of the i order harmonic. The ideal phase can be expressed as(24)φx,y=φ′x,y−Δφx,yThe phase error is able to be obtained by combining formulas (23) and (24):(25)Δφx,y=arctan−A2−A1sin3φx,y−A5sin6φx,yA1+A2+A4cos3φx,y+A5cos5φx,y≅−m1sin3φx,y−m2sin6φx,ywhere m1 and m2 are constants and m2 is negligible compared with m1; then, formula (25) can be expressed as(26)Δφx,y≅−m1sin3φx,yIf we do not consider the influence of the fifth harmonic, we should fit the phase error formula as follows:(27)Δφx,y≅−m1sin3φx,y1+cos3φx,yIn the experiment,−m1/1+cos3φx,y is constant fluctuation in 2π period, so we set k=−m1/1+cos3φx,y; then, the phase error can be expressed as follows:(28)Δφx,y≅ksin3φx,yAccording to the above analysis, the phase error is determined by phaseφ and parameter k in our method. If an initial phase offset is introduced into the phase shifts’ fringe pattern, the phase error will also change accordingly.The core idea of the proposed method is that the sequence of fringe patterns with an initial phase offset difference ofπ/3 is designed, that is, a set of compensation fringe patterns should be added on the basis of the projection fringe pattern sequence. The phase error of the corresponding wrapped phase can be expressed as follows:(29)Δφ′x,y≅ksin3φx,y−π3≅−ksin3φx,yIt is not difficult to find that the phase error has the equation Δφ(x, y) + Δφ′(x, y) = 0. Therefore, if there are three different periods and −π/3 initial phase offsets for the projection fringe patterns, it has nine patterns. The sinusoidal fringe pattern has a phase angle difference of 2π/3; then, the corresponded original wrapped phase and the wrapped phase of the compensation fringe are calculated by the three-step phase shifts’ method. After that, two groups of wrapped phases are added together. The phase error due to the gamma nonlinear effects of the projector is eliminated. After a lot of experiments, the k value is Nπ, and N is the maximum phase shifts’ numbers obtained during the measurement.


## 2.2.1. Reverse Calculation Initial Phase Method Based on Three-Frequency with Three-Phase Shifts

The multifrequency heterodyne method usually projects sinusoidal fringe pattern sequence with multifrequency to measure the object, and then, a set of phase distribution with smaller frequency will be obtained from their heterodyne calculation [19, 20]. Therefore, it is necessary to select both the sinusoidal fringe with appropriate frequency and the appropriate period T1, T2, and T3. Then, the period width after superposition is larger than the width of projected fringe pattern, that is, T123 > 1. The projection width of the projector is 1140 pixels in our experiment. Considering the above two factors and making the numbers of projected fringe patterns as less as possible, the three-frequency with the three-phase shifts’ method is designed to increase the measurement speed, that is, each group of fringe sequences has three-phase shifts with different frequencies. The period width of the three-frequency fringe patterns with three-phase shifts is(7)T1=14pixelsT2=15pixelsT3=16pixels(8)Te=T1×T2T2−T1.The superposition periodTe can be calculated by formula (8), and the equivalent period after superposition can be solved as(9)T12=210pixels,T23=240pixels,T123=1680pixels.The three-frequency with four-phase shifts’ method needs to project three groups of fringe patterns with different frequencies, and 12 fringe patterns are used to calculate the phase by the four-step phase shifts’ method. In the actual measurement process, the measurement speed and noise factors also need to be considered. Therefore, the three-frequency with three-phase shifts’ method is proposed, that is, the projector projects three groups of fringe patterns with different frequencies to calculate the phase by three-phase shifts’ method. So, only a total of 9 fringe patterns are needed, which can obviously improve the measurement speed. Meanwhile, unlike the traditional multifrequency heterodyne using heterodyne phase Φ123 to reconstruct 3D information, we proposed that the initial phase is calculated by using three-frequency with three-phase shifts’ reverse solution, which can reduce the phase error. For the three-step phase shifts, the increment of each phase shift is(10)In=Ia+Ibcosφ+2qπ3,q=0,1,2,where In represents the intensity distribution of the fringe pattern, Ia is the intensity mean, Ib represents the amplitude modulation, and φ is the initial phase. Then, the theoretical value of the wrapped phase can be solved as(11)φ=arctan3I1−I32I2−I1−I3.Reverse solution of the initial phase is calculated from the final heterodyne phase Φ123; then, the absolute phase is calculated reversely corresponding to the second and the first heterodyne phases, so the absolute phase is finally obtained corresponding to the initial wrapped phase. The absolute phase with small period will be used for 3D reconstruction.The key to the reverse solution of the initial phase is to calculate the seriesk (x, y) of each the wrapped phase and the corresponding equivalent period. The solution of the series k (x, y) is adopted as the following two formulas:(12)kx,y=roundTA/TB×ΦA−φB2π,(13)kx,y=floorTA/TBΦA−φB2π+0.5,where round represents rounding, ΦA represents the absolute phase calculated by the fringe pattern with larger period, φB is the wrapped phase to be obtained, TA is the larger period, TB is the smaller period, and floor represents the downward rounding. Formula (12) is used to reduce the noise interference when the noise of the fringe pattern is large and calculate the corresponding series k (x, y). Formula (13) is used when the noise of the fringe pattern is small.The absolute phase can be obtained from(14)Φx,y=φx,y+2π×kx,y.The reverse calculation initial phase method based on three-frequency with three-phase shifts’ algorithm is described as follows:Step 1: the absolute phase Φ123 (x, y) is used to unwrap the wrapped phase φ23(x, y), the series k23(x, y) is obtained by formula (12), and the absolute phase Φ23 (x, y) is obtained by formula (14).Step 2: the absolute phase Φ23 (x, y) is used to unwrap the wrapped phase φ12(x, y), the series k12(x, y) is obtained by formula (12), and the absolute phase Φ12 (x, y) is obtained by formula (14).Step 3: the absolute phase Φ12 (x, y) is used to unwrap the wrapped phase φ3(x, y), the series k3(x, y) is obtained by formula (12), and the absolute phase Φ3 (x, y) is obtained by formula (14).Step 4: the absolute phase Φ3(x, y) is used to unwrap the wrapped phase φ2(x, y), the series k2 (x, y) is obtained by formula (12), and the absolute phase Φ2 (x, y) is obtained by formula (14).Step 5: the absolute phase Φ2(x, y) is used to unwrap the wrapped phase φ1(x, y), the series k1 (x, y) is obtained by formula (12), and the absolute phaseΦ1 (x, y) is obtained by formula (14).Step 6: the obtainedk1 (x, y) in the Step 5 is combined with wrapped phase of the first set of frequencies. The absolute phase of the first of frequencies is calculated by formula (14), that is, the absolute phase Φfinal(x, y) is required for reconstruction.


## 2.2.2. Phase Error Compensation Method Based on Phase Offset

As mentioned above, this paper proposes a reverse solution of initial phase based on three-frequency with three-phase shifts’ method. Although the solution of the absolute phase is fast and robust, the distortion of the sinusoidal fringe pattern caused by nonlinear response of acquisition equipment and gamma nonlinearity of projection equipment will also lead to the phase error. Hence, the compensation algorithm based on the phase offset is proposed for three-frequency with three-phase shifts’ method.In order to facilitate the analysis and process of the image, the gray level of the fringe patterns can be represented by(15)Inx,y=A+Bcos2πfx+φx,y+δn,where A corresponds the direct current (DC) term and ambient light intensity reflected by the object and B represents the modulation or contrast of the fringes; they are usually constant. f is the frequency of sinusoidal fringe, φ (x, y) only contains phase information, and δn represents the phase shifts of the fringe pattern. During the experiment, we use the three-frequency with the three-phase shifts’ method, so the specific phase shifts values are −2π/3, 0, 2π/3.The intensity distribution of the projected fringe pattern can be expressed by(16)Ipx,y=fpInx,y,where fp is the projector mapping function relationship between the input signal and the output signal. Assuming that the intensity of ambient light on the measured surface is Ia and the reflectivity of the measured surface is r, so the light intensity distribution captured by the photosensitive elements of the industrial camera is(17)Irx,y=rIpx,y+Iax,y.Similarly, iffc is used as the nonlinear response function between the input and output signals of the industrial camera and the ambient light intensity is Ia′, the output image of the camera can be expressed as(18)Icx,y=fcIrx,y+Ia′x,y.When the camera produces the phenomenon of energy ratio imbalance in the process of photoelectric signal conversion, the conversion function of the camera is a nonlinear function. Factors that have the greatest influence on camera nonlinear response include second-order and third-order nonlinear signal response. Therefore, the nonlinear response of the camera can be expressed by(19)Icx,y=q3Irx,y+Ia′x,y3+q2Irx,y+Ia′x,y2+q1Irx,y+Ia′x,y+q0.q3, q2, q1, and q0 are the fitting coefficients. If the gamma coefficient γ of the measurement system is considered and formula (19) is substituted into formulas (18) and (16), then it will be transferred as follows:(20)Icx,y=k3Inx,y3γ+k2Inx,y2γ+k1Inx,yγ+k0.k3, k2, k1, and k0 are also the fitting coefficients after transformation calculation in formula (20). It is concluded that there is actually a nonlinear response of order 3γ in the measurement system. On the contrary, the higher order nonlinearity of the system can be represented through the higher harmonics of the system. Therefore, the image response equation of the measurement system can be expressed as(21)Icx,y=fInx,y=A+∑k=1kAkcoskφx,y+δn,where Ak is the harmonic coefficient and k is the maximum number of harmonics. Furthermore, through these above derivations, the phase distribution of the phase diagram can be calculated:(22)φx,y=−arctan∑N=0N−1A+∑k=1kAkcoskφx,y+δnsinδn∑N=0N−1A+∑k=1kAkcoskφx,y+δncosδn.Generally, the error with more than the fifth harmonic is small and negligible, so the value range ofk is generally less than 5. The three-step phase shifts method was used to calculate the principal phase in the experiment, and the calculation of the wrapped phase is expressed by(23)φx,y=arctanA1sinφx,y−A2sin2φx,y+A4sin4φx,y−A5sin5φx,yA1cosφx,y−A2cos2φx,y+A4cos4φx,y−A5cos5φx,y,where Ai (i = 1, 2, 4, 5) is the coefficient of the i order harmonic. The ideal phase can be expressed as(24)φx,y=φ′x,y−Δφx,yThe phase error is able to be obtained by combining formulas (23) and (24):(25)Δφx,y=arctan−A2−A1sin3φx,y−A5sin6φx,yA1+A2+A4cos3φx,y+A5cos5φx,y≅−m1sin3φx,y−m2sin6φx,ywhere m1 and m2 are constants and m2 is negligible compared with m1; then, formula (25) can be expressed as(26)Δφx,y≅−m1sin3φx,yIf we do not consider the influence of the fifth harmonic, we should fit the phase error formula as follows:(27)Δφx,y≅−m1sin3φx,y1+cos3φx,yIn the experiment,−m1/1+cos3φx,y is constant fluctuation in 2π period, so we set k=−m1/1+cos3φx,y; then, the phase error can be expressed as follows:(28)Δφx,y≅ksin3φx,yAccording to the above analysis, the phase error is determined by phaseφ and parameter k in our method. If an initial phase offset is introduced into the phase shifts’ fringe pattern, the phase error will also change accordingly.The core idea of the proposed method is that the sequence of fringe patterns with an initial phase offset difference ofπ/3 is designed, that is, a set of compensation fringe patterns should be added on the basis of the projection fringe pattern sequence. The phase error of the corresponding wrapped phase can be expressed as follows:(29)Δφ′x,y≅ksin3φx,y−π3≅−ksin3φx,yIt is not difficult to find that the phase error has the equation Δφ(x, y) + Δφ′(x, y) = 0. Therefore, if there are three different periods and −π/3 initial phase offsets for the projection fringe patterns, it has nine patterns. The sinusoidal fringe pattern has a phase angle difference of 2π/3; then, the corresponded original wrapped phase and the wrapped phase of the compensation fringe are calculated by the three-step phase shifts’ method. After that, two groups of wrapped phases are added together. The phase error due to the gamma nonlinear effects of the projector is eliminated. After a lot of experiments, the k value is Nπ, and N is the maximum phase shifts’ numbers obtained during the measurement.


## 3. Experiment and Results

The calibration method of the precoding gamma coefficient was simulated to verify the effectiveness. Suppose that the original gamma coefficient of the uncorrected measurement system was 0.80; the precoding values were generally between 0.50 and 1.00, which were independent of the measurement range and measurement distance. So, the precoding method was used to encode two sets of digital fringes with gamma coefficientγ1 = 0.60 and γ2 = 1.00, as shown, respectively, in Figures 3(b) and 3(c). Then, the actual gamma coefficients of the captured fringe patterns should be 0.50 and 0.80 in the measurement process.Figure 3
The original precoding fringe and actual fringe. (a) Original gamma = 0.80. (b) Precoding gamma = 0.60. (c) Precoding gamma = 1.00.
(a)(b)(c)The effect of high-order harmonic component on the phase was determined by the number of phase shift steps. The more fringe patterns projected, the smaller the influence of the high-order harmonic component is. Therefore, the phases obtained by 12-step phase shift were regarded as the ideal value to improve the measurement speed and obtain more accurate measurement results in this paper. 12 fringe patterns were generated and the phase shifts between each of the two patterns was fixed toπ/12. When the gamma coefficient of the properly precoding fringe was 1.638 (as shown in Figure 4(a)), the fringe pattern with the best positive linearity could be captured by the camera (as shown in Figure 4(b)). In this case, the gamma coefficient of the projected fringe was 0.8 × 1.638 = 1.3104.Figure 4
Simulation results. (a) Precoding fringe with gamma = 1.638. (b) Captured fringe simulation. (c) Sinusoidal contrast of fringe before and after correction. (d) Contrast of sine wave crest. (e) Contrast of sine wave valley.
(a)(b)(c)(d)(e)In Figure4(c), the red dotted line presented the gray level of the fringe after gamma correction, and the blue solid line was the uncorrected gray level of the fringe. From Figures 4(d) and 4(e), it could be seen that the uncorrected fringe had obvious nonsinusoidal distortion at the peak and valley, and the sine of the projected fringe by precoding gamma coefficient calibration was much better than uncorrected fringe. In addition, the proposed method was able to effectively eliminate the effects of harmonic components from the perspective of spectrum, as shown in Figures 5 and 6.Figure 5
Uncorrected gamma = 0.80, spectrum display diagram.Figure 6
Corrected gamma = 1.3104, spectrum display diagram.Moreover, we calculated the root mean square (RMS) of error from which the gray level of the original gamma distortion minus the gray level of the standard sinusoidal fringe, which was shown in Table1, and the RMS was 0.0297. While the RMS of other error between the fringe intensity corrected by the proposed method and the gray level of the standard sinusoidal fringe was 0.0058.Table 1
RMS before and after correction of the gamma coefficient.
Error before correction RMS (rad)Error after correction RMS (rad)Ratio of RMS of phase error before and after correction compensationSinusoidal precision of ratio improvement (%)0.02970.00585.1280We normalized the gray level uniformly to facilitate comparison, and it could be seen that the gray level of the fringe error was greatly reduced by nearly 80% after precoding gamma calibration method, which could fully prove the effectiveness of our proposed algorithm.During the whole measurement process, the standard sinusoidal fringe patterns were generated and projected onto the measured surface, and the camera was used to capture the deformed fringes. Subsequently, the wrapped phase was extracted and filtered, and the precoded method and phase error compensation method were used to correct gamma distortion and compensate the phase error. After that, the wrapped phase and absolute phase of the fringe were compared to verify the effectiveness of the proposed method. Aluminum material with surface reflectivity of 0.4–0.5 was used as the measured surface, and the verification experiment of 3D measurement was carried out.According to Figure7, the experiment system was built, and the optical measurement platform is shown in Figure 8. The experimental platform was the structured light measurement system based on digital phase shifts’ fringe projection, which was mainly composed of computer, camera, and digital projector. The digital projector was DLP4500, which could realize RGB three-channel projection, and the effective resolution was 1140 pixels × 912 pixels. This device could project patterns quickly. The camera (Point Gray, GS3-U3-32S4M) had the maximum resolution of 2048 pixels × 1536 pixels, and the maximum frame frequency of is 121 fps.Figure 7
Schematic diagram of the digital fringe projection measurement system.Figure 8
Hardware implement.Specific measurement steps were as follows:Step 1: the gamma distortion effect of measurement system was precoded and calibrated according to the principle and method of Section2.1.Step 2: according to the theory described in Section2.2.1, three different periodic fringe patterns T1, T2, and T3 were coded and designed to be flashed into the DLP4500, and the device projected them onto the measured surface and captured them. The equivalent periodic T12, T23, and T123 were calculated simultaneously.Step 3: the three-step phase shifts’ method was used to obtain the initial values of 9 fringe patterns captured by the camera so that the principal phase values of each pixel wereφ1, φ2, and φ3, respectively.Step 4: the principal valuesφ12 and φ23 of intermediate phases were obtained by using φ1, φ2, and φ3 solution from formulas (30) and formula (31):(30)φ12=φ1−φ2,φ1≥φ2φ1−φ2+2π,φ1<φ2,(31)φ23=φ2−φ3,φ2≥φ3φ2−φ3+2π,φ2<φ3.Step 5: the absolute phase value Φ123 of the heterodyne was obtained by taking the principal phase valueφ12 and φ23 of the intermediate phase as the parameters of the heterodyne calculation.Step 6: initial phase was solved reversely, and Φ1(x, y) with maximum frequency was obtained as the final phase.Step 7: according to the theory described in Section2.2.2, the compensated fringe sequences were projected and the compensated phase value was calculated as the final phase value that could be reconstructed the 3D information.Phase error compensation process and its results were shown in Figure9. The projected fringes and the compensation fringe patterns were shown in the gray box, the corresponding wrapped phase, and the heterodyne calculation diagrams were shown in the green box, and the calculated absolute phases were shown in the yellow box. The final compensated absolute phase was shown in the blue box, that is, the phase was the required in the final 3D reconstruction.Figure 9
Schematic diagram of phase error compensation measurement.In this paper, the wrapped phase obtained by the three-frequency with the four-phase shifts’ method was compared with that obtained by our method to analyze the feasibility of our method. The phase measurement error of 800 columns corresponding to the wrapped phase diagram was shown in Figure10. Then, we normalized the error between 0 and 1 to facilitate comparison, and it could be seen from Figure 10(c) that the proposed method could effectively reduce the phase error fluctuation and improve its measurement accuracy.Figure 10
Comparison of wrapped phase error compensation. (a) Our proposed method; (b) three-frequency with four-phase shifts’ method; (c) comparison of wrapped phase measurement errors in 800 columns.
(a)(b)(c)Furthermore, we compared the final absolute phase obtained by the three-frequency with the four-phase shifts’ method with our proposed method to analyze the phase error fluctuation and compensation. The phase error comparison of line 400 of the absolute phase image is shown in Figure11. The error was normalized from 0 to 1 to facilitate comparison, and it could be seen that the phase fluctuation based on the three-frequency with the four-phase shifts’ method was large, and the whole phase expansion was greatly affected by noise, so there were many burrs. The expanded phase had the defect of drawing wire. Meanwhile, we noted that the phase error at the origin had accumulated, which was unfavorable to the 3D reconstruction, and the inverse solution method based on three-frequency with three-phase shifts could obviously see that the error accumulation at the origin was very small, the phase change was smooth, and the burr was less. It was much better than the three-frequency with four-phase shifts’ method. Therefore, our proposed method had good absolute phase noise resistance, good robustness, and higher width tolerance.Figure 11
Comparison of absolute phase error compensation. (a) Three-frequency with four-phase shifts’ method; (b) our proposed method; (c) comparison of absolute phase measurement errors in 400 lines.
(a)(b)(c)Subsequently, the fringe patterns with the period of 14 pixels, 24pixels, and 32pixels were projected onto the measured surface, and the RMS of phase errors before and after correction and compensation were calculated. The results were shown in Table2, and it could be found that the proposed correction compensation method could effectively reduce the phase error caused by gamma effect.Table 2
RMS before and after correction of compensation by the proposed method.
Fringe period (pixels)Error before correction RMS (rad)Error after correction RMS (rad)Ratio of RMS of phase error before and after correction compensation140.01860.00842.21240.02990.01242.41320.02750.01322.08In the 3D reconstruction experiment, the projector firstly was used to project the sinusoidal fringe sequences generated by the precoding gamma coefficient calibration correction. Then, the camera captured the modulated fringe patterns, and the absolute phase of the measured surface was obtained by using the proposed method based on the reverse solution initial phase method and the three-frequency with three-phase shifts’ error compensation based on phase offset. After that, the 3D reconstruction data of the measured surface could be obtained, as shown in Figure12. We compared the 3D reconstruction image after digital fringe gamma correction and phase error compensation, and the effectiveness of our method could be verified.Figure 12
3D reconstructions of the aluminum material. (a) Three-frequency with four phase shifts. (b) Our proposed method.
(a)(b)Figure12(a) shows that the measured surface would appear obvious wave distortion after 3D reconstruction. The reason for this phenomenon was the gamma distortion of the fringe patterns, which caused the phase error. Figure 12(b) could draw the conclusion that the distortion degree was obviously reduced and the reconstructed surface was smoother and clearer after phase error compensation and gamma correction based on our method. The missing part of the reconstruction was due to the fact that the monocular structured light measurement system was unable to measure the shadow part.Then, we compared and analyzed the quality of the model data and the original point cloud data. We set the deviation value, one side of the reference plane was negative, and the other side was positive value. The maximum and minimum distances from the point to the plane were calculated by the least square fitting plane. The average error and the standard deviation were calculated, as shown in Tables3 and 4, which were used to evaluate quantitatively the validity of the proposed method.Table 3
Evaluation and analysis of point cloud by the traditional phase-shifted method for Figure12(a).
DirectionMaximal value (mm)Average error (mm)Standard deviation (mm)Negative direction−3.8620−0.72310.7404Absolute direction3.86200.01590.1649Forward direction3.33780.00910.1129Table 4
Evaluation and analysis of point cloud by our proposed method for Figure12(b).
DirectionMaximal value (mm)Average error (mm)Standard deviation (mm)Negative direction−3.0667−0.72310.6130Absolute direction3.86030.00270.1010Forward direction3.63750.00130.0536From the above tables, the average error of the absolute direction was reduced by 83.02%. The forward average error was decreased by 85.71%. In a word, the distortion of the wave shape was obviously reduced after correction and compensation, and the effect of correction and compensation was ideal, so the effectiveness of the proposed method could be verified.


## 4. Conclusions

In this paper, the mathematical relationship between higher harmonic component and gamma coefficient is analyzed and deduced, and an active precoding method is proposed to calibrate the nonlinear gamma coefficient of the system. Meanwhile, since gamma nonlinear error will cause the phase error, this paper also proposes the reverse solution initial phase method based on three-frequency with three-phase shifts and the phase error compensation method based on phase offset. Aluminum material was taken as the measured surface, and the experimental results showed that the RMS values of the difference between the phase plane and the standard phase plane before and after gamma correction were reduced by nearly 80%. Compared with the traditional three-frequency with four-phase shifts’ method, the proposed method needed less compensation fringe patterns and had less phase error. Our method had good noise resistance, which could be used in many measurement situations. However, our method also has some limitation. Noise and uncertainty will have a great impact on the measurement accuracy, so the follow-up work will improve the quality from the image acquisition and processing.



---

*Source: 8315101-2021-09-21.xml*