# Small Infrared Target Detection via a Mexican-Hat Distribution
## 3 The Proposed Method  
As shown in Figure 3, the proposed four-step method for detecting a small IR target is based on the Mexican-hat distribution. To increase the contrast between small targets and the background, the modified top-hat transformation [22] is first applied to a raw IR image, followed by DoG filtering. Then, the Mexican-hat-distribution based _Rule 1_ is applied to the DoG image, getting candidate targets. Finally, a small IR target is detected by locating the brightest pixel. Figure 1: The bright-dark-bright pattern of the adjacent region of an IR target. Figure 2: Three sub-regions of a small image patch. Here, to deal with the variable size of small IR targets, the following iteration strategy is adopted when applying \(Rule\) 1 to a DoG image. First, let the half-width, \(L\), of region \(R_{0}\) ranges from 1 to 5, implying the size of region \(R_{0}\) varies from \(3\times 3\) to \(11\times 11\) that is consistent to the recognition that a small target usually occupies less than 80 pixels [24]. Then for each \(L\), \(Rule\) 1 is applied to the adjacent of each pixel of the DoG-filtered image. Those pixels that meet \(Rule\) 1 are labeled as candidates, and their intensity is emphasized by the mean intensity of \(R_{1}\). Meanwhile, the corresponding size of \(R_{0}\), i.e., \((2L+1)\times(2L+1)\) are recorded as the target size. Algorithm 1 presents the details for finding candidate targets as well as their sizes. Considering small IR targets are usually brighter than the background, \(Rule\) 1 is merely applied to the patches whose center pixel is brighter than \(th=\mu_{0}+\sigma_{0}\) with \(\mu_{0}\) and \(\sigma_{0}\) being the mean intensity and the standard variance of the DoG-filtered image. ```
1:Input :\(I_{DoG}\)--the DoG-filtered image \(H\),\(W\)--the height and the width of \(I_{DoG}\) \(th\)--threshold
2:Output :\(I_{can}\)--the image with enhanced candidate targets (\(r_{can}\), \(c_{can}\))--the coordinates of candidates s--the size of candidates inten--the mean intensity of candidates
3:for\(r=1\) to \(H\)do
4:for\(c=1\) to \(W\)do
5:if\(I_{DoG}(r,c)\)>\(th\)then
6:for\(L=1\) to 5 do
7: Locate sub-regions \(R_{0}\), \(R_{1}\) and \(R_{2}\) according to Figure 2;
8:\(m_{i}=\) mean intensity of \(R_{i}\), with \(i=0,1\) and 2. 9:if\(m_{0}>m_{1}\),\(m_{0}>m_{2}\), and \(m_{1}<m_{2}\)then
10:\((r_{can},c_{can})\)=(\(r,c\)) \(\text{s}(r_{can},c_{can})\)=(\(2L+1)\times(2L+1)\) \(\text{inten}(r_{can},c_{can})\)=\(m_{0}\) \(I_{can}(r_{can},c_{can})\)=\(I_{DoG}(r_{can},c_{can})\) - \(m_{1}\)
11:else
12: break;
13:endif
14:endfor
15:endif
16:endfor
17:endfor
```  
**Algorithm 1** Candidate target detection. Next, to further remove false targets, the statistics of sub-regions \(R_{0}\), \(R_{1}\) and \(R_{2}\) are calculated. For real small IR targets, their intensity might not strictly meet the Mexican-hat distribution. For example, the first row of Figure 4 shows that the center pixel of a target is not the brightest, and the second row shows that nearly half of pixels in region \(R_{1}\) and in region \(R_{2}\) don't meet the Mexican-hat distribution. Therefore, for a candidate target located at (\(r,c\)), (3) is adopted to calculate  
Figure 3: The proposed method for detecting small IR targets. the ratio of the number of pixels in \(R_{1}\) being darker than the mean intensity of \(R_{0}\) to the total pixels of \(R_{1}\). \[Rt_{10}(r,c)=\frac{Card((x,y)\in R_{1}|I(x,y)<m_{0})}{Card(R_{1})} \tag{3}\]  
where \(m_{0}\) is the mean intensity of \(R_{0}\), and \(Card(. )\) represents the cardinality of a set. Then the pixel by pixel differences between \(R_{1}\) and \(R_{2}\) are calculated along the row direction and the column direction, respectively, followed by the computation of the ratio of the number of pixels in \(R_{1}\) being darker than the corresponding pixels in \(R_{2}\) to the total pixels with (4) and (5).