# Stair phase-coding fringe plus phase-shifting used in 3D measuring profilometry

- Zhuohuan Zeng
^{1}, - Biao Li
^{1}, - Yanjun Fu
^{1}Email author and - Minggang Chai
^{1}

**12**:9

https://doi.org/10.1186/s41476-016-0013-9

© The Author(s) 2016

**Received: **4 April 2016

**Accepted: **30 May 2016

**Published: **21 July 2016

## Abstract

As the number of codewords adopted in phase-coding fringes increases, the solution of fringe orders leads to many mistakes. Consequently, errors of the unwrapped phase occur. Thus, increasing the codeword approach in a phase-coding fringe remains a challenge. In this paper, a modified stair phase-coding fringe is designed, and a new phase unwrapping algorithm based on shifting fringe order is presented. The main idea of this method is that the width ratio between the sinusoidal fringe and each stair phase of phase-coding fringe is set to 1: n. The fringe order retrieved from the phase-coding fringe can be multiplied by the shift itself, thereby assisting phase unwrapping. This method adopts fewer codewords to replace the usual large number. As such, the approach gains two merits. One is that it guarantees a high measurement accuracy. The other is that it allows the measurement of isolated objects with complicated shapes. The experiments demonstrate that the proposed method is simple but effective.

## Keywords

## Background

With the rapidly development of computer technology, optical and optoelectronic technology, three-dimensional measurement theory and technology based on structured light has been rapid developed. Many methods have been proposed to recover 3D surface geometry using different principles [1]. Those methods characterized by non-contact operation, full-field acquisition and fast data processing has been widely used in industrial inspection, quality control, reverse engineering, micro-fabrication and other fields [2–6].

Many methods have been utilized to measure complex surfaces. Zhao et al. [7] used two phase images with different precision in unwrapping. Considering the numerous images required in Zhao’s method, Li et al. [8] proposed two-frequency grating profilometry, which entails only one grating instead of changing gratings with different equivalent wavelengths. Zhang et al. [9] presented a phase unwrapping algorithm based on multi-frequency fringe projection. The method of combined fringes is also used in 3D measurement. Zhang et al. [10] suggested a method that embeds a speckle-like signal in three sinusoidal fringe patterns to eliminate phase ambiguity. Basing from this technique, Feng et al. [11] proposed a novel speckle-embedded fringe projection method using a graphics processing unit to process data in real time. The Gray code plus phase-shifting method determines the codewords from image intensity [12–14]. However, the measurement resolution is limited by the errors derived from gray-level quantization and noise. Meanwhile, the codewords are less robust for measuring high-contrast surfaces and limited to 2^{m} (where m is regarded as the number of Gray code patterns). Liu et al. [15] developed a novel encoded-phase technique for phase measuring profilometry, in which the differentially wrapped phases are regarded as codewords. This method is suitable for capturing dynamic scenes, but it is influenced by object texture and noise. Wang et al. [16] presented a novel absolute phase recovery technique with a phase-coding fringe. This technique not only produces more codewords but also receives more robust measurement results for different fringe image brightness levels compared with Gray code techniques. Fu et al. [17] followed Wang’s theory and measured a blade with a complex shape. However, the measurement accuracy was reduced when numerous codewords were adopted. Different from the method proposed by Wang, Zheng et al. [18] introduced a technique wherein two sets of phase-coding fringes are projected to address the difficulty in judging the fringe order. Basing from Zheng’s foundation, Zhou et al. [19] developed a color fringe coding method to hasten the measurement speed. However, this technique was required to handle the color crosstalk. Chen [20] added a correction method to stabilize the phase-unwrapping algorithm. Meanwhile, Xu et al. [21] proposed an encoding strategy that increases the range of unique phase distribution to 10*π*. This method is capable of reconstructing holes, steps, and other complicated shapes.

The paper is organized as follows. Section Methods describes the principles of the proposed method. Section Experiments and Results presents the experiments and results. Section Discussion discusses how to generate good measurement results. Finally, Section Conclusion provides the conclusion.

## Methods

### Measurement system

Where l_{0} is the distance between the entrance pupil of the CCD camera and the reference plane, and d is the distance between the entrance pupil of the CCD camera and the exit pupil of the projector. *f*
_{
0
} is the spatial frequency of the sinusoidal fringe pattern on the reference plane. Δ*ϕ* is the phase difference between the corresponding point on the object and reference plane. The parameters *l*
_{
0
}, *d* and *f*
_{
0
} are obtained by calibration. The verticality and parallel of the system are calibrated by the method of reference [23].

