## 2 Materials and Methods
### Image Registrations  
Image registration involves frame alignment in the video processing context, which is an important step. Image registration is a fundamental problem in computer vision. Feature point matching is one of the most popular and effective methods in image matching [26]. The features extracted by Scale Invariant Feature Transform (SIFT) are invariant to image scale and rotation, and provide robust matching to fine distortion and changes in illumination [27]. Key-points detection is firstly conducted, which involves detecting extreme values in scale space. The scale space of an image is defined as  
\[L(x,y,\sigma)=G(x,y,\sigma)*I(x,y) \tag{1}\]  
where \(L(x,y,\sigma)\) is the corresponding scale space, \(I(x,y)\) is the input image, \(\sigma\) is the scale factor, and * is the convolution operation in \(x\) and \(y\). \(G(x,y,\sigma)\) is a scalar function in the form of a Gaussian,  
\[G(x,y,\sigma)=\frac{1}{2\pi\sigma^{2}}e^{-(x^{2}+y^{2})/2\sigma^{2}} \tag{2}\]  
Scale space is represented by the Gauss pyramid in real implementation. The Difference-of-Gaussian (DoG) function is then used to detect stable key-point locations in scale space, which can be computed by a constant multiplicative factor \(k\). \[D(x,y,\sigma)=(G(x,y,k\sigma)-G(x,y,\sigma))*I(x,y)=L(x,y,k\sigma)-L(x,y,\sigma) \tag{3}\]  
By comparing a pixel detected by DoG to its neighbors, we can derive the key-point candidate. Accurate key-point localization is then used to reject candidate key-points that have low contrast or are poorly localized. [PERSON] developed a method that fits 3D quadratic  
Figure 1: Flowchart of the proposed method. functions to local sample points in order to determine the interpolation position of the extremum [28]. The second-order Taylor expansion of the DoG function \(D(x,y,\sigma)\) in scale space is  
\[D(\mathbf{X})=D+\tfrac{\partial D^{T}}{\partial\mathbf{X}}\mathbf{X}+\tfrac{1}{2}\mathbf{X}^{T }\tfrac{\partial^{2}D}{\partial\mathbf{X}^{2}}\mathbf{X} \tag{4}\]  
\(D\) and its derivatives can be evaluated at the sample point. \(\mathbf{X}=(x,y,\sigma)^{T}\) represents the offset relative to the interpolation center. The location of the extremum, \(\hat{\mathbf{X}}\), is calculated by taking the derivative of the above function with respect to \(\mathbf{X}\) and setting it to zero, namely,  
\[\hat{\mathbf{X}}=-\Big{(}\tfrac{\partial^{2}D}{\partial\mathbf{X}^{2}}\Big{)}^{-1} \tfrac{\partial D}{\partial\mathbf{X}} \tag{5}\]  
The function value \(D\big{(}\hat{\mathbf{X}}\big{)}\) at the extremum is  
\[D\big{(}\hat{\mathbf{X}}\big{)}=D+\tfrac{1}{2}\tfrac{\partial D^{T}}{\partial\mathbf{ X}}\hat{\mathbf{X}} \tag{6}\]  
If \(D\big{(}\hat{\mathbf{X}}\big{)}\) is too small, it will be susceptible to noise and become unstable. Hence, it can be used to reject unstable extrema with low contrast. A candidate with a value of \(D\big{(}\hat{\mathbf{X}}\big{)}\) less than 0.03 is discarded in common practice. For the key points detected in the DoG pyramid, the gradient magnitude \(m(x,y)\) and orientation \(\theta(x,y)\) are calculated using pixel differences,  
\[m(x,y)=\sqrt{\left(L(x+1,y)-L(x-1,y)\right)^{2}+\left(L(x,y+1)-L(x,y-1)\right) ^{2}} \tag{7}\]  
\[\theta(x,y)=tan^{-1}(\left(L(x,y+1)-L(x,y-1)\right)/\left(L(x+1,y)-L(x-1,y) \right)) \tag{8}\]  
K nearest neighbors (kNN) is used to match the key points detected from the image being processed and the reference image. The matching is considered successful only when the Euclidean distance between two feature points is less than a given threshold value. \(k=2\) in this paper, i.e., two best matches are returned. If the distance ratio between the first match and the second match exceeds 0.75, it is considered a good match. A homography matrix between two images can be obtained by calculating all the good matches. The homography matrix will be used to transform the processed image. In real applications, two distant images will be affected by the change of illumination and background.