# Fast Fourier-Based Phase Unwrapping on the Graphics Processing Unit in Real-Time Imaging Applications

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Method and Implementation

#### 2.1. Schofield, Volkov and Zhu Phase Unwrapping

#### 2.2. Preconditioned Conjugate Gradient Phase Unwrapping

#### 2.3. Parallel Implementation of the Discrete Cosine Transform

## 3. Numeric and Experimental Results

#### 3.1. Schofield, Volkov and Zhu Phase Unwrapping

**Table 1.**Processing times of central processing unit (CPU)-and graphics processing unit (GPU)-based phase unwrapping algorithms, executed on phase maps of varying pixel sizes. The last two columns include the corresponding processing times of optimized GPU-accelerated discrete cosine transforms (DCTs) and inverse DCTs (IDCTs).

Image Pixel Size | CPU (FFT) (ms) | GPU (MM) incl. mem. trans. (ms) | GPU (MM) excl. mem. trans. (ms) | Acceleration Factor (×) | DCT/IDCT incl. mem trans. (ms) | DCT/IDCT excl. mem trans. (ms) |
---|---|---|---|---|---|---|

256 × 256 | 9.6 | 1.6 | 1.2 | 6.0 | 0.5 | 0.1 |

512 × 512 | 40.2 | 4.1 | 3.2 | 9.8 | 1.3 | 0.3 |

640 × 480 | 48.5 | 4.9 | 4.0 | 9.9 | 1.5 | 0.5 |

1024 × 1024 | 182.9 | 20.1 | 16.7 | 9.1 | 5.9 | 2.5 |

2048 × 2048 | 735.9 | 136.4 | 128.4 | 5.4 | 27.9 | 19.8 |

**Figure 1.**Phase unwrapping procedure for two phase maps obtained with different imaging modalities (first row (

**a**–

**c**): electron holography, second row (

**d**–

**f**): phase-sensitive magnetic resonance imaging (MRI)). The first column (a,d) shows the input wrapped phase map; the second column (b,e) depicts the integer number of 2π that is added to the respective wrapped phase map to end up with the unwrapped phase map, included in the third column (c,f). Scale bars are included in the third column of subfigures only but apply to the other images in their respective row, also.

#### 3.2. Preconditioned Conjugate Gradient Phase Unwrapping

**Figure 2.**The preconditioned conjugate gradient algorithm is able to correctly unwrap a randomly generated phase map containing regions where phase data is set to zero in three iterations (IT 1-3) by weighting the intermediate preconditioned conjugate gradient (PCG) solutions according to a user-defined input quality mask. Using a simple binary mask, the phase misses (circled in red) are reduced from seven to none in three iterations.

#### 3.3. Real-Time Optical Profilometry

**Figure 3.**Single-frame excerpt from a multi-image video recording of real-time optical profilometry measurements of moving pieces of fabric (Media 1). (

**a**) One of three phase-shifted input images. (

**b**) Wrapped phase map. (

**c**) Unwrapped phase map. (

**d**) 3D perspective-view of (c).

## 4. Conclusions

## Acknowledgments

## Author Contributions

## Conflicts of Interest

## References

