Phase Error Analysis and Correction for Crossed-Grating Phase-Shifting Profilometry

Crossed-grating phase-shifting profilometry (CGPSP) has great utility in three-dimensional shape measurement due to its ability to acquire horizontal and vertical phase maps in a single measurement. However, CGPSP is extremely sensitive to the non-linearity effect of a digital fringe projection system, which is not studied in depth yet. In this paper, a mathematical model is established to analyze the phase error caused by the non-linearity effect. Subsequently, two methods used to eliminate the non-linearity error are discussed in detail. To be specific, a double five-step algorithm based on the mathematical model is proposed to passively suppress the second non-linearity. Furthermore, a precoding gamma correction method based on probability distribution function is introduced to actively attenuate the non-linearity of the captured crossed fringe. The comparison results show that the active gamma correction method requires less fringe patterns and can more effectively reduce the non-linearity error compared with the passive method. Finally, employing CGPSP with gamma correction, a faster and reliable inverse pattern projection is realized with less fringe patterns.


Introduction
Phase shifting profilometry (PSP), with non-contact, full-field, high-resolution and high-precision advantages, is a popular three-dimensional (3D) shape measurement technique based on fringe projection [1][2][3]. PSP has found extensive applications in several fields such as industrial surface inspection, reverse engineering, and biomedical engineering [4][5][6]. In PSP, the height information of a tested object is encoded within the phase of the projected fringe patterns. The phase retrieved from the captured deformed fringe patterns by phase shifting algorithm is wrapped within the range from −π to π [7]. A phase unwrapping algorithm must be conducted to obtain a continuous phase map. Conventional phase unwrapping algorithms can be divided into two principal categories: spatial phase unwrapping [8][9][10] and temporal phase unwrapping [11][12][13]. Spatial phase unwrapping implemented on a single wrapped phase map is normally dependent on the unwrapping path. Due to the phase continuity assumption, it cannot handle surfaces with large discontinuities or separations. Temporal phase unwrapping can solve the phase ambiguity problem by using multi-wrapped phase maps, in which phase unwrapping is performed at each pixel independently.
In some applications of PSP, such as phase measurement deflectometry [14], inverse pattern projection (IPP) [15] and calibration of structured light measurement systems [16], it is desired that both horizontal and vertical phase maps of the tested object are recovered. Traditionally, in single carrier-frequency grating phase shifting profilometry (SGPSP), horizontal and vertical sinusoidal fringe patterns are separately projected on the tested object, and the deformed fringe patterns are recorded to recover the two orthogonal phases. To improve the measurement efficiency, Liu et al. [17] employed crossed-grating phase-shifting profilometry (CGPSP) to obtain the two orthogonal phases. Theoretically, in CGPSP, only five fringe patterns are required to obtain the two orthogonal phases.
However, CGPSP is extremely susceptible to the non-linear response of the digital fringe projection system. The non-linearity effect of the industrial camera can be neglected compared with that of the digital projector [1]. Therefore, the non-linearity effect of the projector, as the main error resource of the system [18,19], has been studied by many researchers. Some phase correction methods used in sinusoidal grating phase shifting profilometry and binary grating phase shifting profilometry (BGPSP) have been proposed. They are roughly divided into two categories: active correction and passive correction [20]. In the first category, the ideal sinusoidal fringe patterns are desired to be projected on the object. One solution is to find the most proper gamma value, which is pre-encoded in the projected fringe patterns to guarantee the captured fringes perfectly. For instance, Hoang et al. [21] used the least-square approach to calculate the system gamma value from the difference between the real phase value of the three-step phase-shifting algorithm and the true phase value obtained by a large-step phase-shifting method. Employing the statistical analysis, Guo et al. [22] calculated the gamma value from the normalized cumulative histogram of the captured fringe patterns with different backgrounds and modulations. Yu et al. [23] calculated the gamma value based on probability distribution function (PDF) of the retrieved wrapped phase. Another way to generate ideal fringes is the defocusing technique which acts as a low-pass filter. For instance, Baker et al. [24] derived the mathematical model of the defocusing technique. Lei et al. [25] generated ideal sinusoidal fringe patterns by defocusing binary fringe patterns. In the second category, the non-linearity error is passively corrected by a post-processing instead of projecting pro-encoded fringes. Pan et al. [19] proposed a simple iterative algorithm to reduce the phase error owing to non-sinusoidal waveforms. Zhang [7,26] established a look-up-table between the phase error and the corresponding phase value to compensate the phase error directly. Huang et al. [27] proposed a double three-step algorithm to obtain two distorted phases with opposite distortion direction and identical distortion amplitude, and averaged them to eliminate the distortion. The similar model based on the Hilbert transform was also proposed to eliminate the phase error [28]. Zheng et al. applied the above two methods to the phase error correction of BGPSP with projector defocusing [29]. In addition, a large-step phase-shifting method can be used to eliminate the non-linearity error [30]. However, methods with less fringe patterns and higher accuracy are the common goal. In CGPSP, fewer fringe patterns are required to obtain two orthogonal phases, but an elemental theoretical analysis of the non-linearity error and practical methods to eliminate the error are still not extensively studied.
To improve the accuracy and flexibility of CGPSP, a mathematical model to analyze the non-linearity error and practical methods to eliminate the phase error are studied in detail in this paper. Based on a polynomial model of the non-linear effect, the mathematical model is derived. To eliminate the non-linearity error, we study passive and active nonlinear phase error correction methods, including a passive double five-step algorithm and an active gamma correction method based on PDF. The phase correction performance of the two methods is compared. Finally, a faster IPP is realized by employing CGPSP with gamma correction.
The rest of the paper is organized as follows: Section 2 introduces the principle of CG-PSP, the principle of IPP based on CGPSP and the phase error analysis of CGPSP. Section 3 illustrates the principle of the double five-step algorithm and the gamma correction method based on PDF. Section 4 presents some experimental results. Section 5 concludes the paper.

