## 3 Target Image Optimization Processing
### Improved RANSAC Algorithm  
(1) Traditional algorithm  
Figure 2: Image pre-processing. First, a matrix H of three rows and three columns is created, so that the matrix is equal to one making the matrix normalized, and since there are eight unknown parameters, at least four sets of matching point pairs are needed to correspond to the location information. \[ \begin{bmatrix}x_{2}\\ y_{2}\\ z_{2}\end{bmatrix} = \begin{bmatrix}H_{11}&H_{12}&H_{13}\\ H_{21}&H_{22}&H_{23}\\ H_{31}&H_{32}&H_{33}\end{bmatrix}\begin{bmatrix}x_{1}\\ y_{1}\\ z_{1}\end{bmatrix}  \tag{5}\]  
Namely,  
\[X_{2}=H\cdot X_{1} \tag{6}\]  
where points \(I_{1}\) and \(I_{2}\) correspond to the coordinates \((x_{1},y_{1})\) and \((x_{2},y_{2})\), respectively, while the size of \(z_{1}\), which is introduced into the chi-square equation, is 1. \[x_{2}=\left[\frac{H_{11}\cdot x_{1}+H_{12}\cdot y_{1}+H_{13}\cdot z_{1}}{H_{31 }\cdot x_{1}+H_{32}\cdot y_{1}+H_{33}\cdot z_{1}}\right]=\left[\frac{h_{11} \cdot x_{1}+h_{12}\cdot y_{1}+h_{13}}{H_{31}\cdot x_{1}+H_{32}\cdot y_{1}+1}\right] \tag{7}\]  
\[y_{2}=\left[\frac{H_{21}\cdot x_{1}+H_{22}\cdot y_{1}+H_{23}\cdot z_{1}}{H_{31 }\cdot x_{1}+H_{32}\cdot y_{1}+H_{33}\cdot z_{1}}\right]=\left[\frac{h_{21} \cdot x_{1}+h_{22}\cdot y_{1}+h_{23}}{H_{31}\cdot x_{1}+H_{32}\cdot y_{1}+1}\right] \tag{8}\]  
The equation containing four matched pairs of points is then solved for  
\[A\cdot u=\
u \tag{9}\]  
Matrix of unknowns:  
\[A= \begin{bmatrix}x_{1}&y_{1}&1&0&0&0&-x_{1}x_{2}^{\prime}&-z_{1}^{\prime}y_{1 }\\ 0&0&0&x_{2}&y_{2}&0&-x_{1}y_{2}^{\prime}&-y_{1}y_{2}^{\prime}\end{bmatrix}  \tag{10}\]  
Vector of unknowns:  
\[u= \begin{bmatrix}h_{11}&h_{12}&h_{13}&h_{21}&h_{22}&h_{23}&h_{31}&h_{32}&h_{3 3}\end{bmatrix} ^{T} \tag{11}\]  
Value vectors:  
\[\
u= \begin{bmatrix}x_{2}^{\prime},y_{2}^{\prime}\end{bmatrix} ^{T} \tag{12}\]  
The traditional RANSAC algorithm [19] will first extract part of the matching points from the first matching result and then construct a primary model to calculate the remaining matching points, and it will classify the resulting point pairs into two types: matching original model and non-matching original model. The point pairs matching the original model are also called valid data, and the other types of point pairs are invalid data. Then, some matching pairs are extracted from the valid data, and the optimal model is obtained by continuing to distinguish good data from bad data in the above way and iterating continuously. Finally, the data model in the optimal model is solved, and the point pairs that do not meet the matching conditions are excluded to achieve data optimization. (2) Improved mis-matching algorithm  
Before the improvement in the RANSAC algorithm, when matching feature points, there is a situation that a feature point is used multiple times to correspond to other points. In this paper, after optimizing the RANSAC algorithm, in order to improve the purification effect and reduce the situation that one point is used more than one time, we optimize the RANSAC algorithm by setting the queue value and solving the single-response matrix. A flowchart of the algorithm is shown in Figure 3.  
Assume that the number of samples in the data is K, \(P\) is the model probability (confidence probability) of the local points at the iteration, \(n\) is the minimum value to successfully solve the formula, \(N_{\text{i}}\) is the local points, \(N_{\text{t}}\) is the external points and \(\omega\) is the ratio of the local points to the total number of points in the data, i.e.,  
\[\omega=\frac{N_{\text{i}}}{N_{\text{i}}+N_{\text{t}}} \tag{13}\]  
The probability that there will always be an outlier during the iteration is \(\left(1-P^{k}\right)\); the probability that at least one of the \(n\) points is an outlier is [19]: \(\left(1-\omega^{n}\right)\). Combining the two outlier probabilities yields the following formula  
\[P=1-\left(1-\omega^{n}\right)^{k} \tag{14}\]  
when \(k\rightarrow\infty\), \(P\to 1\) general \(P=0.995\).