1 Introduction

Optical metrology may use optical interferometers [1] to measure with high accuracy a wide range of physical quantities as depth, strain analysis, temperature gradients and surface deformation. These physical quantities are determined studying the wavefront deformation when a beam of light passes through, or reflects in the sample of interest. Among wavefront reconstruction techniques based on automated interferogram analysis methods, temporal phase-shifting interferometry (TPI) is accepted as the most precise and accurate one [1]. TPI is an optical metrology technique for measuring the modulating phase of interferograms, using a controlled phase change or piston term between successive interferograms [1]. Other phase-shifting algorithms allow the determination of the modulating phase without the need of any prior knowledge about phase-shifts (asynchronous detection) [2, 3]. These asynchronous methodologies [2, 3] are usually iterative and require an initial guess to start the minimization process, typically by a least-squares minimization. As these methods are based on a minimization process, they require high computational load and processing time. Additionally, these methods require the background and contrast terms to be approximately spatially constant, and the number of interferograms has to be high enough to assure the solution convergence toward the global minimum, independently of the starting guess used.

Recently, a new asynchronous phase-shifting demodulation method based on the principal component analysis (PCA) algorithm, that can extract the phase distribution from unknown randomly phase-shifted interferograms, has been proposed [4, 5]. Different variants and applications have appeared since its publication [612]. The PCA demodulation approach is very fast—approximately two orders of magnitude faster than the advanced iterative algorithm (AIA) [2]—as it is not iterative, and it does not require performing a nonlinear optimization. Additionally, the PCA method does not need the background illumination and contrast to be spatially constant.

The different proposed phase-shifting demodulation algorithms (synchronous or asynchronous) cannot determine the accuracy of the obtained phase without the use of a reference or ground truth phase. Therefore, in practical experiments, we typically do not know how accurate our determined phase is. Note that this is an important issue as the experimental determination of the modulating phase is always affected by external disturbances. On one hand, synchronous methodologies, which acquire the interferograms with known phase-shifts between successive interferograms [1], can present a detuning error in the obtained phase [13, 14]. This is because the “known” phase-shifts may have some mismatch with respect to the actual ones, caused typically by the phase-shifter. On the other hand, asynchronous methods usually require phase-shifts to be well distributed in the [0, 2π] (rad) range. If phase-shifts are randomly distributed in the [0, 2π] range, typically it will be necessary to use a large number of interferograms to meet this requirement. The problem here is the lack of quantitative information about the required number of interferograms to obtain an accurate phase measure. Note that in some cases, with appropriate phase-shifts, five interferograms are sufficient. However, in other cases, it is required to use a much larger interferogram set. Additionally, the modulating phase obtained by any synchronous or asynchronous approach is always affected by the presence of noise in the acquired interferograms and by other external disturbances. Therefore, quantitative information about the accuracy of the retrieved phase is of great importance in practical applications. Note that if the obtained phase accuracy indicator is not acceptable, it is possible to further define automated actions as repeating the measure or acquiring additional interferograms.

In this work, we present a deep mathematical error analysis of the principal component analysis (PCA) demodulation algorithm [4, 5]. This analysis allows us to define suitable phase accuracy indicators for the PCA demodulation algorithm and a retrieved phase goodness criterion. These indicators can be used in practical applications to determine a blind estimate of the phase goodness, without the need of using any ground truth phase information, and to perform further actions if required.

In Sect. 2, we present the error analysis of the PCA method and we define the phase accuracy indicators and a phase goodness criterion. Section 3 includes some simulations and in Sect. 4, we show the experimental results. Finally, in Sect. 5, conclusions are drawn.

2 Theoretical foundations

In phase-shifting interferometry, an interferogram sequence of N samples can be described using the following expression

$$I_{n} = a + b\,\cos \left[ {\varPhi + \delta_{n} } \right] + \eta_{n} \quad n = \left[ {1,N} \right]$$
(1)

where \(I_{n} \left( {x,y} \right)\) is the nth phase-shifted interferogram, with size N x  × N y , a = a(x, y) is the background component, b = b(x, y) is the modulation or contrast term, Φ = Φ(x, y) is the modulating phase map, δ n are the phase-steps, that in our case can be randomly distributed in the [0, 2π] (rad) range, and η n  = η n (x, y) is the noise term that usually has a Gaussian distribution with zero mean. Note that the spatial dependence has been omitted for the sake of clarity. Expression (1) can be rewritten as

