# Measurement of High Numerical Aperture Cylindrical Surface with Iterative Stitching Algorithm
## 2 Principles
### Stitching Algorithm for the Cylindrical Lens  
Suppose that the entire cylindrical surface can be totally covered by \(N\) sub-apertures forming the \(N-1\) overlapping regions as shown in Figure 2a. Due to the non-ideality of the rotating stage and the position errors, each measurement after a rotation requires preliminary tuning for minimization of the fringes in the interferogram. This, in turn, forced us to describe the sample position during measurement with a correction based on the errors \(\Delta z_{i}\), \(\Delta y_{i}\), \(\Delta\gamma_{i}\), and \(\Delta\beta_{i}\). Let the whole interferogram of the lens consist of \(M\times K\) pixels. The results of the measurement of each sub-aperture can be represented by the matrix \(M\times K\), which includes the measured sub-aperture and the zero values. In particular, the data for the first sub-aperture characterized by \(\varphi_{1}\) (Figure 2) are:  
\[\Phi_{1}=\left[ \begin{array}{cccccccccccc}\varphi_{1_{1,1}}&\varphi_{1_{1,2 }}&\cdots&\varphi_{1_{1,L}}&0&\cdots&0&0&0&\cdots&0&0&0\\ \varphi_{1_{2,1}}&\varphi_{1_{2,2}}&\cdots&\varphi_{1_{2,L}}&0&\cdots&0&0&0& \cdots&0&0&0\\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots& \cdots\\ \varphi_{1_{M,1}}&\varphi_{1_{M,2}}&\cdots&\varphi_{1_{M,L}}&0&\cdots&0&0& \cdots&0&0&0\end{array} \right]\]  
whereas the matrix characterizing the second sub-aperture is:  
\[\Phi_{2}=\left[\begin{array}{cccccccccccc}0&\cdots&0&\varphi_{2_{1,1}}& \varphi_{2_{1,2}}&\cdots&\varphi_{2_{1,L}}&0&0&\cdots&0&0&0\\ 0&\cdots&0&\varphi_{2_{2,1}}&\varphi_{2_{2,2}}&\cdots&\varphi_{2_{2,L}}&0&0& \cdots&0&0&0\\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots& \cdots\\ 0&\cdots&0&\varphi_{2_{M,1}}&\varphi_{2_{M,2}}&\cdots&\varphi_{Within an overlapping region, the relationship between the relative position errors and the two sub-apertures can be expressed as:  
\[\Delta\varphi_{stitched}(X,\Theta)=\varphi_{i_{a,b}}-\varphi_{i+1_{a,b}}=\Delta z \cos\Theta+\Delta y\sin\Theta-\Delta\gamma X\sin\Theta+\Delta\beta X\cos\Theta \tag{2}\]  
where \(\Delta z=\Delta z_{i}-\Delta z_{i+1}\), \(\Delta y=\Delta y_{i}-\Delta y_{i+1}\), etc. ; \(a=\frac{X-X_{min}}{X_{max}-X_{min}}(M-1)+1\); and \(b=\frac{\Theta-\Theta_{min}}{\Theta_{max}-\Theta_{min}}(K-1)+1\). Here, the sub-index min. and max. correspond to the minimum and maximum values, respectively. In order to simplify the calculation, it is preferable to transform \(\Phi_{i}\) into column vectors in advance. \(i+1\) should be in the range of 2 to \(N\). To produce the full aperture map of the tested cylindrical surface, the sum of the squared differences for all overlapping regions should be minimized simultaneously [8] in the following manner:  
\[ \begin{array}{c}\sum\limits_{i=1}^{N-1}\sum\limits_{a,b}\Bigl{\{}\Bigl{[} \varphi_{i_{a,b}}+\Delta z_{i}\cos\Theta+\Delta y_{i}\sin\Theta-\Delta\gamma_ {i}X\sin\Theta+\Delta\beta_{i}X\cos\Theta\Bigr{]}\\ \hskip 142.26378 pt-\varphi_{i+1_{a,b}}+\Delta z_{i+1}\cos\Theta+\Delta y_{i+1} \sin\Theta-\Delta\gamma_{i+1}X\sin\Theta\\ \hskip 142.26378 pt+\Delta\beta_{i+1}X\cos\Theta\Bigr{]}^{2}\to min\end{array}  \tag{3}\]  
where the deviation of any two adjusted sub-apertures in the overlapping region should be small enough. Equation (3) can be transformed into a linear equation system. The misalignment error coefficients of the \(i\)th sub-aperture, which were mentioned in Section 2.1, can be formed as a 4 \(\times\) 1 vector \(R_{i}\):  
\[R_{i}=[\Delta z_{i},\Delta y_{i},\Delta\gamma_{i},\Delta\beta_{i}]^{T} \tag{4}\]  
where the superscript \(T\) denotes the transpose operation. For the \(i\)th sub-aperture measurements, we construct a 4 \(\times\) 1 vector \(P_{i}\):  
\[P_{i}=\Bigl{[}f_{i,i-1}{}^{T}\Bigl{(}\varphi_{i_{a,b}}-\varphi_{i-1_{a,b}} \Bigr{)}\Bigr{]}+\Bigl{[}f_{i,i+1}{}^{T}\Bigl{(}\varphi_{i_{a,b}}-\varphi_{i+ 1_{a,b}}\Bigr{)}\Bigr{]} \tag{5}\]  
which is associated with the overlapping regions of the sub-aperture.