### Four-step phase-shifting algorithm

Phase-shifting method had been extensively adopted in optical metrology because of its measurement speed and accuracy. Over the years, a variety of phase-shifting algorithms have been developed, that include three-step, four-step, and lease-square algorithms [24]. Four-step phase-shifting algorithm can avoid the 1-th and 2-th non-linearity of the measurement system [25]. In consideration of the measurement speed and accuracy, four-step phase-shifting algorithm is adopted in this paper.

*A*(

*x*,

*y*) is the average intensity,

*B*(

*x*,

*y*) is the intensity modulation and Φ(

*x*,

*y*) is the phase to be solved for. Simultaneously, solving Eqs. (2)-(5) leads to

The phase obtained in Eq. (6) ranges from − *π* to *π* with 2*π* discontinuities. A phase-unwrapping algorithm should be used to obtain continuous phase.

### Algorithm of the designed stair phase-coding fringe

- (1)Embed the codeword into the phase
*φ*′(*x*,*y*) with the following stair phase function:where$$ {\varphi}^{\prime}\left(x,y\right)=\hbox{-} \pi +\mathrm{floor}\left[\frac{ \mod \left(x\hbox{-} 1,\mathrm{p}\times \mathrm{N}\right)}{\mathrm{p}}\right]\times \frac{2\pi }{\mathrm{N}\hbox{-} 1} $$(7)*floor*[*x*] is the largest integer not greater than*x*, mod(*x*,*y*) is the remainder after the division of*x*by*y*, p is the number of pixels per stair phase, and N is the step number in one rising stair phase. We define S = 1024/(p × N) as the sub-period number that corresponds to the segment number of*φ*′(*x*,*y*). In this section, p = 64, N = 4, and S = 4. The phase*φ*′(*x*,*y*) is denoted as a red dash-and-dot line in Fig. 3. - (2)Normalize the phase
*φ*′(*x*,*y*) as follows:where$$ \varphi \left(x,y\right)=-3.13+\left[\frac{\varphi^{\prime}\left(x,y\right)- \min \left({\varphi}^{\prime}\left(x,y\right)\right)}{ \max \left({\varphi}^{\prime}\left(x,y\right)\right)- \min \left({\varphi}^{\prime}\left(x,y\right)\right)}\right]\times 2\times 3.13 $$(8)*φ*(*x*,*y*) is the coding phase ranging from −3.13 to 3.13, max(*x*) is the maximum value of*x*, and min(*φ*′) is the minimum value of*φ*′. The coding phase*φ*(*x*,*y*) is represented by a solid blue line in Fig. 3. - (3)Put the coding phase into four-step phase-shifting fringe patterns:where$$ {I}_{{}_k}^c\left(x,y\right)=A\left(x,y\right)+B\left(x,y\right) \cos \left[\varphi \left(x,y\right)+\left(k-1\right)\frac{\pi }{2}\right] $$(9)
*k*= 1, 2, 3, 4. The phase-shifting fringe \( {I}_{{}_4}^c \) is displayed in Fig. 4.

### New phase unwrapping algorithm

- (1)Calculate coding phase
*φ*(*x*,*y*) with the phase-shifting algorithm:$$ \varphi \left(x,y\right)={ \tan}^{-1}\left(\frac{I_{{}_4}^c-{I}_{{}_2}^c}{I_{{}_1}^c-{I}_{{}_3}^c}\right) $$(10) - (2)Quantize the decimal coding phase
*φ*(*x*,*y*) into the segmented integer fringe order*k*_{00}(*x*,*y*):$$ {k}_{00}\left(x,y\right)=\left(N-1\right)\times \left[\frac{\varphi \left(x,y\right)- \min \left(\varphi \left(x,y\right)\right)}{ \max \left(\varphi \left(x,y\right)\right)- \min \left(\varphi \left(x,y\right)\right)}\right]+1 $$(11)The segmented integer fringe order