$$I_{n} = a + b\left( {\cos \left[ \varPhi \right]\cos \left[ {\delta_{n} } \right] - \sin \left[ {\delta_{n} } \right]\sin \left[ \varPhi \right]} \right) + \eta_{n} .$$
(2)

From Eq. (2) and grouping terms, we obtain

$$I_{n} = a + \alpha_{1n} I_{c} + \alpha_{2n} I_{s} + \eta_{n}$$
(3)

where α 1n  = cos [δ n ], α 2n  = −sin [δ n ] and I c  = b cos [Φ], I s  = b sin [Φ] correspond to the quadrature signals with size N x  × N y . From the set of phase-shifted interferograms, the background can be estimated by a temporal average as

$$a \cong {{\sum\limits_{n = 1}^{N} {I_{n} } } \mathord{\left/ {\vphantom {{\sum\limits_{n = 1}^{N} {I_{n} } } N}} \right. \kern-0pt} N}$$
(4)

and we may define the background free interferogram as

$$\tilde{I}_{n} = I_{n} - a = \alpha_{1n} I_{1} + \alpha_{2n} I_{2} + \eta_{n}$$
(5)

Expression (5) shows that a background filtered interferogram set can be expressed as a linear combination of two signals and a noise term. Using Eq. (5), we can express the whole set of measurements as

$$\tilde{I} = Q\varLambda + N$$
(6)

with

$$\varLambda = \left[ {\alpha_{1} ,\,\alpha_{2} } \right]^{T}$$
(7)

and

$$Q = \left[ {q_{1} ,\,q_{2} } \right]$$
(8)

where N is the noise matrix of size N x N y  × N, where the nth column is taken columnwise from η n ; Λ is a 2 × N matrix, where α 1 and α 2 are column vectors of size N × 1 and [·]T denotes the transposing operation. Note that the nth element of α 1 and α 2 corresponds to α 1n and α 2n , respectively. Q is a matrix of size N x N y  × 2 formed by the quadrature components, q 1 and q 2, that are column vectors with size N x N y whose elements are taken columnwise from I c and I s respectively. Finally, \(\tilde{I}\) is a matrix with size N x N y  × N where the nth column is taken columnwise from \(\tilde{I}_{n}\).

The covariance matrix C of \(\tilde{I}\) is given by \(C = \tilde{I}^{T} \tilde{I}\) and using Eq. (6) corresponds to

$$C = \varLambda^{T} Q^{T} Q\varLambda + \varLambda^{T} Q^{T} N + N^{T} Q\varLambda + N^{T} N$$
(9)

Observe that matrices \(\left( {\varLambda^{T} Q^{T} } \right)N\) and \(N^{T} \left( {Q\varLambda } \right)\) are significantly smaller than \(\varLambda^{T} Q^{T} Q\varLambda\) and N T N in a Frobenius norm sense as they correspond to the product of two uncorrelated matrices. Therefore, we can approximate Eq. (9) as

$$C \cong \varLambda^{T} Q^{T} Q\varLambda + N^{T} N$$
(10)

Observe that ΛΛ T corresponds to

$$\varLambda \varLambda^{T} = \left( {\begin{array}{*{20}c} {\left\| {\alpha_{1} } \right\|^{2} } & {\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle } \\ {\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle } & {\left\| {\alpha_{2} } \right\|^{2} } \\ \end{array} } \right)$$
(11)

with \(\left\| \cdot \right\|\) and \(\left\langle {\cdot,\cdot} \right\rangle\) the norm and inner product operators given by \(\left\| {\alpha_{1} } \right\|^{2} = \sum\nolimits_{n = 1}^{N} {\cos^{2} \left( {\delta_{n} } \right)}\), \(\left\| {\alpha_{2} } \right\|^{2} = \sum\nolimits_{n = 1}^{N} {\sin^{2} \left( {\delta_{n} } \right)}\) and \(\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle = \sum\nolimits_{n = 1}^{N} {\cos \left( {\delta_{n} } \right)\sin \left( {\delta_{n} } \right)}\). In general, the two columns of Λ are not orthogonal and ΛΛ T is not diagonal. Note that because ΛΛ T is a real and symmetric matrix, it can always be diagonalized as \(\varLambda \varLambda^{T} = P_{\varLambda }^{T} D_{\varLambda } P_{\varLambda }\), where \(D_{\varLambda }\) and \(P_{\varLambda }\) are 2 × 2 diagonal and orthogonal matrices, respectively. We can transform Λ and generate a new matrix \(\hat{\varLambda }\) that verifies \(\hat{\varLambda }\hat{\varLambda }^{T} = {I}\) as

