## 2 Image Alignment
### Matching Feature Points
The nearest neighbor (NN) algorithm is used to calculate the Euclidean distance \(e\) between DAISY descriptors to match the key points of an image. Let A be any key point of the source image, B1 and B2 denote the two points on the target image that have the minimum Euclidean distance from the DAISY descriptor of point A, and \(e(\text{A},\text{B}_{2})>e(\text{A},\text{B}_{1})\). The keypoint matching process for infrared and visible images is shown in Figure 2. Let A and B denote the key point sets of the source and target images, respectively, with set size \(N\). A\({}_{i}\in\) A, B\({}_{i}\in\) B, and there exists a unique matching A\({}_{i}\)\(\rightarrow\)B\({}_{i}\). Inevitably, there will be wrong matching pairs due to image quality or algorithm performance limitations. Assume that each position of the target is located in the same plane and the camera distortion is small. Then, when the shooting viewpoint changes, the relative position relationship between each feature point should be approximately the same, and the relative position relationship between the feature point corresponding to the wrong matching pair and other points is obviously different. To eliminate false matches, a filtering process is designed based on the random sampling consistency (RANSAC) algorithm. First, calculate the distances between A\({}_{i}\) and B\({}_{i}\) and the other elements within the set, A\({}_{j}\) and B\({}_{j}\) (\(j=1\)... \(N\), \(j\
eq i\)), within the image, where the distance between A\({}_{i}\) and A\({}_{j}\) is denoted as \(a_{ij}\), and the distance between B\({}_{i}\) and B\({}_{j}\) is denoted as \(b_{ij}\). If both A\({}_{i}\)\(\rightarrow\)B\({}_{i}\) and A\({}_{j}\)\(\rightarrow\)B\({}_{j}\) are matchedcorrectly, then \(K_{ij}=b_{ij}/a_{ij}\) is an approximately fixed value. Otherwise, \(K_{ij}\) value differs from that of the others. Then, the set of points \((a_{ij},\,b_{ij})\) is input into the RANSAC model to find outliers that do not fit the model. For specific information on the algorithm, refer to reference [31]. Finally, count the number of occurrences of all associated points \(\text{A}_{k}\), i.e., the transverse coordinates \(a_{\tau_{k}}\) or \(a_{k^{*}}\) of the outer points in the set of outer points, and if the occurrence of subscript \(k\) is greater than \(N/2\), then \(\text{A}_{k}\)\(\rightarrow\)\(\text{B}_{k}\) is determined to be a false match (Algorithm 1). ```
1:Initial\(ind=0\); \(N=\text{length(A)}\); \(a=\{\}\); \(b=\{\}\); \(c=\{\}\); // Initialize arrays \(a\), \(b\) and \(c\). 2:for(\(the=1\) to \(N\)) do
3:for(\(j=1\) to \(N\)) do
4:if(\(the<j\)) then
5:break;
6:endif
7:\(a(ind)=\text{sqrt((A}_{i};x-\text{A}_{j};x)^{2}+(\text{A}_{i};y-\text{A}_{j} ;y)^{2})\);
8:\(b(ind)=\text{sqrt((B}_{i};x-\text{B}_{j};x)^{2}+(\text{B}_{i};y-\text{B}_{j} ;y)^{2})\);
9:\(c(ind,\,1)=the\); \(c(ind,\,2)=j\); // Record the index of the key points
10:\(ind++\);
11:endfor
12:endfor
13:\(f=\text{RANSAC}(a,\,b)//\text{Output the set of indices of the outlier }f\). 14:\(sk=\text{zeros(N)}\); \(Nf=\text{length(}f\text{)}\);
15:for(\(the=1\) to \(Nf\)) do//Count the indices of all outliers
16:\(ind=f()\);
17:\(sk(c(ind,\,1))++\); \(sk(c(ind,\,2))++\);
18:endfor
19:for(\(the=1\) to \(Nk\)) do
20:if(\(sk(\ell)>N/2\)) then
21:\(\text{K}\).append(\()//Put index \(the\) into the array \(K\). 22:endif
23:endfor
24:return\(K\);
```  
**Algorithm 1** Key point matching  
Figure 2: Schematic of keypoint matching results, calculating the distance of each keypoint from other keypoints.