# Infrared Image Superpixel Segmentation Based on Seed Strategy of Contour Encoding
## 3 Methodology
### Initial Superpixel Extraction  
After obtaining the initial seed set, each pixel is labeled based on the similarity between the pixel and seed points to form superpixels. SLIC [12] limits the search range to a space proportional to the patch size and utilizes a multidimensional feature vector to constrain the segmentation process. Normally, the search range is limited to \(2S\times 2S\), in order to  
Figure 7: Example of the seed sampling strategy for an initial homogeneous region that cannot be completely covered by \(S\). achieve linear complexity. \(D\) is defined as the distance in multidimensional space, which describes the similarity of pixels and cluster centers:  
\[D=\sqrt{(d_{lab})^{2}+\left(\frac{d_{s}}{S}\right)^{2}\cdot m^{2}}, \tag{5}\]  
\[d_{lab}=\sqrt{(l_{p}-l_{q})^{2}+(a_{p}-a_{q})^{2}+(b_{p}-b_{q})^{2}}, \tag{6}\]  
\[d_{s}=\sqrt{(x_{p}-x_{q})^{2}+(y_{p}-y_{q})^{2}}, \tag{7}\]  
where \(d_{lab}\) and \(d_{s}\) represent the color proximity and spatial proximity, respectively; \(p\) and \(q\) are two pixels within the bounded range; \([l,a,b]\) and \((x,y)\) indicate the color of pixels in the CIELAB color space and the pixel coordinate, respectively; and \(m\) is related to the boundary preservation ability. Inspired by SLIC, the IR images are transformed into a three-dimensional feature vector \(V=[l,x,y]^{T}\), which is expanded from the luminance space and coordinate space. Compared with color images, IR images only carry luminance information, and the classical SLIC algorithm is not applicable. We transform Equation (6) into a luminosity function suitable for IR images, where the spatial distance \(D^{\prime}\) can be expressed as:  
\[D^{\prime}=\sqrt{d_{l}{}^{2}+\left(\frac{d_{s}}{S}\right)^{2}\cdot m^{2}}, \tag{8}\]  
\[d_{l}=\sqrt{(l_{p}-l_{q})^{2}}, \tag{9}\]  
where \(d_{l}\) represents the luminance proximity and \(l\) is the luminance value. In IR images, spot noise and blind elements, as local outliers, cannot be correctly clustered based on the similarity metric \(D^{\prime}\). To improve the robustness to image noise, neighboring information is integrated when computing the luminance proximity \(d_{l}\). A square region \(\mathbb{R}(p)\) of size \(|\mathbb{R}(p)|=(2n+1)\times(2n+1)\), centered on pixel \(p\), is constructed to represent the luminance value of \(p\), instead of its own luminance value (\(n\) is set to 1 in this paper). In the region \(\mathbb{R}(p)\), the set of non-edge pixels after excluding the extreme points is denoted as \(\mathbb{R}^{\prime}(p)\), and its average value is used to calculate the luminance similarity between the central point \(p\) and seed point \(C_{k}\). Equation (9) can thus be transformed into:  
\[d_{l}(p,C_{k})=\sqrt{(\mathbb{I}_{\mathbb{R}^{\prime}(p)}-l_{C_{k}})^{2}}, \tag{10}\]  
\[\mathbb{I}_{\mathbb{R}^{\prime}(p)}=\frac{\sum\limits_{p_{i}\in\mathbb{R}^{ \prime}}l_{p_{i}}}{n(\mathbb{R}^{\prime})}, \tag{11}\]  
where \(n(\mathbb{R}^{\prime})\) and \(\mathbb{I}_{\mathbb{R}^{\prime}(p)}\) represents the total number of pixels and the average value of \(\mathbb{R}^{\prime}(p)\), respectively. Combining pixel neighborhood information can improve the robustness to abnormal pixels. In SLIC, the distance between each adjacent initial seed point is consistent due to regular grid sampling, such that pixels have equal spatial similarity weight to each seed point in \(2S\times 2S\).