$$\hat{\varLambda } = D_{\varLambda }^{ - 1/2} P_{\varLambda } \varLambda .$$
(12)

The diagonal elements of \(D_{\varLambda }\) are real and can be analytically calculated to be

$$\lambda_{ \pm } = \frac{{\left( {\left\| {\alpha_{1} } \right\|^{2} + \left\| {\alpha_{2} } \right\|^{2} } \right) \pm \sqrt {\left( {\left\| {\alpha_{1} } \right\|^{2} - \left\| {\alpha_{2} } \right\|^{2} } \right)^{2} + 4\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle^{2} } }}{2}$$
(13)

with

$$D_{\varLambda } = \left( {\begin{array}{*{20}c} {\lambda_{ + } } & 0 \\ 0 & {\lambda_{ - } } \\ \end{array} } \right)$$
(14)

and \(P_{\varLambda }\) is given by

$$P_{\varLambda } = \left( {\begin{array}{*{20}c} {\frac{{\left( {\lambda_{ + } - \left\| {\alpha_{1} } \right\|^{2} } \right)}}{{\sqrt {\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle^{2} + \left( {\lambda_{ + } - \left\| {\alpha_{1} } \right\|^{2} } \right)^{2} } }}} & {\frac{{\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle }}{{\sqrt {\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle^{2} + \left( {\lambda_{ - } - \left\| {\alpha_{2} } \right\|^{2} } \right)^{2} } }}} \\ {\frac{{\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle }}{{\sqrt {\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle^{2} + \left( {\lambda_{ + } - \left\| {\alpha_{1} } \right\|^{2} } \right)^{2} } }}} & {\frac{{\left( {\lambda_{ - } - \left\| {\alpha_{2} } \right\|^{2} } \right)}}{{\sqrt {\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle^{2} + \left( {\lambda_{ - } - \left\| {\alpha_{2} } \right\|^{2} } \right)^{2} } }}} \\ \end{array} } \right)$$
(15)

Observe that if the phase-sifts δ n are equally distributed in the [0, 2π] (rad) range, ΛΛ T is diagonal as \(\left\| {\alpha_{1} } \right\|^{2} = \left\| {\alpha_{2} } \right\|^{2}\) and \(\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle = 0\). In this case, \(D_{\varLambda }\) is diagonal and \(P_{\varLambda }\) is the 2 × 2 identity matrix.

Additionally, \(Q^{T} Q\) corresponds to

$$Q^{T} Q = \left( {\begin{array}{*{20}c} {\left\| {q_{1} } \right\|^{2} } & {\left\langle {q_{1} ,q_{2} } \right\rangle } \\ {\left\langle {q_{2} ,q_{1} } \right\rangle } & {\left\| {q_{2} } \right\|^{2} } \\ \end{array} } \right) = \sum\limits_{x,y} {\left( {\begin{array}{*{20}c} {\cos^{2} \left( \varPhi \right)} & {\cos \left( \varPhi \right)\sin \left( \varPhi \right)} \\ {\sin \left( \varPhi \right)\cos \left( \varPhi \right)} & {\sin^{2} \left( \varPhi \right)} \\ \end{array} } \right)}$$
(16)

If there is more than one fringe in the resultant interferograms, we can approximate \(Q^{T} Q\) as

$$Q^{T} Q = D_{Q} \cong \kappa \left( {\begin{array}{*{20}c} 1 & 0 \\ 0 & 1 \\ \end{array} } \right)$$
(17)

with \(\kappa = \sum\nolimits_{x,y} {\cos^{2} \left( \varPhi \right)} \cong \sum\nolimits_{x,y} {\sin^{2} \left( \varPhi \right)}\). Using Eqs. (10), (12) and (17), we have

$$C \cong \hat{\varLambda }^{T} D_{\varLambda }^{1/2} P_{\varLambda } D_{Q} P_{\varLambda }^{T} D_{\varLambda }^{1/2} \hat{\varLambda } + { N}^{T} { N}$$
(18)

