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

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.


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. is 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. en, 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. erefore, 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][3][4][5][6][7][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. e 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. e 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][10][11][12][13][14][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. e 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. e rest of this paper is organized as follows. Section 2 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.

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 Figure 1, 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, c is the gamma coefficient of the measurement system, and B k 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.
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 c in the measurement system [16]. erefore, the precoding calibration algorithm is designed to calculate the gamma coefficients c and complete the precalibration gamma correction of the 2 International Journal of Optics measurement in this paper. e principle can be described as follows.
When B k ≠ 0, the ratio of the k + 1-and k-order harmonic component of the sinusoidal signal can be expressed as Formula (3) has established the relationship between the gamma coefficient c and the harmonic component coefficients B k to compensate the nonlinear of the distorted sinusoidal fringes. It is further proved that B k converges uniformly for any c > 0 and the amplitude of harmonic component decreases rapidly with the increase of harmonic order. erefore, if c is an integer, the harmonic component which is higher than c 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 c of the measurement system with smaller harmonic coefficient. e gamma coefficient c will be obtained and calibrated through formula (3). erefore, the idea of precoding correction is adopted to use the calibrated gamma coefficient to correct sinusoidal fringes in advance on the projection pixel plane. e 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]. erefore, the Gaussian model of point diffusion function (PDF) was used to describe defocus to perfect the gamma nonlinear model of the projection equipment [18]. e mathematical relationship between the fringe harmonic coefficient B k ∧ and the harmonic coefficient B k caused by gamma effect can be expressed as 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. en, the exponential term in formula (4) can be regarded as a constant. However, the solution of the two-variable defocusing factors σ and gamma coefficient c requires two sets of equations, so two coefficients c 1 and c 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 c can be calculated by formulas (5) and (6): 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 c should be within one to three in the actual measurement process. If the precoding selected values c 1 and c 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., c 1 � 0.60 and c 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. e precoding phase shifts' pattern sequences are captured by the camera, and the corresponding K values are calculated through formula (5).
Step 4: calculate the gamma coefficient c from formula (6).
Step 5: generate corrected fringe patterns. c 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.
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 International Journal of Optics the active precoding method still has inevitable phase errors, so we propose a method to solve the phase error problem in Section 2.2.

ree-Frequency with ree-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. erefore, 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.

Reverse Calculation Initial Phase Method Based on
ree-Frequency with ree-Phase Shifts. e 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]. erefore, it is necessary to select both the sinusoidal fringe with appropriate frequency and the appropriate period T 1 , T 2 , and T 3 . en, the period width after superposition is larger than the width of projected fringe pattern, that is, T 123 > 1. e 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.
e period width of the three-frequency fringe patterns with three-phase shifts is e superposition period T e can be calculated by formula (8), and the equivalent period after superposition can be solved as T 12 � 210 pixels, T 23 � 240 pixels, e 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. erefore, the threefrequency 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 threestep phase shifts, the increment of each phase shift is where I n represents the intensity distribution of the fringe pattern, I a is the intensity mean, I b represents the amplitude modulation, and φ is the initial phase. en, the theoretical value of the wrapped phase can be solved as

