# Infrared Image Superpixel Segmentation Based on Seed Strategy of Contour Encoding
## 1 Introduction
In the process of clustering, the initial seed set and the grouping of pixels are crucial. An image is usually composed of smooth regions and complex content regions, but most existing superpixel algorithms cannot generate superpixels adapted to the image content. Regular grid seed sampling is used by most algorithms to construct the initial seed set, which ignores the image structure and may lead to over-segmentation in smooth regions or poor boundary adherence in complex regions. In addition to color and spatial distance, texture is also used as an additional similarity measure factor to enhance the boundary adherence capability; however, it cannot ensure that the size of superpixels matches the image content [18; 19; 20]. Texture can reflect the complexity of the image, but not its structure. Contours can better reflect the image structure, and have been utilized by more scholars to strengthen the similarity measure between pixels. [PERSON] et al. [21] added the contour item as one of the similarity measure factors and determined the reallocation of pixels based on the possibility of their location on object boundaries; however, this method cannot actively increase the number of superpixels in complex regions to segment small regions. [PERSON] et al. [22] directly extracted over-segmented superpixels from the binary edge map, then optimized the initial superpixel image using similarity clustering to generate the final superpixels. Although their method is able to generate superpixels based on image content with better boundary adherence, it is more sensitive to the fracture/closure of the contour and will fail in regions with weak boundaries or color progression. Most algorithms can only increase the number of superpixels across the board to improve segmentation accuracy, rather than in the desired region. Therefore, it is challenging to design a superpixel algorithm that is both robust and sensitive to image content. Inspired by clustering algorithms and the contour constraint, we propose an effective IR image superpixel generation method based on a seed strategy of contour encoding (SSCE). Specifically, we apply the seed sampling strategy and an optimized clustering process to generate superpixels. The former provides the initial seed set for the clustering process by contour encoding, while the latter assigns a unique label to each pixel according to clustering criteria. As mentioned above, contours provide the structural information of the image, and their number represents the complexity of the structure in a local region. In general, larger superpixels are suitable for smooth regions in order to avoid over-segmentation, while more superpixels with smaller sizes are necessary for complex texture regions, thus enhancing the boundary adherence capability [23]. Our adaptive seed sampling strategy takes this feature into account. First, a contour encoding map is obtained by ray scanning, which is capable of constructing closed connected domains based on the image content. According to the sampling strategy, initial seed points are placed in each connected domain. Therefore, the initial seed set can adapt to the local image structure and place more seed points in dense regions. Then, starting from the initial seed set, the clustering algorithm is utilized to obtain the initial superpixels. In the clustering process, we eliminate the local outliers and optimize the similarity evaluation criteria to improve the boundary adherence performance. In order to reduce the leakage of superpixels, a contour constraint is applied simultaneously to the similarity measure function to refine the initial superpixel map. Finally, high-quality superpixels that can reduce over-segmentation and adapt to irregular shapes are generated by merging similar adjacent superpixels. To demonstrate the effectiveness of our algorithm, comparative experiments were performed on a self-built IR dataset, the real-world image dataset BSD500 [24], and the medical image dataset 3 Dircadb [25].