Note that as \(D_{Q}\) is approximately diagonal, with its diagonal elements almost equal to each other, it commutes with any matrix. Taking into account that \(P_{\varLambda }\) verifies that \(P_{\varLambda }^{T} P_{\varLambda } = P_{\varLambda } P_{\varLambda }^{T} = I\), as it is an orthogonal matrix, we can rewrite Eq. (18) as

$$C \cong \hat{\varLambda }^{T} \left( {D_{\varLambda } D_{Q} + D_{N} } \right)\hat{\varLambda }$$
(19)

where we have taken into account that \(N^{T} N \cong D_{N}\), with \(D_{N}\) a diagonal N × N matrix with all its diagonal elements approximately equal, and equal to the noise variance. Observe that in Eq. (18), we have increased the dimensions of \(D_{\varLambda } D_{Q}\) from 2 × 2 to N × N adding zeros. Therefore, \(D_{\varLambda } D_{Q}\) only has values different than zero in the first and second diagonal elements. Additionally, we have also increased the dimensions of \(\hat{\varLambda }\) from \(2 \times N\) to N × N adding conveniently orthonormal rows with respect to the first and second row of \(\hat{\varLambda }\). Taking into account that \(C = \tilde{I}^{T} \tilde{I}\), and using Eqs. (10) and (12), we obtain the relationship between the background subtracted intensity matrix, \(\tilde{I}\), and the quadrature components in presence of noise as

$$\tilde{I} \cong Q\left( {P_{\varLambda }^{T} D_{\varLambda }^{1/2} \hat{\varLambda }} \right) + N = \left( {QP_{\varLambda }^{T} } \right)D_{\varLambda }^{1/2} \hat{\varLambda } + N$$
(20)

PCA is a technique from statistics for reducing an image or dataset that transforms a number of possibly correlated images into the smallest number of uncorrelated images called the principal components. PCA is based on the search of orthogonal directions explaining as much variability of the data as possible. The first step of the PCA demodulation algorithm [46] consists of obtaining the covariance matrix C of the background subtracted dataset, as \(C = \tilde{I}^{T} \tilde{I}\). Note that because C is real and symmetric, it is always possible to diagonalize this matrix as

$$C = A^{T} DA$$
(21)

where \(A\) and D are orthogonal and diagonal matrices, respectively, both with size N × N (it is assumed that the eigenvalues in D are sorted in descendent order). Observe that this factorization is unique if all eigenvalues are distinct. If the multiplicity of any of the eigenvalues is larger than one, then the factorization is unique up to a permutation of the corresponding columns of A. The principal components of the interferogram set, which correspond to images containing the highest variance in the data, are given by

$$\begin{aligned} &Y = \tilde{I}A^{T} \hfill \\& \tilde{I} = YA \hfill \\ \end{aligned}$$
(22)

where Y is a matrix of size N x N y  × N and its column vectors (principal components) \(y_{n}\) are orthogonal and uncorrelated. The principal component analysis demodulation approach [46] reconstructs the modulating phase from the first and second principal components (\(y_{1}\) and \(y_{2}\)), that corresponds to the highest eigenvalues, as

$$\varPhi = \arctan \left( {{{I_{s} } \mathord{\left/ {\vphantom {{I_{s} } {I_{c} }}} \right. \kern-0pt} {I_{c} }}} \right) = \pm \arctan \left( {{{y_{2} } \mathord{\left/ {\vphantom {{y_{2} } {y_{1} }}} \right. \kern-0pt} {y_{1} }}} \right)$$
(23)

Note that the PCA demodulation algorithm also obtains the diagonal D matrix that contains the different eigenvalues. Taking into account that the matrix factorizations shown in Eqs. (19) and (21) are unique up to possible interchanges in some columns of A and \(\hat{\varLambda }\), we can state that A and D correspond to \(\hat{\varLambda }^{T}\) and \(D_{\varLambda } D_{Q} + D_{N}\) respectively, up to possible interchanges in some columns. Additionally, from Eqs. (20) and (22), we have that the first two principal components are related to the actual quadrature components as

$$\begin{aligned} &y_{i} = \tilde{I}\hat{\varLambda }^{T} = \left( {\left( {QP_{\varLambda }^{T} } \right)D_{\varLambda }^{1/2} + N\hat{\varLambda }^{T} } \right)_{i} ,\quad i = 1,2 \hfill \\& y_{i} = \left( {N\hat{\varLambda }^{T} } \right)_{i} ,\quad i \in \left[ {3,N} \right] \hfill \\ \end{aligned}$$
(24)