Principle of Crossed-Grating Phase-Shifting Profilometry
The schematic of geometric optical path for the CGPSP measurement setup is shown in Figure 1, where C and P are the camera photocenter and the projector photocenter respectively, O is the intersection point of the optical axis of projector and camera, and θ is the angle between the baseline CP and the horizontal axis X w . In order to generate the fringe deformation in both the horizontal and vertical directions, the baseline CP should have components in the horizontal and vertical directions (for example, θ is 45 degrees).

Principle of Crossed-Grating Phase-Shifting Profilometry
The schematic of geometric optical path for the CGPSP measurement setup is shown in Figure 1, where C and P are the camera photocenter and the projector photocenter respectively, O is the intersection point of the optical axis of projector and camera, and θ is the angle between the baseline CP and the horizontal axis Xw. In order to generate the fringe deformation in both the horizontal and vertical directions, the baseline CP should have components in the horizontal and vertical directions (for example, θ is 45 degrees). In the ideal measurement system, the deformed fringe patterns captured by the camera can be described as: where n = 1, 2, …, N and N is the total number of phase shifts, (x, y) is the coordinate of an arbitrary point in the image, A(x, y) is the background intensity, B1(x, y) and φx(x, y) are the intensity modulation and the desired phase in the horizontal direction, respectively, B2(x, y) and φy(x, y) are the intensity modulation and the desired phase in the vertical direction respectively, δn = 2πn/N is the phase-shifting amount, k is an integer within the range of [2, N/2)  (N/2, N − 2] and controls the phase-shifting amount in the vertical direction. Because there are five unknown variables in Equation (1), at least five images should be used to extract the phase information. For convenience, (x, y) is omitted in some complex expressions hereafter. The measured phases in the horizontal and vertical direction can be extracted by the least-squares algorithm: The phases φxw and φyw are wrapped within the range of [−π, π). To recover unambiguous phases even in the presence of large discontinuities or isolated objects, simple and robust three-frequency temporal phase unwrapping (3FTPU) is carried out. For the horizontal phase unwrapping, the 3FTPU algorithm can be simply described as: In the ideal measurement system, the deformed fringe patterns captured by the camera can be described as: where n = 1, 2, . . . , N and N is the total number of phase shifts, (x, y) is the coordinate of an arbitrary point in the image, A(x, y) is the background intensity, B 1 (x, y) and ϕ x (x, y) are the intensity modulation and the desired phase in the horizontal direction, respectively, B 2 (x, y) and ϕ y (x, y) are the intensity modulation and the desired phase in the vertical direction respectively, δ n = 2πn/N is the phase-shifting amount, k is an integer within the range of [2, N/2)∪(N/2, N − 2] and controls the phase-shifting amount in the vertical direction. Because there are five unknown variables in Equation (1), at least five images should be used to extract the phase information. For convenience, (x, y) is omitted in some complex expressions hereafter. The measured phases in the horizontal and vertical direction can be extracted by the least-squares algorithm: ( The phases ϕ xw and ϕ yw are wrapped within the range of [−π, π). To recover unambiguous phases even in the presence of large discontinuities or isolated objects, simple and robust three-frequency temporal phase unwrapping (3FTPU) is carried out. For the horizontal phase unwrapping, the 3FTPU algorithm can be simply described as: where 1, f l and f h (commonly f h = f l 2 ) are the carrier frequencies of three sets of crossed fringes, and subscripts l and h denote 'low frequency' and 'high frequency', respectively. ϕ xw1 , ϕ xwl and ϕ xwh denote the unwrapped phases of the single-, low-and high-frequency fringes, respectively. Round[·] is the operation to obtain the closest integer value.
In 3FTPU based on CGPSP, three set of fringes with frequencies of 1, f l and f h in the horizontal and vertical directions are required. Theoretically, two orthogonal phase maps can be extracted from 15 captured fringe patterns. As a comparison, in traditional 3FTPU based on SGPSP [12], 18 fringe patterns are required, employing the three-step phase-shifting method. Twenty-four fringe patterns are required, employing the four-step phase-shifting method. Therefore, CGPSP normally requires fewer fringes to obtain two orthogonal phase maps compared with SGPSP.

Principle of Crossed-Grating Phase-Shifting Profilometry
IPP has been widely used in many fields such as industrial surface detection [31], and augmented reality [32]. In traditional IPP, horizontal and vertical phase-shifting fringe patterns are separately projected to obtain horizontal and vertical absolute phases which are used to establish the geometric mapping relationship between the projector pixel and the camera pixel. If the CGPSP method is used, the mapping relationship can be established with fewer fringes. Taking the generation of an inverse straight fringe pattern as an example, the flow chart as shown in Figure 2 illustrates the whole process of IPP based on CGPSP. For simplicity, the first frames of three sets of captured crossed fringe patterns are shown in Figure 2. Firstly, the horizontal and vertical absolute phases of a target object are recovered by CGPSP based on 3FTPU. With the two phases, the geometric mapping relationship between the projector pixel (l, m) and the camera pixel (x, y) can be established: where ϕ x (x, y) and ϕ y (x, y) denote the horizontal and vertical phases respectively, p x and p y are the crossed fringe pitches in the horizontal and vertical directions respectively. The high accuracy of the two orthogonal phases guarantees the precision of the geometric mapping relationship in Equation (4). Based on the geometric mapping relationship and an expected pattern (straight fringe), a projected inverse pattern (deformed fringe) is generated. In the same projector-camera measurement system, after projecting the inverse pattern on the object, a non-distorted fringe pattern on the surface of the object can be collected by the camera.

Phase Error Analysis for Crossed-Grating Phase-Shifting Profilometry
In practice, considering the non-linearity effect of the measurement system, the actual captured fringe patterns In′ can be theoretically described as the gamma power of the ideal captured fringe patterns In [33].
where γ is the gamma value of the system and can be a non-integer value. To facilitate the analysis of the non-linear error, Equation (5) can be approximated by a polynomial func-

Phase Error Analysis for Crossed-Grating Phase-Shifting Profilometry
In practice, considering the non-linearity effect of the measurement system, the actual captured fringe patterns I n can be theoretically described as the gamma power of the ideal captured fringe patterns I n [33].
where γ is the gamma value of the system and can be a non-integer value. To facilitate the analysis of the non-linear error, Equation (5) can be approximated by a polynomial function [34]: where ε 0 , ε 1 , ε 2 , ε 3 are coefficients. Substituting Equation (1) into Equation (6), the actual captured crossed fringe patterns can be calculated as where a 0 is the background intensity, a i , b j and e ij denote the amplitudes of horizontal and vertical harmonic components and crosstalk components, respectively. It is clear that the phase error will be introduced by horizontal and vertical high-order harmonics and crosstalk components. It has been verified that the harmonic amplitude decreases rapidly with the increasing of its frequency in SGPSP [19]. Non-linear system response makes the harmonic amplitude distribution of the captured sinusoidal fringe follow the conclusion regardless of the carrier frequency in the horizontal direction or vertical direction. Therefore, the conclusion is also valid in CGPSP. A simulation is added to confirm the conclusion in CGPSP more clearly. The spectra of the simulated crossed fringe with different gamma values 1.4, 2.4, and 3.4, as shown in Figure 3a-c respectively, illustrate the conclusion. As a comparison, the frequency spectra of a simulated vertical sinusoidal fringe and a simulated horizontal sinusoidal fringe distorted by gamma value 2.4 are shown in Figure 3d,e, respectively. Compared with the single carrier-frequency fringes, the crossed fringe has more complex spectra distribution.
, x FOR PEER REVIEW 6 of 17 When the parameter k is set to two in Equation (1), a full-cycle phase shifting within 4π is performed in the vertical direction. Setting k to 2 and substituting Equation (7) into  When the parameter k is set to two in Equation (1), a full-cycle phase shifting within 4π is performed in the vertical direction. Setting k to 2 and substituting Equation (7) into Equation (2), we derive two wrapped phase expressions which are related to the total number of phase shifts N (N ≥ 5).

2.
When N is an even number, ϕ xw and ϕ yw are derived as: The four functions J(ϕ x , ϕ y ), K(ϕ x , ϕ y ), L(ϕ x , ϕ y ) and M(ϕ x , ϕ y ) are also composed of the summation of periodic sinusoidal and cosinusoidal harmonic functions with variables ϕ x and ϕ y . Their magnitudes decrease with the increasing of the total number of phase shifts N. Seen from Equations (10) and (11) with those in the odd condition. However, periodic phase error caused by horizontal and vertical high-order harmonics and crosstalk components still exists in the calculated phases. Equations (10) and (11) reveal that the horizontal phase error is induced by the mN ± 1th horizontal harmonics and the crossed phases −[e 21 sin(ϕ x − ϕ y )]/2 + J(ϕ x , ϕ y ) and [e 21 cos(ϕ x − ϕ y )]/2 + K(ϕ x , ϕ y ), and the vertical phase error is induced by the 2nd and mN ± 2th horizontal harmonics, the mN/2 ± 1th vertical harmonics and the crossed phases L(ϕ x , ϕ y ) and M(ϕ x , ϕ y ).
For clarity, a summary is given as follows: There is always the phase error induced by the 2nd horizontal harmonic in the vertical distorted phase; • The crossed phase component ϕ x − ϕ y and the 2nd horizontal harmonic in Equations (8)-(11) make the large-step phase-shifting method invalid to eliminate the non-linear error in CGPSP.
When parameter k is set to other integer within the range of [2, N/2)∪(N/2, N − 2], similar phase distribution can be derived, which can be summarized as below: When N ≥ 2k + 1, there is always the phase error induced by the kth horizontal harmonic in the vertical distorted phase.

Phase Error Correction for Crossed-Grating Phase-Shifting Profilometry
The above analysis results show that the non-linearity effect in CGPSP is quite serious and complicated. Therefore, it is necessary to remove the non-linear error for the further application of CGPSP. In this section, a double five-step algorithm is presented to passively eliminate the second non-linearity. In addition, an attractive gamma correction method based on PDF [23] is discussed in detail as well.

Double Five-Step Algorithm
Referring to the double three-step algorithm [27], the double five-step algorithm is proposed to eliminate the second non-linearity effect in CGPSP which is the main component of the non-linearity effect normally. Considering the non-linearity up to the second order and setting N to 5, Equations (8) and (9) can be simplified and the corresponding unwrapped phases can be expressed as: where U{·} is the operation to unwrap the wrapped phase. The phase error in the two directions can be derived as follows: where ϕ x and ϕ y are the ideal phases. In practice, a 1 is much larger than b 2 and e 21 /2, and b 1 is much larger than a 2 and e 21 /2. Equation (13) can be simplified as: If an extra phase offset of π is introduced into the ideal fringes, two extra measured phases ϕ xu and ϕ yu can be obtained and the corresponding phase errors can be derived as: It is obvious that ∆ϕ xu = −∆ϕ xu and ∆ϕ yu = −∆ϕ yu . Therefore, the second nonlinearity can be eliminated by averaging the two sets of measured phases: To clearly explain the process of retrieving the absolute phases of 3FTPU based on double five-step algorithm, Figure 4 shows the flowchart of calculating the horizontal absolute phase, in which 1, f l and f h are the carrier frequencies of three sets of crossed fringes, respectively. Subscripts w and u denote 'wrapped phase' and 'unwrapped phase', respectively. SPU denote the spatial phase unwrapping operation. Three steps are used to describe the procedure of calculating the horizontal phase:

•
Step 1: Two unwrapped phases ϕ xw1 and ϕ xw1 " with non-linearity error are obtained from the single-frequency crossed fringes with and without the initial phase offset of π, respectively. Then, an unwrapped phase ϕ x1 eliminated the second non-linearity error obtained by the double five-step algorithm.

•
Step 2: Two wrapped phases ϕ xwl and ϕ xwl " are firstly obtained from the lowfrequency (f l ) crossed fringes with and without the initial phase offset of π, respectively. Then, combining the unwrapped phase ϕ x1 obtained in Step 1, the two wrapped phases are unwrapped to obtain ϕ xul and ϕ xul ", respectively. Finally, an unwrapped phase ϕ xl without the second non-linearity error can be obtained by the double fivestep algorithm.

•
Step 3: Similarly, two wrapped phases ϕ xwh and ϕ xwh " respectively obtained from high-frequency (f h ) crossed fringes with and without the initial phase offset of π are unwrapped to obtain ϕ xuh and ϕ xuh ", employing the unwrapped phase ϕ xl obtained in Step 2. The final corrected phase ϕ xh can be obtained by the double five-step algorithm.
A similar procedure can be performed to obtain the vertical phase from the crossed fringes.
A simulation is conducted to investigate the performance of the double five-step algorithm. The size of the simulated fringe patterns is 512 × 512 pixels. Three sets of fringes with the number of fringe periods of 1, 8 and 64 are used in 3FTPU. The gamma value of the system is set as 2.4, which leads to obvious 2nd and 3rd non-linearity. The simulated phase error of the double five-step algorithm, the five-step CGPSP method and the traditional five-step SGPSP method are compared. The 400th row of the horizontal phase errors and the 114th column of the vertical phase errors are shown in Figure 5a,c, respectively. For clarity, Figure 5b,d show the zoomed results of area A in Figure 5a and area B in Figure 5c, respectively. The STD values of the phase errors and the number of fringe patterns are given in Table 1. As shown in Figure 5a,c, abnormal phase jump errors emerge in five-step CGPSP because the non-linearity errors in the wrapped phases lead to fringe order errors in phase unwrapping. The double five-step algorithm effectively improves the phase accuracy by eliminating the second non-linearity. The five-step SGPSP performs better than the double five-step algorithm because it eliminates the second and third non-linearity. Anyway, the double five-step CGPSP provides a convenient way to eliminate second non-linearity in the measurement system where the physical crossed grating is designed to produce the structured fringe. If only the second non-linearity is included in the crossed fringe patterns, the accuracy of five-step CGPSP is as same as that of five-step SGPSP.
from the single-frequency crossed fringes with and without the initial phase offset of π, respectively. Then, an unwrapped phase φx1 eliminated the second non-linearity error obtained by the double five-step algorithm.


Step 2: Two wrapped phases φxwl′ and φxwl″ are firstly obtained from the low-frequency (fl) crossed fringes with and without the initial phase offset of π, respectively. Then, combining the unwrapped phase φx1 obtained in Step 1, the two wrapped phases are unwrapped to obtain φxul′ and φxul″, respectively. Finally, an unwrapped phase φxl without the second non-linearity error can be obtained by the double fivestep algorithm.


Step 3: Similarly, two wrapped phases φxwh′ and φxwh″ respectively obtained from high-frequency (fh) crossed fringes with and without the initial phase offset of π are unwrapped to obtain φxuh′ and φxuh″, employing the unwrapped phase φxl obtained in Step 2. The final corrected phase φxh can be obtained by the double five-step algorithm. A similar procedure can be performed to obtain the vertical phase from the crossed fringes.  Table 1. As shown in Figure 5a,c, abnormal phase jump errors emerge in fivestep CGPSP because the non-linearity errors in the wrapped phases lead to fringe order errors in phase unwrapping. The double five-step algorithm effectively improves the phase accuracy by eliminating the second non-linearity. The five-step SGPSP performs better than the double five-step algorithm because it eliminates the second and third nonlinearity. Anyway, the double five-step CGPSP provides a convenient way to eliminate second non-linearity in the measurement system where the physical crossed grating is designed to produce the structured fringe. If only the second non-linearity is included in the crossed fringe patterns, the accuracy of five-step CGPSP is as same as that of five-step SGPSP.

Gamma Correction Method Based on Probability Distribution Function
The non-linearity error in CGPSP is so complicated that it is difficult to passively eliminate all the high-order harmonics and the crosstalk components. An active correction method, the gamma correction method based on PDF [23], is used to eliminate the phase error in CGPSP.
Theoretically, if an appropriate value γ p which nearly equals 1/γ is found to preprocess the projected fringes, the non-linearity of the system can be eliminated. The captured crossed fringes can be rewritten as: The gamma correction method based on PDF [23] can be used to calculate the preencoded value γ p . In practice, considering the defocusing effect of the digital projector with a large aperture, Equation (17) is rewritten as [23]: where C 1 , C 2 , γ a and γ b are system parameters. By projecting two sets of vertical sinusoidal fringe patterns with different pre-encoded gamma values, γ a and γ b can be calculated based on the PDF method. Then, setting γ a /γ p + γ b = 1, the desired pre-encoded value γ p can be obtained. Theoretically, the pre-encoded value γ p reflects the non-linearity of the system and can be calculated from either the captured horizontal or vertical sinusoidal fringe patterns. For instance, using the experimental setup as shown in Figure 6 and projecting the horizontal and vertical sinusoidal fringe patterns, we calculated two sets of pre-encoded values in different measurement conditions (e.g., the projector and camera were adjusted slightly). The results, as shown in Table 2, indicate that the two pre-encoded values in each case are close, which coincides with the theoretical analysis. Theoretically, if an appropriate value γp which nearly equals 1/γ is found to preprocess the projected fringes, the non-linearity of the system can be eliminated. The captured crossed fringes can be rewritten as: The gamma correction method based on PDF [23] can be used to calculate the preencoded value γp. In practice, considering the defocusing effect of the digital projector with a large aperture, Equation (17)  where C1, C2, γa and γb are system parameters. By projecting two sets of vertical sinusoidal fringe patterns with different pre-encoded gamma values, γa and γb can be calculated based on the PDF method. Then, setting γa/γp + γb = 1, the desired pre-encoded value γp can be obtained. Theoretically, the pre-encoded value γp reflects the non-linearity of the system and can be calculated from either the captured horizontal or vertical sinusoidal fringe patterns. For instance, using the experimental setup as shown in Figure 6 and projecting the horizontal and vertical sinusoidal fringe patterns, we calculated two sets of pre-encoded values in different measurement conditions (e.g., the projector and camera were adjusted slightly). The results, as shown in Table 2, indicate that the two pre-encoded values in each case are close, which coincides with the theoretical analysis.

Experiments and Discussion
The experimental setup is shown in Figure 6, including a DLP projector with the resolution of 1280 × 800 (GVD PDC03), a CCD camera with the resolution of 1280 × 1024 (IDS UI-124xSE-M), a plate white board and some tested objects. To generate fringe deformation in both horizontal and vertical directions, the baseline of the projector and the camera has components in the horizontal and vertical direction of the board. The 3FTPU algorithm is used in the experiment; 1, 8 and 64 are selected as the number of fringe period of the single-frequency, low-frequency and high-frequency crossed fringes, respectively.

Phase Calculation of Crossed-Grating Phase-Shifting Profilometry
First, the accuracy of the double five-step algorithm and the gamma correction method were compared by measuring the flat white board. Traditional 16-step SGPSP were used to obtain the ideal horizontal and vertical phases of the white board. The phase error was obtained by subtracting the measured phase from the ideal phase in each direction. The fringe patterns and their spectra are shown in Figure 7. Figure 7a shows a captured crossed fringe pattern. Figure 7b shows a captured crossed fringe pattern with an initial phase offset of π. Figure 7c is a captured crossed fringe with gamma correction and Figure 7d is a vertical sinusoidal fringe. Figure 7e-h show the corresponding frequency spectra of the above four fringe patterns. There are obvious second harmonic and crosstalk components in Figure 7e,f, while these harmonics are eliminated by the gamma correction method, as shown in Figure 7g. The captured vertical sinusoidal fringe pattern only contains obvious second harmonic besides the direct component and the fundamental component, as shown in Figure 7h.

Phase Calculation of Crossed-Grating Phase-Shifting Profilometry
First, the accuracy of the double five-step algorithm and the gamma correction method were compared by measuring the flat white board. Traditional 16-step SGPSP were used to obtain the ideal horizontal and vertical phases of the white board. The phase error was obtained by subtracting the measured phase from the ideal phase in each direction. The fringe patterns and their spectra are shown in Figure 7. Figure 7a shows a captured crossed fringe pattern. Figure 7b shows a captured crossed fringe pattern with an initial phase offset of π. Figure 7c is a captured crossed fringe with gamma correction and Figure 7d is a vertical sinusoidal fringe. Figure 7e-h show the corresponding frequency spectra of the above four fringe patterns. There are obvious second harmonic and crosstalk components in Figure 7e,f, while these harmonics are eliminated by the gamma correction method, as shown in Figure 7g. The captured vertical sinusoidal fringe pattern only contains obvious second harmonic besides the direct component and the fundamental component, as shown in Figure 7h. Taking the horizontal phase as example, Figure 8a-d show the phase error maps obtained by five-step CGPSP, the double-five algorithm, five-step CGPSP with gamma correction and five-step SGPSP, respectively. For clarity, a section of the 300th row of the horizontal phase errors and a section of the 456th column of the vertical phase errors are shown in Figure 8e,f, respectively. Apparently, there are serious phase jump errors caused by the fringe order errors in five-step CGPSP. The double five-step algorithm apparently reduces the non-linearity error. The phase error of the gamma correction method is less than that of the double five-step algorithm, and the phase error of the five-step SGPSP is smallest. The quantitative comparison results are listed in Table 3. The results of the double five-step algorithm and the five-step SGPSP method coincide with their simulation Taking the horizontal phase as example, Figure 8a-d show the phase error maps obtained by five-step CGPSP, the double-five algorithm, five-step CGPSP with gamma correction and five-step SGPSP, respectively. For clarity, a section of the 300th row of the horizontal phase errors and a section of the 456th column of the vertical phase errors are shown in Figure 8e,f, respectively. Apparently, there are serious phase jump errors caused by the fringe order errors in five-step CGPSP. The double five-step algorithm apparently reduces the non-linearity error. The phase error of the gamma correction method is less than that of the double five-step algorithm, and the phase error of the five-step SGPSP is smallest. The quantitative comparison results are listed in Table 3. The results of the double five-step algorithm and the five-step SGPSP method coincide with their simulation results. The gamma correction method performs better than the double five-step algorithm. In addition, the error of the gamma correction method is bigger than that of the five-step SGPSP method, because there are more low-intensity areas in the crossed fringe pattern compared with the single carrier-frequency fringe, which decreases the signal-to-noise ratio. However, the error is acceptable and fewer fringe patterns are required in the gamma correction method.  In the second experiment, a couple of isolated surfaces were measured. The results are shown in Figure 9, where the first, second and third rows correspond to the measurement results of five-step CGPSP, the double five-step algorithm and five-step CGPSP with gamma correction, respectively. The captured high-frequency crossed fringe patterns, the horizontal and vertical phases of the three methods are shown in the first, second and third columns of Figure 9, respectively. The phases retrieved by five-step CGPSP are distorted seriously by the non-linearity effect, as shown in Figure 9b,c. The double five-step CGPSP effectively attenuates the non-linearity error, but there is still the residue phase error in the surfaces as shown in Figure 9e,f. Because the method only eliminates the second non-linearity. Figure 9h,i show that the gamma correction method almost removes the non-linearity error.  In the second experiment, a couple of isolated surfaces were measured. The results are shown in Figure 9, where the first, second and third rows correspond to the measurement results of five-step CGPSP, the double five-step algorithm and five-step CGPSP with gamma correction, respectively. The captured high-frequency crossed fringe patterns, the horizontal and vertical phases of the three methods are shown in the first, second and third columns of Figure 9, respectively. The phases retrieved by five-step CGPSP are distorted seriously by the non-linearity effect, as shown in Figure 9b The experiments indicate that CGPSP with gamma correction can more effectively eliminate the non-linearity error and requires less fringes compared with the double fivestep algorithm. However, the double five-step algorithm can provide convenience to eliminate the non-linear error in the case of using the physical grating to generate the crossed fringe pattern.

Inverse Pattern Projection Based on CGPSP
The five-step CGPSP method with gamma correction is applied in the IPP technique. A gourd model shown in Figure 10a was measured. Three captured crossed fringe patterns with the number of fringe periods of 1, 8 and 64 are shown in Figure 10a-c, respectively. We defined an expected straight fringe pattern and a character pattern which could be 'seen' by the CCD camera, as shown in Figure 10d,g. Two corresponding inverse patterns were generated by the IPP technique, as shown in Figure 10e,h. The resulting images captured by the CCD camera are shown in Figure 10f,i. The results verify that the geometric mapping relationship between the projector pixel and the camera pixel are correctly established by IPP based on CGPSP with fewer fringes. The experiments indicate that CGPSP with gamma correction can more effectively eliminate the non-linearity error and requires less fringes compared with the double fivestep algorithm. However, the double five-step algorithm can provide convenience to eliminate the non-linear error in the case of using the physical grating to generate the crossed fringe pattern.

Inverse Pattern Projection Based on CGPSP
The five-step CGPSP method with gamma correction is applied in the IPP technique. A gourd model shown in Figure 10a was measured. Three captured crossed fringe patterns with the number of fringe periods of 1, 8 and 64 are shown in Figure 10a-c, respectively. We defined an expected straight fringe pattern and a character pattern which could be 'seen' by the CCD camera, as shown in Figure 10d,g. Two corresponding inverse patterns were generated by the IPP technique, as shown in Figure 10e,h. The resulting images captured by the CCD camera are shown in Figure 10f,i. The results verify that the geometric mapping relationship between the projector pixel and the camera pixel are correctly established by IPP based on CGPSP with fewer fringes.
An application of IPP based on CGPSP with gamma correction was carried out to show the encoded two-dimensional (2D) pattern on the 3D object, as an augmented reality display. A 3LCD projector (Epson CB-X29) was used to project the crossed fringe patterns and the inverse patterns. The height distribution of the gourd model was firstly obtained employing the phase-to-height mapping technique [35]. Then, with the height information and the geometric mapping relationship established in advance, a contour-line inverse pattern and a color-coding inverse pattern were generated. Finally, the inverse patterns were projected on the gourd model. The resulting images captured by a camera are shown in Figure 11a,b, respectively. Another two inverse patterns of the designed color images were also generated and projected on the object. The captured images are shown in Figure 11c,d. These encoded 2D patterns fit well on the 3D model, which enhances our visual experience. An application of IPP based on CGPSP with gamma correction was carried out to show the encoded two-dimensional (2D) pattern on the 3D object, as an augmented reality display. A 3LCD projector (Epson CB-X29) was used to project the crossed fringe patterns and the inverse patterns. The height distribution of the gourd model was firstly obtained employing the phase-to-height mapping technique [35]. Then, with the height information and the geometric mapping relationship established in advance, a contour-line inverse pattern and a color-coding inverse pattern were generated. Finally, the inverse patterns were projected on the gourd model. The resulting images captured by a camera are shown in Figure 11a,b, respectively. Another two inverse patterns of the designed color images were also generated and projected on the object. The captured images are shown in Figure  11c,d. These encoded 2D patterns fit well on the 3D model, which enhances our visual experience.

Conclusions
In this paper, research to improve the accuracy and flexibility of CGPSP has been conducted. A mathematical model was firstly derived to analyze the non-linearity error in the measured phases obtained by the CGPSP method. Then, the double five-step algorithm and the gamma correction method based on PDF were introduced to eliminate the non-linearity error. The double five-step algorithm proposed on the basis of the mathematical model can passively eliminate the second non-linearity error, while the gamma correction method can actively remove the high-order harmonics more effectively and  An application of IPP based on CGPSP with gamma correction was carried out to show the encoded two-dimensional (2D) pattern on the 3D object, as an augmented reality display. A 3LCD projector (Epson CB-X29) was used to project the crossed fringe patterns and the inverse patterns. The height distribution of the gourd model was firstly obtained employing the phase-to-height mapping technique [35]. Then, with the height information and the geometric mapping relationship established in advance, a contour-line inverse pattern and a color-coding inverse pattern were generated. Finally, the inverse patterns were projected on the gourd model. The resulting images captured by a camera are shown in Figure 11a,b, respectively. Another two inverse patterns of the designed color images were also generated and projected on the object. The captured images are shown in Figure  11c,d. These encoded 2D patterns fit well on the 3D model, which enhances our visual experience.

Conclusions
In this paper, research to improve the accuracy and flexibility of CGPSP has been conducted. A mathematical model was firstly derived to analyze the non-linearity error in the measured phases obtained by the CGPSP method. Then, the double five-step algorithm and the gamma correction method based on PDF were introduced to eliminate the non-linearity error. The double five-step algorithm proposed on the basis of the mathematical model can passively eliminate the second non-linearity error, while the gamma correction method can actively remove the high-order harmonics more effectively and

Conclusions
In this paper, research to improve the accuracy and flexibility of CGPSP has been conducted. A mathematical model was firstly derived to analyze the non-linearity error in the measured phases obtained by the CGPSP method. Then, the double five-step algorithm and the gamma correction method based on PDF were introduced to eliminate the nonlinearity error. The double five-step algorithm proposed on the basis of the mathematical model can passively eliminate the second non-linearity error, while the gamma correction method can actively remove the high-order harmonics more effectively and requires fewer projected patterns. Therefore, CGPSP with the gamma correction method is recommended in practical applications. Finally, we applied the CGPSP method with gamma correction to the IPP technique, and the augmented reality display was realized. The experiment results demonstrate the CGPSP method with gamma correction is reliable and practical. The quantitative analysis of the geometric mapping accuracy between the projector pixel and camera pixel is not the main work of this manuscript. In the future work, we will research this problem.