- Takeda, M.; Mutoh, K. Fourier transform profilometry for the automatic measurement of 3-D object shapes. Appl. Opt.
**1983**, 22, 3977–3982. [Google Scholar] - Srinivasan, V.; Liu, H.C.; Halioua, M. Automated phase-measuring profilometry of 3-D diffuse objects. Appl. Opt.
**1984**, 23, 3105–3108. [Google Scholar] - Takeda, M. Spatial-carrier fringe-pattern analysis and its applications to precision interferometry and profilometry: An overview. Ind. Metrol.
**1990**, 1, 79–99. [Google Scholar] - McDonach, A.; McKelvie, J.; McKenzie, P.; Walker, C.A. Improved moire interferometry and applications in fracture mechanics, residual stress and damaged composites. Exp. Tech.
**1983**, 7, 20–24. [Google Scholar] - Dirckx, J.J.J.; Buytaert, J.A.N.; Van der Jeught, S. Implementation of phase-shifting moiré profilometry on a low-cost commercial data projector. Opt. Laser Eng.
**2010**, 48, 244–250. [Google Scholar] - Haacke, E.M.; Mittal, S.; Wu, Z.; Neelavalli, J.; Cheng, Y.C. Susceptibility-weighted imaging: Technical aspects and clinical applications, part 1. Am. J. Neuroradiol.
**2009**, 30, 19–30. [Google Scholar] [CrossRef] [PubMed] - Gatehouse, P.D.; Keegan, J.; Crowe, L.A.; Masood, S.; Mohiaddin, R.H.; Kreitner, K.F.; Firmin, D.N. Applications of phase-contrast flow and velocity imaging in cardiovascular MRI. Eur. Radiol.
**2005**, 15, 2172–2184. [Google Scholar] - Colesanti, C.; Ferretti, A.; Prati, C.; Rocca, F. Monitoring landslides and tectonic motion with the permanent scatterers technique. Eng. Geol.
**2003**, 68, 3–14. [Google Scholar] - Lu, Z.; Mann, D.; Freymueller, J.T.; Meyer, D.J. Synthetic aperture radar interferometry of Okmok volcano, Alaska: Radar observations. J. Geophys. Res.
**2000**, 105, 10791–10806. [Google Scholar] - Rignot, E.; Hallet, B.; Fountain, A. Rock glacier surface motion in Beacon Valley, Antarctica, from synthetic-aperture radar interferometry. Geophys. Res. Lett.
**2002**, 29, 1–4. [Google Scholar] - Strozzi, T.; Luckman, A.; Murray, T.; Wegmuller, U.; Werner, C.L. Glacier motion estimation using SAR offset-tracking procedures. Geosci. Remote Sens.
**2002**, 40, 2384–2391. [Google Scholar] - Harp, G.R.; Saldin, D.K.; Tonner, B.P. Atomic-resolution electron holography in solids with localized sources. Phys. Rev. Lett.
**1990**, 65, 1012–1015. [Google Scholar] - Tonomura, A. Applications of electron holography. Rev. Mod. Phys.
**1987**, 59, 639–669. [Google Scholar] - Schnars, U.; Jüptner, W. Direct recording of holograms by a CCD target and numerical reconstruction. Appl. Opt.
**1994**, 33, 179–181. [Google Scholar] - Schumann, W.; Dubas, M. Holographic Interferometry: From the Scope of Deformation Analysis of Opaque Bodies; Springer Series in Optical Sciences; Springer-Verlag: Berlin, Germany; New York, NY, USA, 1979; Volume 16. [Google Scholar]
- Itoh, K. Analysis of the phase unwrapping algorithm. Appl. Opt.
**1982**, 21, 2470. [Google Scholar] - Huntley, J.M. Noise-immune phase unwrapping algorithm. Appl. Opt.
**1989**, 28, 3268–3270. [Google Scholar] - Cusack, R.; Huntley, J.M.; Goldrein, H.T. Improved noise-immune phase-unwrapping algorithm. Appl. Opt.
**1995**, 34, 781–789. [Google Scholar] - Xu, W.; Cumming, I. A region-growing algorithm for InSAR phase unwrapping. Geosci. Remote Sens.
**1999**, 37, 124–134. [Google Scholar] - Flynn, T.J. Two-dimensional phase unwrapping with minimum weighted discontinuity. J. Opt. Soc. Am. A
**1997**, 14, 2692–2701. [Google Scholar] - Ghiglia, D.C.; Romero, L.A. Minimum Lp-norm two-dimensional phase unwrapping. J. Opt. Soc. Am. A
**1996**, 13, 1999–2013. [Google Scholar] - Pritt, M.D.; Shipman, J.S. Least-squares two-dimensional phase unwrapping using FFT’s. Geosci. Remote Sens.
**1994**, 32, 706–708. [Google Scholar] - Herráez, M.A.; Burton, D.R.; Lalor, M.J.; Gdeisat, M.A. Fast two-dimensional phase-unwrapping algorithm based on sorting by reliability following a noncontinuous path. Appl. Opt.
**2002**, 41, 7437–7444. [Google Scholar] - Zhong, H.; Tang, J.; Zhang, S.; Chen, M. An improved quality-guided phase-unwrapping algorithm based on priority queue. Geosci. Remote Sens. Lett.
**2011**, 8, 364–368. [Google Scholar] - Curtis, C.W.; Zebker, H.A. Network approaches to two-dimensional phase unwrapping: Intractability and two new algorithms. J. Opt. Soc. Am. A
**2000**, 17, 401–414. [Google Scholar] - Gutmann, B.; Weber, H. Phase unwrapping with the branch-cut method: Role of phase-field direction. Appl. Opt.
**2000**, 39, 4802–4816. [Google Scholar] - Asundi, A.; Wensen, Z. Fast phase-unwrapping algorithm based on a gray-scale mask and flood fill. Appl. Opt.
**1998**, 37, 5416–5420. [Google Scholar] - Ghiglia, D.C.; Pritt, M.D. Two-Dimensional Phase Unwrapping: Theory, Algorithms, and Software; Wiley: New York, NY, USA, 1998. [Google Scholar]
- Zhang, S. Recent progresses on real-time 3D shape measurement using digital fringe projection techniques. Opt. Lasers Eng.
**2010**, 48, 149–158. [Google Scholar] - Judge, T.R.; Bryanston-Cross, P.J. A review of phase unwrapping techniques in fringe analysis. Opt. Laser Eng.
**1994**, 21, 199–239. [Google Scholar] - Zhang, S.; Li, X.; Yau, S.-T. Multilevel quality-guided phase unwrapping algorithm for real-time three-dimensional shape reconstruction. Appl. Opt.
**2007**, 46, 50–57. [Google Scholar] - Pham, H.; Ding, H.; Sobh, N.; Do, M.; Patel, S.; Popescu, G. Off-axis quantitative phase imaging processing using CUDA: Toward real-time applications. Biomed. Opt. Express
**2011**, 2, 1781–1793. [Google Scholar] - Schofield, M.A.; Zhu, Y. Fast phase unwrapping algorithm for interferometric applications. Opt. Lett.
**2003**, 28, 1194–1196. [Google Scholar] - Volkov, V.V.; Zhu, Y. Deterministic phase unwrapping in the presence of noise. Opt. Lett.
**2003**, 28, 2156–2158. [Google Scholar] - Volkov, V.V.; Zhu, Y.; De Graef, M. A new symmetrized solution for phase retrieval using the transport of intensity equation. Micron
**2002**, 33, 411–416. [Google Scholar] - Gureyev, T.E.; Nugent, K.A. Phase retrieval with the transport-of-intensity equation. II. Orthogonal series solution for nonuniform illumination. J. Opt. Soc. Am. A
**1996**, 13, 1670–1682. [Google Scholar] - Shi, W.; Zhu, Y.; Yao, Y. Discussion about the DCT/FFT phase-unwrapping algorithm for interferometric applications. Optik
**2010**, 121, 1443–1449. [Google Scholar] - Hÿtch, M.J.; Snoeck, E.; Kilaas, R. Quantitative measurement of displacement and strain fields from HREM micrographs. Ultramicroscopy
**1998**, 74, 131–146. [Google Scholar] - Eisenstat, S.C. Efficient implementation of a class of preconditioned conjugate gradient methods. SIAM J. Sci. Stat. Comput.
**1981**, 2, 1–4. [Google Scholar] - Kaufmann, G.H.; Galizzi, G.E.; Ruiz, P.D. Evaluation of a preconditioned conjugate-gradient algorithm for weighted least-squares unwrapping of digital speckle-pattern interferometry phase maps. Appl. Opt.
**1998**, 37, 3076–3084. [Google Scholar] - Saad, Y.; Schultz, M.H. Parallel implementations of preconditioned conjugate gradient methods. In Mathematical and Computational Methods in Seismic Exploration and Reservoir Modeling; Siam: Philadelphia, PA, USA, 1985; pp. 108–127. [Google Scholar]
- Yang, Q.; Vogel, C.R.; Ellerbroek, B.L. Fourier domain preconditioned conjugate gradient algorithm for atmospheric tomography. Appl. Opt.
**2006**, 45, 5281–5293. [Google Scholar] - Kershaw, D.S. The incomplete Cholesky—Conjugate gradient method for the iterative solution of systems of linear equations. J. Comput. Phys.
**1978**, 26, 43–65. [Google Scholar] - Ghiglia, D.C.; Romero, L.A. Robust two-dimensional weighted and unweighted phase unwrapping that uses fast transforms and iterative methods. J. Opt. Soc. Am. A
**1994**, 11, 107–117. [Google Scholar] - Gailly, J.L.; Nelson, M. The Data Compression Book; M&T Books: New York, NY, USA, 1995. [Google Scholar]
- Aslantas, V.; Ozer, S.; Ozturk, S. Improving the performance of DCT-based fragile watermarking using intelligent optimization algorithms. Opt. Commun.
**2009**, 282, 2806–2817. [Google Scholar] - Chen, W.H.; Smith, C.H.; Fralick, S. A fast computational algorithm for the discrete cosine transform. IEEE Trans. Commun.
**1977**, 25, 1004–1009. [Google Scholar] - Fang, B.; Shen, G.; Li, S.; Chen, H. Techniques for efficient DCT/IDCT implementation on generic GPU. In Proceedings of the 2005 IEEE International Symposium on Circuits and Systems, ISCAS 2005, Kobe, Japan, 23–26 May 2005; pp. 1126–1129.
- Ruan, J.; Han, D.D. An efficient implementation of fast DCT using CUDA. Microelectron. Comput.
**2009**, 8, 057. [Google Scholar] - Ghetia, S.; Gajjar, N.; Gajjar, R. Implementation of 2-D discrete cosine transform on GPU. Int. J. Adv. Res. Electr. Electron. Instrum. Eng.
**2013**, 2, 3024–3030. [Google Scholar] - Ye, P.; Shi, X.; Li, X. CUDA-Based Implementation of DCT/IDCT on GPU; University of Delaware: Newark, DE, USA, 2007. [Google Scholar]
- Frigo, M. A fast Fourier transform compiler. ACM Sigplan Not.
**1999**, 34, 169–180. [Google Scholar] - Van der Jeught, S. Fast Fourier-Based Phase Unwrapping. Available online: https://www.uantwerpen.be/en/rg/bimef/downloads/fourier-based-phase-/ (accessed on 12 June 2015).
- Javon, E.; Gatel, C.; Masseboeuf, A.; Snoeck, E. Electron holography study of the local magnetic switching process in magnetic tunnel junctions. J. Appl. Phys.
**2010**, 107. [Google Scholar] [CrossRef] - Bakker, C.J.; de Leeuw, H.; Vincken, K.L.; Vonken, E.J.; Hendrikse, J. Phase gradient mapping as an aid in the analysis of object-induced and system-related phase perturbations in MRI. Phys. Med. Biol.
**2008**, 53. [Google Scholar] [CrossRef] - Huang, P.S.; Zhang, S.; Chiang, F.P. Trapezoidal phase-shifting method for three-dimensional shape measurement. Opt. Eng.
**2006**, 44, 123601. [Google Scholar] [CrossRef]

© 2015 by the authors; licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Jeught, S.V.d.; Sijbers, J.; Dirckx, J.J.J. Fast Fourier-Based Phase Unwrapping on the Graphics Processing Unit in Real-Time Imaging Applications. *J. Imaging* **2015**, *1*, 31-44.
https://doi.org/10.3390/jimaging1010031

**AMA Style**

Jeught SVd, Sijbers J, Dirckx JJJ. Fast Fourier-Based Phase Unwrapping on the Graphics Processing Unit in Real-Time Imaging Applications. *Journal of Imaging*. 2015; 1(1):31-44.
https://doi.org/10.3390/jimaging1010031

**Chicago/Turabian Style**

Jeught, Sam Van der, Jan Sijbers, and Joris J. J. Dirckx. 2015. "Fast Fourier-Based Phase Unwrapping on the Graphics Processing Unit in Real-Time Imaging Applications" *Journal of Imaging* 1, no. 1: 31-44.
https://doi.org/10.3390/jimaging1010031