where \(\left( \cdot \right)_{i}\) refers to the ith column. Observe that \(P_{\varLambda }^{T}\) is in general an unknown 2 × 2 orthogonal matrix, if we have no information about phase-shifts and its only effect is an unknown phase-shift, or piston term, of θ rad in the obtained modulating phase, which is irrelevant. We can mathematically show this point performing the following transformation to Q

$$\hat{Q} = QP_{\varLambda }^{T}$$
(25)

In the following, we make use of the fact that \(P_{\varLambda }^{T}\) is a 2 × 2 orthogonal matrix and, consequently, it can be written as \(P_{\varLambda }^{T} = \left( {\begin{array}{*{20}c} {\cos \theta } & {\sin \theta } \\ { - \sin \theta } & {\cos \theta } \\ \end{array} } \right)\). After this transformation, Eq. (24) is rewritten as

$$y_{i} = \tilde{I}\hat{\varLambda }^{T} = \left( {\hat{Q}D_{\varLambda }^{1/2} + N\hat{\varLambda }^{T} } \right)_{i} ,\quad i = 1,2$$
(26)

The first and second columns of Q, that corresponds to \(q_{1} = b\cos \left( \varPhi \right)\) and \(q_{2} = b\sin \left( \varPhi \right)\), after the rotation corresponds to \(\hat{q}_{1} = \cos \left( \theta \right)q_{1} + \sin \left( \theta \right)q_{2} = b\cos \left( {\varPhi + \theta } \right)\) and \(\hat{q}_{2} = \cos \left( \theta \right)q_{1} - \sin \left( \theta \right)q_{2} = b\sin \left( {\varPhi + \theta } \right)\). Therefore, the only effect of \(P_{\varLambda }^{T}\) is an unknown phase-shift of θ rad in the modulating phase Φ and, without loss of generality, we can assume that θ = 0 rad and \(P_{\varLambda }^{T}\) corresponds to the 2 × 2 identity matrix. If we suppose that the noise is smaller than the signal, we can write from Eqs. (23) and (24)

$$\varPhi = \arctan \left( {\frac{{q_{1} \lambda_{ + }^{1/2} + \left( {N\hat{\varLambda }^{T} } \right)_{1} }}{{q_{2} \lambda_{ - }^{1/2} + \left( {N\hat{\varLambda }^{T} } \right)_{2} }}} \right) \cong \arctan \left( {\alpha \frac{{q_{1} }}{{q_{2} }}} \right)$$
(27)

with \(\alpha = \left( {{{\lambda_{ + } } \mathord{\left/ {\vphantom {{\lambda_{ + } } {\lambda_{ - } }}} \right. \kern-0pt} {\lambda_{ - } }}} \right)^{1/2}\). Observe from Eq. (27) that we will obtain only an accurate phase reconstruction, using the PCA demodulation algorithm, with at least one fringe in the interferograms, if α ≅ 1 and the noise term is smaller than the signal term. This provides us with a method to quantify the obtained error by the PCA demodulation method. Using Eqs. (19) and (21), we have that the eigenvalues computed by the PCA demodulation method corresponds to \(D = D_{\varLambda } D_{Q} + D_{N}\). Taking into account that \(D_{N}\) is approximately a diagonal N × N matrix, with all its diagonal elements equal to σ 2, we have that the eigenvalues given by the PCA demodulation method have the following mathematical expression,

$$\begin{aligned}& D_{11} = \kappa \lambda_{ + } + \sigma^{2} \hfill \\& D_{22} = \kappa \lambda_{ - } + \sigma^{2} \hfill \\& D_{ii} = \sigma^{2} \quad i \in \left[ {3,n} \right] \hfill \\ \end{aligned}$$
(28)

Using Eq. (28), we can define two-phase accuracy indicators. One of these indicators \(\left( {\gamma_{ps} } \right)\) takes into account possible phase errors because the phase-shifts are not well distributed in the [0, 2π] (rad) range and then, i.e., we do not have that α ≅ 1 in Eq. (27). The other indicator (γ n ) takes into account phase reconstruction errors because the presence of noise in the interferograms. These indicators are obtained from the first three eigenvalues by

