# Infrared Image Superpixel Segmentation Based on Seed Strategy of Contour Encoding
## 3 Methodology
### Seed Sampling Strategy
Strong edges can ensure that the surrounded region is closed during edge extraction; however, IR images often contain many weak edges, leading to broken contours. If the ray passes through the location at a vertical angle \(\vartheta_{v}\) where the edge is broken, two homogeneous regions cannot be segmented by the ray at the fracture, as shown in Figure 5a. In order to segment the edge fracture region effectively, a set of orthogonal rays is applied to rescan the image at a horizontal angle \(\vartheta_{h}\), as shown in Figure 5b. The ray in the orthogonal direction can segment the image again according to the edge map, and separate the initial consecutive vertical homogeneous regions at the edge break. By scanning the IR image in orthogonal directions (i.e., vertical \(\vartheta_{v}\) and horizontal \(\vartheta_{h}\)), the joint initial orthogonal homogeneous regions \(\phi_{v}\) (vertical direction) and \(\phi_{h}\) (horizontal  
Figure 4: An example of initial homogenous region generation. (**a**) Scan from top to bottom; (**b**) scan from bottom to top; and (**c**) the joint initial map that combines both directions into the vertical direction. Figure 5: A set of orthogonal rays is used to resolve the segmentation at the edge break. (**a**) Ray scanning in the vertical direction cannot split two adjacent homogeneous regions at the fracture; (**b**) horizontal rays rescan the image to re-segment the initial homogeneous region at the fracture. direction) are obtained, which are over-segmented such as Figure 4c. Then, compact initial orthogonal scan maps \(\phi^{\prime}{}_{v}\) and \(\phi^{\prime}{}_{h}\) are generated by merging adjacent initial regions that are not crossed by edges, based on similarity metrics \(M\). Both \(\phi^{\prime}{}_{v}\) and \(\phi^{\prime}{}_{h}\) jointly form the final homogeneous map shown in Figure 6c. For a non-edge pixel \(p_{i}\) in the binary edge map, its region labels in \(\phi^{\prime}{}_{v}\) and \(\phi^{\prime}{}_{h}\) are denoted as \((\phi^{\prime}{}_{v},_{i},\phi^{\prime}{}_{h,j})\), and pixels with the same \((\phi^{\prime}{}_{v},_{i},\phi^{\prime}{}_{h,j})\) are collected to form the final homogeneous map \(\psi\), which is the basic element for the seed sampling strategy. Regions in \(\psi\) with area smaller than \(t\), (\(t\) is related to the image resolution and recommended to be set to \(1.5\times 10^{-4}\times N_{\text{Total number in the image}}\)), pixels will be merged once into the most similar adjacent region to reduce redundant regions, unless there are no neighboring regions. The clustering approach beginning with seed points performs better for convex regions, due to the characteristics of the compact shape. The capability of adhering to boundaries for non-convex targets will be reduced. In the jointly homogeneous map \(\psi\), there are many regions with a large ratio of length to width, such as \(l_{1}\) in Figure 6c, and regions with large areas, such as \(l_{2}\) in Figure 6c. In SLIC [12], the distance term in the similarity metric can maintain compactness, such that the final superpixels tend to be quasi-circular. The farther the pixel is from the seed point, the greater the influence of the distance term on the similarity metric, and the more likely it is that a marking error will occur. Therefore, for regions with large aspect ratios or large areas, placing only one seed point in the interior cannot effectively describe the entire region. To accurately segment each region, the interval of seed point placement should be restricted. As in SLIC, a constant square search interval \(S\) is applied:  
\[S=\sqrt{\frac{N}{K}}, \tag{3}\]  
where \(N\) and \(K\) represent the total number of pixels in the image and the expected density of seed points, respectively. For each homogeneous region \(\varphi_{i}\in\psi\), the seed point sampling strategy is defined as follows:  
\[\left\{