# Infrared Image Superpixel Segmentation Based on Seed Strategy of Contour Encoding
## 3 Methodology
### Initial Superpixel Extraction
In the initial seed map obtained by our seed sampling strategy, the distribution of seeds is related to the image content, resulting in different distances between each adjacent seed point, as shown in Figure 8. The spatial proximity weight \(w(p_{i},C_{k})\) between pixel \(p_{i}\) and seed point \(C_{k}\) in the search range of \(2S\times 2S\) should be inversely proportional to the corresponding sampling area of \(C_{k}\); for example, the shaded area in Figure 7. Equation (7) can be transformed into:  
\[D=\sqrt{(d_{lab})^{2}+\left(\frac{d_{s}}{S}\right)^{2}\cdot m^{2}}, \tag{5}\]0\[D=\sqrt{(d_{lab})^{2}+\left(\frac{d_{s}}{S}\right)^{2}\cdot m^{2}}, \tag{5}\]1  
where \(\Omega(C_{k})\) represents the sampling area of seed point \(C_{k}\), and \(n\) is the total number of seed points in the search range. When only considering the spatial distance similarity, \(w(p_{i},C_{k})\) is introduced to balance the distribution of pixels within the search range to match the size of each superpixel. Without weighted balance, \(p_{i}\) will be categorized into \(C_{2}\) in \[D=\sqrt{(d_{lab})^{2}+\left(\frac{d_{s}}{S}\right)^{2}\cdot m^{2}}, \tag{5}\]2  
As mentioned in Section 3.1, pixels surrounded by the same contour have a higher probability of belonging to a uniform homogeneous region, such as \(C_{1}\) and \(p_{i}\) in \[D=\sqrt{(d_{lab})^{2}+\left(\frac{d_{s}}{S}\right)^{2}\cdot m^{2}}, \tag{5}\]3 Therefore, the edge prior map \(E\) is considered to constrain the similarity metric. When pixel \(p_{i}\) and seed point \(C_{k}\) are crossed by an edge from \(E\), such as \(C_{2}\) and \(p_{i}\) in Figure 8, their similarity metric should be increased to prevent \(p_{i}\) from being associated with \(C_{k}\). To ensure that the superpixel contours accurately follow the image contour, an edge penalty term \(d_{\lambda}\) is integrated into the similarity metric, as follows:  
\[D=\sqrt{(d_{lab})^{2}+\left(\frac{d_{s}}{S}\right)^{2}\cdot m^{2}}, \tag{5}\]4  
\[\lambda(q)=\left\{ \begin{array}{ll}1&e(q)=-1\\ 0&\text{Otherwise}\end{array} \right., \tag{15}\]  
where \(\gamma\) is the penalty control factor and \(l_{C_{k}}^{p_{i}}\) is the Euclidean path of two pixels (e.g., \(l_{1}\) and \(l_{2}\) in Figure 8). As \(\gamma\) decreases, the constrained force of the boundary decreases, which is set to 0.3 in the following analysis. Combining Equations (10), (12) and (14), our proposed similarity metric is as follows:  
\[D_{\lambda}^{\prime}(p_{i},C_{k})=D^{\prime}d_{\gamma}=(\sqrt{d_{l}{}^{2}+d_{ S}{}^{2}\cdot\left(\frac{m}{S}\right)^{2}})(1+\gamma\text{max}(\lambda(q))). \tag{16}\]  
Based on the distance similarity metric, each pixel is assigned to the nearest seed point to minimize \(D_{\lambda}^{\prime}\). After all pixels have been assigned, pixels that have the same label are combined to create initial superpixels. Then, the seed points are updated as the centroid of each initial superpixel, and the initial superpixel map can be obtained after several iterations. Figure 8: Example of seed distribution in \(25\times 25\). The distance \(l_{1}\) between pixel \(p_{i}\) and seed point \(C_{1}\) is much larger than the distance \(l_{2}\) from \(C_{2}\).