$$\begin{aligned}& \gamma_{ps} \, = \, \left( {\frac{{\left( {{{D_{11} } \mathord{\left/ {\vphantom {{D_{11} } {D_{22} }}} \right. \kern-0pt} {D_{22} }}} \right) - 1}}{10}} \right) \hfill \\& \gamma_{n} \, = \, \left( {\frac{{D_{33} }}{{D_{11} + D_{22} - 2D_{33} }}} \right) \hfill \\ \end{aligned}$$
(29)

Note that in Eq. (29), we have defined γ ps  = 0 if \(D_{11} = D_{22}\). Finally, we can combine both indicators in order to define a unique phase error indicator as

$$\begin{aligned} &\gamma \, = \, \sqrt {I_{ps}^{2} + I_{n}^{2} } \\& \gamma \, = \, \sqrt {\left( {\frac{{\left( {{{D_{11} } \mathord{\left/ {\vphantom {{D_{11} } {D_{22} }}} \right. \kern-0pt} {D_{22} }}} \right) - 1}}{10}} \right)^{2} + \left( {\frac{{D_{33} }}{{D_{11} + D_{22} - 2D_{33} }}} \right)^{2} } \\ \end{aligned}$$
(30)

This phase error indicator can be used to define a phase goodness criterion for the PCA demodulation algorithm. For instance, we may establish that a retrieved phase is reliable if γ is smaller than a certain threshold. We have seen heuristically that a good criterion to establish if a retrieved phase is reliable consists in verifying whether γ is smaller than 10 %.

3 Numerical analysis

In order to verify our mathematical analysis, we have performed some simulations. In the first experiment, we use an interferogram set composed by N = 25 fringe patterns with equidistant phase-shifts. The phase-shift of the nth interferogram corresponds to δ n  = 2π × (n/N) with n \(\in\) [0, 24]. The interferograms have a size of 800 × 800 px and are noiseless. The modulating phase, background and modulation signals are Gaussian shaped, and their mathematical expressions correspond to

$$\begin{aligned}& a( {x,y} ) = 0.5 + 0.3\exp ( { - 5{{( {( {x - 10} )^{2} + ( {y - 15} )^{2} } )} \mathord{/ {\vphantom {{( {( {x - 10} )^{2} + ( {y - 15} )^{2} } )} {10^{5} }}} \kern-0pt} {10^{5} }}} ) \hfill \\& b( {x,y} ) = \exp ( { - {{( {x^{2} + y^{2} } )} \mathord{/ {\vphantom {{( {x^{2} + y^{2} } )} {10^{5} }}} \kern-0pt} {10^{5} }}} ) \hfill \\& \varPhi ( {x,y} ) = 80\pi \exp ( { - {{( {x^{2} + y^{2} } )} \mathord{/ {\vphantom {{( {x^{2} + y^{2} } )} {10^{5} }}} \kern-0pt} {10^{5} }}} ) \hfill \\ \end{aligned}$$
(31)

