# Geometric Parameter Self-Calibration Based on Projection Feature Matching for X-Ray Nanotomography
## 2 Materials and Methods
### Geometric Parameter Calibration Process
#### 2.2.2 Projection Image Processing  
The SURF algorithm is a fast and robust image recognition and description algorithm that uses Hessian matrices to detect feature points and accelerate operations using integral graphs [23]. The SURF algorithm extracts feature points in the projected image. The feature points are then matched between the feature-point pairs by the Fast Library for Approximate Nearest Neighbors (FLANN) algorithm [24]. Due to noise and brightness, some feature-point pairs of projected images are mismatched. A feature-point screening  
Figure 2: The parameter calibration flow of the proposed method. algorithm for projected images under a circular scanning trajectory is designed to establish a more reliable matching point pair. This paper employs the characteristics of triangles composed of feature points in two projection images with a difference of 180\({}^{\circ}\) to achieve feature-point screening. The schematic diagram is shown in Figure 3.  
Suppose that the set of feature points composed of two images with a difference of 180\({}^{\circ}\) is, respectively, \(S_{main}=\big{\{}S_{main}^{i}\big{\}}(i=1,2...k)\) and \(S_{mirror}=\big{\{}S_{mirror}^{i}\big{\}}(i=1,2...k)\). Since the projected images of a CT imaging system with 180\({}^{\circ}\) difference under circular scanning trajectory have mirroring characteristics, when we place two images in the same coordinate system, ideally the midpoints of correctly matched feature-point pairs on the two projected images are located on the rotation axis. Thus, we can select two pairs of feature points \(\big{(}S_{main}^{i},S_{main}^{i}\big{)}\) and \(\big{(}S_{mirror}^{i},S_{mirror}^{i}\big{)}\) from the two feature point sets. These two pairs of feature points and the midpoint \(S_{mid}^{i}\big{(}\big{(}x_{main}^{i}+x_{mirror}^{i}\big{)}/2,\big{(}y_{main} ^{i}+y_{mirror}^{i}\big{)}/2\big{)}\) of one of the pairs of \(\big{(}S_{main}^{i},S_{mirror}^{i}\big{)}\) then form a feature triangle. \((x,y)\) are the feature point coordinates. The two triangles are equal when the feature points match correctly. Based on these points, it is possible to calculate the distance between any two points as follows:  
\[D(S_{main}^{j},S_{main}^{i})=\left|\left|S_{matrix}^{j},S_{main}^{i}\right| \right|_{2}=\sqrt{\big{(}x_{main}^{i}-x_{main}^{j}\big{)}^{2}+\big{(}y_{main} ^{i}-y_{main}^{j}\big{)}^{2}}. \tag{1}\]  
In the same way, \(D\big{(}S_{main}^{j},S_{mid}^{i}\big{)}\), \(D\big{(}S_{mirror}^{j},S_{mirror}^{i}\big{)}\), \(D\big{(}S_{mirror}^{j},S_{mid}^{i}\big{)}\), \(D\big{(}S_{main}^{i},S_{mid}^{i}\big{)}\), \(D\big{(}S_{mirror}^{i},S_{mid}^{i}\big{)}\) can be calculated. From the full equality of the feature-point triangle, it can be concluded:  
\[\frac{D(S_{main}^{j},S_{main}^{i})}{D(S_{mirror}^{j},S_{mirror}^{i})}=\frac{D( S_{main}^{j},S_{mid}^{i})}{D(S_{mirror}^{j},S_{mid}^{i})}=\frac{D\big{(}S_{ main}^{i},S_{mid}^{i}\big{)}}{D\big{(}S_{mirror}^{i},S_{mid}^{i}\big{)}}=1. \tag{2}\]  
However, in practical applications, it is difficult to strictly meet this equation due to the influence of noise between projections with a difference of 180\({}^{\circ}\). Therefore, using the difference and setting thresholds to filter the feature pairs, the formula is converted as follows:  
\[F=\left|\frac{D(S_{main}^{j},S_{main}^{i})}{D(S_{mirror}^{j},S_{mirror}^{i})}-1 \right|+\left|\frac{D(S_{main}^{j},S_{mid}^{i})}{D(S_{mirror}^{j},S_{mid}^{i}) }-1\right|, \tag{3}\]  
Figure 3: Schematic diagram of feature-point screening. Set the \(F\) threshold \(\lambda\) and build the criterion function \(p_{i,j}\) such that:  
\[p_{i,j}=\left\{ \begin{array}{ll}1,F\leq\lambda&\\ 0,F>\lambda&i=1,2,\ldots,N.\end{array} \right. \tag{4}\]  
And according to the criterion function construct voting function \(T_{i}=\sum\limits_{j=1}^{N}p_{i,j}\), set the voting ratio \(t\) so that after filtering:  
\[S_{mid}=\Big{\{}S_{mid}^{i}|T_{i}\geq tN,i=1,2,\ldots,N\Big{\}}, \tag{5}\]  
where \(S_{mid}\) indicates the midpoint of all feature-point pairs after filtering.