Nonlinear Gamma distortion effect
Pixel Positions Intensity (gray-level) x Pixel Positions Intensity (gray-level) x Figure 1: e schematic diagram of the distortion gamma sinusoidal signals. 4 International Journal of Optics 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. e absolute phase with small period will be used for 3D reconstruction.
e key to the reverse solution of the initial phase is to calculate the series k (x, y) of each the wrapped phase and the corresponding equivalent period. e solution of the series k (x, y) is adopted as the following two formulas: 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, T A is the larger period, T B 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. e absolute phase can be obtained from e 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 k 23 (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 k 12 (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 k 3 (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 k 2 (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 k 1 (x, y) is obtained by formula (12), and the absolute phaseΦ 1 (x, y) is obtained by formula (14).
Step 6: the obtained k 1 (x, y) in the Step 5 is combined with wrapped phase of the first set of frequencies. e absolute phase of the first of frequencies is calculated by formula (14), that is, the absolute phase Φ final (x, y) is required for reconstruction.

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 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. e intensity distribution of the projected fringe pattern can be expressed by where f p 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 I a and the reflectivity of the measured surface is r, so the light intensity distribution captured by the photosensitive elements of the industrial camera is Similarly, if f c is used as the nonlinear response function between the input and output signals of the industrial camera and the ambient light intensity is I a ′ , the output image of the camera can be expressed as 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 International Journal of Optics nonlinear signal response. erefore, the nonlinear response of the camera can be expressed by I c (x, y) � q 3 I r (x, y) + I a ′ (x, y) 3 + q 2 I r (x, y) + I a ′ (x, y) 2 + q 1 I r (x, y) + I a ′ (x, y) + q 0 .
q 3 , q 2 , q 1 , and q 0 are the fitting coefficients. If the gamma coefficient c of the measurement system is considered and formula (19) is substituted into formulas (18) and (16), then it will be transferred as follows: k 3 , k 2 , k 1 , and k 0 are also the fitting coefficients after transformation calculation in formula (20). It is concluded that there is actually a nonlinear response of order 3c in the measurement system. On the contrary, the higher order nonlinearity of the system can be represented through the higher harmonics of the system. erefore, the image response equation of the measurement system can be expressed as where A k 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: Generally, the error with more than the fifth harmonic is small and negligible, so the value range of k is generally less than 5. e 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 where A i (i � 1, 2, 4, 5) is the coefficient of the i order harmonic. e ideal phase can be expressed as e phase error is able to be obtained by combining formulas (23) and (24): where m 1 and m 2 are constants and m 2 is negligible compared with m 1 ; then, formula (25) can be expressed as If we do not consider the influence of the fifth harmonic, we should fit the phase error formula as follows: In the experiment, −m 1 /1 + cos[3φ(x, y)] is constant fluctuation in 2π period, so we set k � −m 1 /1 + cos[3φ(x, y)]; then, the phase error can be expressed as follows: According 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. e 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. e phase error of the corresponding wrapped phase can be expressed as follows: It is not difficult to find that the phase error has the equation Δφ(x, y) + Δφ′(x, y) � 0. erefore, if there are three different periods and −π/3 initial phase offsets for the projection fringe patterns, it has nine patterns. e 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. e 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.

Experiment and Results
e 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 c 1 � 0.60 and c 2 � 1.00, as shown, respectively, in Figures 3(b) and 3(c). en, the actual gamma coefficients of the captured fringe patterns should be 0.50 and 0.80 in the measurement process. e effect of high-order harmonic component on the phase was determined by the number of phase shift steps. e more fringe patterns projected, the smaller the influence of the high-order harmonic component is. erefore, 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.
In Figure 4(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.
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 Table 1, 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.
We 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 Figure 7, the experiment system was built, and the optical measurement platform is shown in Figure 8. e 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. e digital projector was DLP4500, which could realize RGB three-channel projection, and the effective resolution was 1140 pixels × 912 pixels.
is device could project patterns quickly. e camera (Point Gray, GS3-U3-32S4M) had the maximum resolution of 2048 pixels × 1536 pixels, and the maximum frame frequency of is 121 fps.
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 Section 2.1.
Step 2: according to the theory described in Section 2.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 International Journal of Optics captured them. e 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): 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 Section 2.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 Figure 9. e 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. e final compensated absolute phase was shown in the blue box, that is, the phase was the required in the final 3D reconstruction.
In this paper, the wrapped phase obtained by the threefrequency with the four-phase shifts' method was compared with that obtained by our method to analyze the feasibility of our method. e phase measurement error of 800 columns corresponding to the wrapped phase diagram was shown in Figure 10. en, 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.
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. e phase error comparison of line 400 of the absolute phase image is shown in Figure 11. e 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. e 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. erefore, our proposed method had good absolute phase noise resistance, good robustness, and higher width tolerance.
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. e results were shown in Table 2, and it could be found that the proposed correction compensation method could effectively reduce the phase error caused by gamma effect.
In the 3D reconstruction experiment, the projector firstly was used to project the sinusoidal fringe sequences generated by the precoding gamma coefficient calibration correction. en, 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 Figure 12. 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(a) shows that the measured surface would appear obvious wave distortion after 3D reconstruction. e reason for this phenomenon was the gamma distortion of     International Journal of Optics 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. e missing part of the reconstruction was due to the fact that the monocular structured light measurement system was unable to measure the shadow part. en, 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. e maximum and minimum distances from the point to the plane were calculated by the least square fitting plane. e average error and the standard deviation were calculated, as shown in Tables 3 and 4, which were used to evaluate quantitatively the validity of the proposed method.
From the above tables, the average error of the absolute direction was reduced by 83.02%. e 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.

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.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare no conflicts of interest.   Table 4: Evaluation and analysis of point cloud by our proposed method for Figure 12(b).