where (x, y) corresponds to pixel coordinates and the origin of coordinates is placed in the image center. The first two interferograms of this dataset are shown in Fig. 1. In order to verify the presented mathematical analysis, the phase error indicators and the phase goodness criterion presented above, we have obtained the modulating phase using the PCA demodulating approach and using different number of interferograms belonging to the dataset introduced above. First, we compute the modulating phase using the first ten phase-shifted interferograms. Next, we obtain the phase using the first eleven patterns and so on until we use the N phase-shifted interferograms. In every case, we obtain the accuracy of the reconstructed phase computing the root-mean-square (rms) error between the computed phase and the reference theoretical phase given in Eq. (27). Additionally, we also calculate for each case \(\gamma_{ps} \,\), \(\gamma_{n} \,\) and γ phase error indicators. Observe that if we compute the phase using the N = 25 available fringe patterns, it is verified that α = 1 in Eq. (27) as \(\lambda_{ + } = \lambda_{ - }\) and \(\left\| {\alpha_{1} } \right\|^{2} = \left\| {\alpha_{2} } \right\|^{2}\), \(\left\langle {\alpha_{1} ,\alpha_{2} } \right\rangle\) = 0, in Eq. (11). In this case, the phase-shifts are exactly equally distributed in the [0, 2π] (rad) range. However, if we use fewer patterns, it is not verified that α = 1 and it will appear a phase error. This error must be larger as fewer patterns are used. Additionally, observe that in this first experiment, because the interferograms are noiseless, the only source of phase error comes because phase-shifts are not well distributed in the [0, 2π] (rad) range and then, α ≠ 1 in Eq. (27). In Fig. 2(a), we plot the obtained phase error indicators with respect to the accuracy of the reconstructed phases, when different number of interferograms are used. As can be seen from Fig. 2(a), \(\gamma_{n} \,\) is approximately zero in every case, as the interferograms used are noiseless. On the other hand, \(\gamma_{ps} \,\) is highly correlated with the rms of the obtained modulating phase. Observe that the curve that relates \(\gamma_{ps} \,\) with the rms values is nonlinear because the nonlinear nature of Eq. (28). Additionally, in Fig. 2b, we show a plot between the obtained phase error indicators and the number of interferograms used to reconstruct the phase. As can be seen from Fig. 2b, both magnitudes are related by a smooth mathematical expression in this case. In Fig. 3, we show the theoretical reference wrapped phase and the obtained wrapped phases, when we use the first ten, nineteen and twenty-five phase-shifted interferograms. Note that in Fig. 3, we present a zoomed version of the wrapped phases to show clearly phase details. From Fig. 3b, we see that the obtained wrapped phase, when the first ten interferograms are used, clearly presents phase errors. In this case, the phase error indicator γ is equals to 80 % and the rms corresponds to 0.46 rad. Additionally, we can see that the recovered wrapped phase, when we use the twenty-five phase-shifted interferograms (Fig. 3d), is very similar to the reference phase (Fig. 3a). In this case, γ is equal to 0.08 % and the rms corresponds to 0.0034 rad. Finally, when we use nineteen interferograms, the obtained phase presents some errors but it is still reliable. Note that in this case, γ is approximately equal to 9 % and the rms is of 0.19 rad. The obtained processing times are 0.32, 0.93 rad and 1.4 s, when are used ten, nineteen and twenty-five phase-shifted interferograms, respectively, with a 2.67 GHz laptop and using MATLAB. Regarding this example, we propose that a phase retrieval is considered as acceptable if its γ index is below 10 %.

Fig. 1
figure 1

First two interferograms used in the first simulation

Fig. 2
figure 2

Obtained phase error indicators with respect to the accuracy of the reconstructed phases (a) and the number of interferograms used (b) in the first simulation

Fig. 3
figure 3

Zoomed versions of the reference wrapped phase (a) and obtained wrapped phases when are used the first thirteen (b), nineteen (c) and twenty-five (d) phase-shifted interferograms in radians

In the second experiment, we used ten phase-shifted interferograms equally distributed in the [0, 2π] (rad) range but with different levels of noise. The modulating phase, background and contrast signals are given in Eq. (31), and the noise is additive and Gaussian with zero mean. We performed eleven phase reconstructions using the PCA demodulation approach and adding different levels of noise to the ten fringe patterns. The patterns have a noise-to-signal ratio (NSR) that goes from 0 to 100 % and is defined as

$${\text{NSR}} = \frac{{P_{\text{n}} }}{{P_{\text{s}} }}$$
(32)

where P n and P s are the noise and signal power, respectively. Note that we have used this definition instead the typical signal-to-noise ratio (SNR) to avoid the instabilities of the SNR for low error levels.

In Fig. 4a, we show a plot of the obtained phase error indicators with respect to the accuracy of the reconstructed phases. As can be seen from Fig. 4a, \(\gamma_{ps} \,\) is approximately zero in every case, as the interferograms are equally distributed in the [0, 2π] range. On the other hand, \(\gamma_{n} \,\) is highly correlated with respect to the rms of the obtained modulating phase. In Fig. 4b, we show a plot of the obtained phase errors indicators with respect to the NSR of the phase-shifted interferograms. As can be seen from Fig. 4b, in this case, there is a linear relationship between both magnitudes. Finally, in Fig. 5, we show the theoretical reference phase and the obtained unwrapped phases, for NSRs equal to 1, 10 and 81 %. Note that these values correspond to SNRs of 100, 10 and 1.23 %. The wrapped phases obtained by the PCA demodulation algorithm are unwrapped using the method presented in [15, 16] that corresponds to a fast unwrapping two-dimensional algorithm based on a linear recursive filter. This method is robust to noise thanks to its smoothing capabilities. As can be seen from Fig. 5b, the retrieved phase for NSR equals to 1 % is very similar to the reference phase. Note that in this case, the rms and the phase error indicator correspond to 0.09 (rad) and 0.8 %, respectively. When the NSR corresponds 81 %, the reconstructed phase shown in Fig. 5d is highly affected by artifacts and is not reliable. In this case, the rms and the phase error indicator correspond to 0.9 (rad) and 66 %. Finally, in Fig. 5c, we show the retrieved phase for SNR equals to 10 %. The obtained rms and phase error indicator (γ) correspond to 0.27 (rad) and 7.3 %, respectively. Observe that this reconstructed phase is inside the limit of our proposed phase goodness criterion and as can be seen from Fig. 5c, the unwrapped phase is very similar to the reference one. The obtained processing times to compute the results shown in Fig. 5b–d are 0.35, 0.38 and 0.38 s.