*k*_{00}(*x*,*y*) is represented by a red dash-and-dot line in Fig. 5. - (3)Generate a contrary fringe order
*k*_{01}(*x*,*y*):$$ {k}_{01}\left(x,y\right)=N+1-{k}_{00}\left(x,y\right) $$(12) - (4)Find the jump pixel point in the segmented fringe order as follows:$$ {k}_{01}\left(x,y\right)-{k}_{00}\left(x,y\right)==N-1 $$(13)
In Fig. 6a, b, and c denote the jump pixel points in the pixel axis. When the two segmented fringe orders satisfy Eq. (13), the pixels are saved in the jump pixel points matrix [

*a*,*b*,*c*]_{ x × 3}. - (5)Connect the segmented fringe order to a continuous fringe order
*k*_{1}(*x*,*y*) as follows:where s is the total pixels in each row, and$$ \left\{\begin{array}{l}{k}_1\left(x,1:a\right)={k}_{00}\left(x,1:a\right)\\ {}{k}_1\left(x,a+1:b\right)={k}_{00}\left(x,a+1:b\right)+N\times 1\\ {}{k}_1\left(x,b+1:c\right)={k}_{00}\left(x,b+1:c\right)+N\times 2\\ {}{k}_1\left(x,c+1:\mathrm{s}\right)={k}_{00}\left(x,c+1:s\right)+N\times 3\end{array}\right. $$(14)*s*= 1024. - (6)Create a new fringe order by the shift half frequency of
*k*_{1}as shown below:$$ {k}_2\left(x,y\right)=\left\{\begin{array}{cc}\hfill {k}_1\left(x,y+p/2\right),\hfill & \hfill y>p/2\hfill \\ {}\hfill 0,\hfill & \hfill y\le p/2\hfill \end{array}\right. $$(15)where$$ k\left(x,y\right)={k}_1\left(x,y\right)+{k}_2\left(x,y\right) $$(16)*k*_{2}(*x*,*y*) is the shifted fringe order and*k*(*x*,*y*) is the new fringe order. Additional details are provided in the magnifying frame in Fig. 7. - (7)Obtain the continue phase Ψ(
*x*,*y*) as follows:In Fig. 8, the blue line denotes the wrapped phase, and the red line represents the fringe order$$ \Psi \left(x,y\right)=2\pi \times k\left(x,y\right)+\Phi \left(x,y\right) $$(17)*k*(*x*,*y*).

## Experiments and results

### Measurement of a long strip

### Measurement of a foam holder

### Measurement of isolated objects

### Measurement of a standard gauge block

Experimental results on standard gauge blocks (Unit: mm)

Index | Ideal height | Measured height | Absolute error | RMS error |
---|---|---|---|---|

1 | 6 | 5.979 | 0.021 | 0.027 |

2 | 16 | 16.034 | 0.034 | 0.031 |

3 | 21 | 20.963 | 0.037 | 0.032 |

4 | 31 | 30.959 | 0.041 | 0.033 |

## Discussion

## Conclusion

A modified stair phase-coding fringe was designed, and a new phase unwrapping algorithm based on stair phase-coding fringe was presented. This method used a large number of codewords as much as the resolution ratio of CCD allows, it can correctly judge the fringe order, achieving accurate phase unwrapping. The width ratio between the sinusoidal fringe and each stair phase of phase-coding fringe is set to 1: n. Compared with other methods, the proposed method adopts a lower number instead of numerous codewords. Therefore, the proposed approach gains two merits. One is that it can improve the measurement accuracy, the other is that it can measure isolated objects with complicated shapes. In our future work, two issues remain to be addressed: correction of the non-uniformity of the stair phase-coding fringe during large-scene measurements and encoding of a composite color pattern for the dynamic scene.

## Declarations

### Acknowledgment

This project is supported by the National Natural Science Foundation of China (Grant No. 51365045,61462063), Shanghai Aerospace Science and Technology Innovation Fund (Grant No. SAST2015046).

### Competing interests

The authors declare that they have no competing interests.

### Authors contributions

All authors read and approved the final manuscript.

**Open Access**This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

## Authors’ Affiliations

## References

- Zhang, S: Handbook of 3D Machine Vision: Optical Metrology and Imaging. Lasers Optics & Photonics, London New York (2013)Google Scholar
- Gorthi, SS, Rastogi, P: Fringe projection techniques: whither we are? Opt. Lasers Eng.
**48**(2), 133–140 (2010)View ArticleGoogle Scholar - Geng, J: Structured-light 3D surface imaging: a tutorial. Adv. Opt. Photonics.
**3**(2), 128–160 (2011)View ArticleGoogle Scholar - Zhao, B, Zhao, HJ, Xie, HM: Advanced optical measurement methods and its applications. Opt. Lasers Eng.
**54**, 139–140 (2014)View ArticleGoogle Scholar - Jiang, C, Jia, S, Xu, Y, et al.: The application of multi-frequency fringe projection profilometry on the measurement of biological tissues. Bio-Med. Mater. Eng.
**26**(s1), 395–403 (2015)View ArticleGoogle Scholar - Liu, J, Tan, J, Zhao, C, et al.: Phase-shift resolving confocal microscopy with high axial resolution, wide range and reflectance disturbance resistibility. Opt. Express
**17**(18), 16281–16290 (2009)ADSView ArticleGoogle Scholar - Zhao, H, Chen, W, Tan, Y: Phase-unwrapping algorithm for the measurement of three-dimensional object shapes. Appl. Opt.
**33**(20), 4497–4500 (1994)ADSView ArticleGoogle Scholar - Li, J, Su, H, Su, X: Two-frequency grating used in phase-measuring profilometry. Appl. Opt.
**36**(1), 277–280 (1997)ADSView ArticleGoogle Scholar - Zhang, C, Zhao, H, Gu, F, et al.: Phase unwrapping algorithm based on multi-frequency fringe projection and fringe background for fringe projection profilometry. Meas. Sci. Technol.
**26**(4), 045203 (2015)ADSView ArticleGoogle Scholar - Zhang, Y, Xiong, Z, Wu, F: Unambiguous 3D measurement from speckle-embedded fringe. Appl. Opt.
**52**(32), 7797–7805 (2013)ADSView ArticleGoogle Scholar - Feng, S, Chen, Q, Zuo, C: Graphics processing unit–assisted real-time three-dimensional measurement using speckle-embedded fringe. Appl. Opt.
**54**(22), 6865–6873 (2015)ADSView ArticleGoogle Scholar - Sansoni, G, Corini, S, Lazzari, S, et al.: Three-dimensional imaging based on Gray-code light projection: characterization of the measuring algorithm and development of a measuring system for industrial applications. Appl. Opt.
**36**(19), 4463–4472 (1997)ADSView ArticleGoogle Scholar - Sansoni, G, Carocci, M, Rodella, R: Three-dimensional vision based on a combination of gray-code and phase-shift light projection: analysis and compensation of the systematic errors. Appl. Opt.
**38**(31), 6565–6573 (1999)ADSView ArticleGoogle Scholar - Zheng, D, Da, F: Self-correction phase unwrapping method based on Gray-code light. Opt. Lasers Eng.
**50**(8), 1130–1139 (2012)View ArticleGoogle Scholar - Liu, Y, Su, X, Zhang, Q: A novel encoded-phase technique for phase measuring profilometry. Opt. Express
**19**(15), 14137–14144 (2011)ADSView ArticleGoogle Scholar - Wang, Y, Zhang, S: Novel phase-coding method for absolute phase retrieval. Opt. Letters.
**37**(11), 2067–2069 (2012)ADSView ArticleGoogle Scholar - Fu, Y, Wang, Y, Wan, M, et al.: Three-dimensional profile measurement of the blade based on surface structured light. Optik-Int. J. Light Electron Opt.
**124**(18), 3225–3229 (2013)View ArticleGoogle Scholar - Zheng, D, Da, F: Phase coding method for absolute phase retrieval with a large number of codewords. Opt. Express
**20**(22), 24139–24150 (2012)ADSView ArticleGoogle Scholar - Zhou, C, Liu, T, Si, S, et al.: An improved stair phase encoding method for absolute phase retrieval. Opt. Lasers Eng.
**66**, 269–278 (2015)View ArticleGoogle Scholar - Chen, F, Su, X: Phase-unwrapping algorithm for the measurement of 3D object. Optik-Int. J. Light Electron Opt.
**123**(24), 2272–2275 (2012)View ArticleGoogle Scholar - Xu, J, Liu, S, Wan, A, et al.: An absolute phase technique for 3D profile measurement using four-step structured light pattern. Opt. Lasers Eng.
**50**(9), 1274–1280 (2012)View ArticleGoogle Scholar - Xu, Q: System calibration technique of profilometry by projected grating. Opt. Tech.
**26**(2; ISSU 142), 126–129 (2000)Google Scholar - Takeda, M, Mutoh, K: Fourier transform profilometry for the automatic measurement of 3-D object shapes. Appl. Opt.
**22**(24), 3977–3982 (1983)ADSView ArticleGoogle Scholar - Malacara, D: Optical Shop Testing (Wiley Series in Pure and Applied Optics). Wiley-Interscience, Canada (2007)Google Scholar
- Zhou, L, Su, X, Wang, L: Analysis of errors introduced by detector nonlinearity in Phase Measuring Profilometry. Laser Journal
**3**, 009 (2002) (in Chinese)Google Scholar - Zhang, S, Huang, PS: Phase error compensation for a 3-D shape measurement system based on the phase-shifting method. Opt. Eng.
**46**(6), 063601-063601-9 (2007)ADSGoogle Scholar