## 3 Infrared and Visible Image Fusion
### Fusion Rules for High-Frequency Subbands
The pseudo-code corresponding to the implementation process of the above image fusion algorithm is as follows (Algorithm 2):```
1:\([L_{\text{IR}},H_{\text{IR}}]=\text{DTCWT}(l_{\text{IR}},J)\); \([L_{\text{VIS}},H_{\text{VIS}}]=\text{DTCWT}(l_{\text{VIS}},J)\); \([w,h]=\text{size}(L_{\text{IR}})\);
2:\(G_{\text{IR},x}=\partial l_{\text{IR},x}/\partial x\); \(G_{\text{IR},y}=\partial l_{\text{IR},y}/\partial y\); \(G_{\text{VIS},x}=\partial l_{\text{VIS},x}/\partial x\); \(G_{\text{VIS},y}=\partial l_{\text{VIS},y}/\partial y\); //Calculate the gradient in the x-direction and y-direction. 3:for (\(j=1\) to \(J\)) do
4:for (\(x=1\) to \(w\)) do
5:for (\(y=1\) to \(h\)) do
6://low-frequency subband fusion
7:\(\mu_{\text{IR}}(x,y)=\text{average}[l_{\text{IR}}(x-\delta/2,y-\delta/2),\ldots,l_ {\text{IR}}(x+\delta/2,y+\delta/2)]\);
8:\(\mu_{\text{VIS}}(x,y)=\text{average}[l_{\text{VIS}}(x-\delta/2,y-\delta/2), \ldots,l_{\text{VIS}}(x+\delta/2,y+\delta/2)]\);
9:\(\sigma_{\text{IR}}(x,y)=\text{variance}[l_{\text{IR}}(x-\delta/2,y-\delta/2), \ldots,l_{\text{IR}}(x+\delta/2,y+\delta/2)]\);
10:\(\sigma_{\text{VIS}}(x,y)=\text{variance}[l_{\text{IR}}(x-\delta/2,y-\delta/2), \ldots,l_{\text{IR}}(x+\delta/2,y+\delta/2)]\);
11:\(\text{S}_{\text{IR}}(x,y)=l_{\text{IR}}(x,y)-l_{\text{IR}}(x,y)\);
12:\(\text{S}_{\text{VIS}}(x,y)=l_{\text{VIS}}(x,y)-l_{\text{VIS}}(x,y)\);
13:\(\text{w}_{\text{VIS}}(x,y)=\text{log}(1+\text{1}\,S_{\text{IR}}-S_{\text{VIS}} /1/(2\sigma_{\text{VIS}}(x,y)^{2}))\)
14:\(w_{\text{IR}}(x,y)=\exp(\text{1}\,S_{\text{IR}}-S_{\text{VIS}}\,1/(2\sigma_{ \text{IR}}(x,y)^{2}))\)
15:if (\(\text{1}\,S_{\text{IR}}(x,y)-\text{S}_{\text{VIS}}(x,y)\mid>\text{S}_{\text{ MIR}}\)&& \(\text{S}_{\text{IR}}(x,y)<0\)&& \(\text{S}_{\text{VIS}}(x,y)<0\)) then
16:\(L_{\text{F}}(j)(x,y)=w_{\text{VIS}}(x,y)L_{\text{VIS}}(x,y)+(1-w_{\text{VIS}} (x,y))\)\(L_{\text{IR}}(x,y)\)
17:elseif (\(\text{1}\,S_{\text{IR}}(x,y)-\text{S}_{\text{VIS}}(x,y)\mid<S_{\text{MIR}}\)&& \(\text{S}_{\text{IR}}(x,y)<0\)&& \(\text{S}_{\text{VIS}}(x,y)<0\)) then
18:\(L_{\text{F}}(j)(x,y)=w_{\text{IR}}(x,y)L_{\text{IR}}(x,y)+(1-w_{\text{IR}}(x,y))\)\(L_{\text{VIS}}(x,y)\);
19:else
20:\(L_{\text{F}}(j)(x,y)=0.5(L_{\text{IR}}(x,y)+L_{\text{VIS}}(x,y))\);
21:endif
22://high-frequency subband fusion
23:\(G_{\text{H},\text{d}}(x,y)=0.7\text{max}(\,|\,G_{\text{VIS},\text{d}}(x,y)-G_ {\text{IR},\text{d}}(x,y)\mid)\)
24:if (\(\text{1}\,G_{\text{VIS},\text{d}}(x,y)-\,G_{\text{IR},\text{d}}(x,y)\mid<G_{ \text{H},\text{d}}\)&& \(\text{S}_{\text{IR}}(x,y)<0\)&& \(\text{S}_{\text{VIS}}(x,y)<0\)) then
25:\(H_{\text{F},\text{d}}(j)(x,y)=H_{\text{VIS},\text{d}}(j)(x,y)\);
26:else
27:\(H_{\text{F},\text{d}}(j)(x,y)=H_{\text{IR},\text{d}}(j)(x,y)\);
28:endif
29:endfor
30:endfor
31:endfor
32:\(I_{\text{FU}}=\text{Idtcvut}(L_{\text{F}},H_{\text{F}})\); //DT-CWT reconstruction
33:return\(I_{\text{FU}}\)
```

**Algorithm 2**Image fusion method based on multi-scale decomposition

## 4 Experiment and Evaluation

The visible and infrared images used for algorithm evaluation were collected from a highway tunnel located in Dalian, Liaoning Province, China. The image alignment and fusion algorithm discussed in this section were implemented using MATLAB 2018a. To illustrate the process, a sample image depicted in Figure 4 was chosen. A total of 24 matching pairs were obtained through feature matching between the infrared and visible images. In Figure 4, the green lines represent correct matching pairs, while the red lines denote incorrect matching pairs. The coordinates of each feature point were input into Algorithm 1 for screening, and the results obtained from the RANSAC algorithm are displayed in Figure 5. The red points in Figure 5 represent outliers that do not conform to the model. The indexes of the feature points corresponding to these statistical outliers are shown in Figure 6 for the given sample. In this particular sample, with \(N=24\), it can be determined that the matching pairs with indexes \(k=3,8,9,14,17\), and 22 are identified as incorrect matches.