Fig. 4
figure 4

Obtained phase error indicators with respect to the accuracy of the reconstructed phases (a) and the signal-to-noise ratio of the interferograms used (b) in the second simulation

Fig. 5
figure 5

Reference unwrapped phase (a) and obtained unwrapped phases when are used interferograms with noise-to-signal ratios of 9 % (b), 36 % (c) and 81 % (d) in radians

4 Experimental results

We have also checked our proposed phase error indicators with real interferograms. We have obtained a reference phase map from a large interferogram set composed by nineteen interferograms with phase-shifts randomly distributed in the [0, 2π] range and using the PCA method [46]. In Fig. 6, we show the first three interferograms of this dataset. The images have size of 600 × 800 px. In order to study the performance of the proposed phase error indicators, we have obtained the modulating phases when different numbers of phase-shifting interferograms are processed. This number goes from five to fifteen. For each phase reconstruction, we calculate the different phase error indicators and the rms between the obtained and reference phases. In Fig. 7, we show the results obtained. In Fig. 7a, we plot the obtained phase error indicators with respect to the accuracy of the reconstructed phases, and in Fig. 7b, c, we show the obtained phase errors indicators and rms with respect to the number of phase-shifted interferograms used. As can be seen from Fig. 7a, the recovered phases are slightly affected by noise and the most significant source of phase error is due to the use of a set of interferograms with phase-shifts not well distributed in the [0, 2π] range. Finally, in Fig. 8, we show the reference phase (a), and the obtained phases when we use three (b), ten (c) and seventeen (d) interferograms. The phase error indicators and rms values obtained in these cases are 105, 13, 4 % and 0.60, 0.14 and 0.04 rad, respectively. Observe that the phase map shown in Fig. 8c presents clear phase errors and γ index is larger than 10 %. In this case, the obtained processing times to compute the results shown in Fig. 8b–d are 0.10, 0.15 and 0.29 s, respectively. As can be seen from the results presented above, the proposed accuracy phase indicators, computed from the first three obtained eigenvalues of the principal component analysis algorithm, are very suitable to determine a blind estimate of phase goodness, without the need of using any ground truth phase information, and perform further actions if the retrieved phase accuracy is not acceptable.

Fig. 6
figure 6

First three real interferograms used in the Sect. 4

Fig. 7
figure 7

Obtained phase error indicators with respect to the accuracy of the reconstructed phases (a) and the number of interferograms used (b). In c, it is presented the relation between the rms obtained and the number of interferograms processed

Fig. 8
figure 8

Reference wrapped phase (a) and obtained wrapped phases when are used the first three (b), ten (c) and seventeen (d) phase-shifted interferograms in radians

5 Conclusions

In this work, we have shown a thorough mathematical error analysis of the principal component analysis demodulation algorithm. In this analysis, we show that the possible phase errors are caused because the interferograms have phase-shifts not uniformly distributed in the [0, 2π] range and/or the presence of noise in the fringe patterns. Additionally, we present suitable phase accuracy indicators, computed from the first three obtained eigenvalues of the principal component analysis demodulation algorithm. These indicators can be used in the measuring process to determine a blind indicator of the phase accuracy, without the need of using any ground truth phase information. If the retrieved accuracy is not acceptable, we can perform further actions as obtaining additional interferograms or repeating the experiment. Additionally, we present simulated and experimental results that support our mathematical analysis and conclusions. A complete MATLAB software package where can be reproduced any result and figure shown in this work is provided in (http://goo.gl/fy5EC).