Image segmentation continues to be a focus of great attention in the field of computer vision. This is, primarily, because segmentation is a key pre-processing step in a broad range of applications (e.g.[1, 2, 3]). In particular, superpixel segmentation is a prominent technique that has been applied to a wide range of computer vision tasks including object detection 
, depth estimation, optical flow [6, 7] and object tracking . The idea of superpixels is to divide the image into multiple clusters, which ideally reflect qualities such as similar colour, and boundaries overlapping with existing boundaries in the image.
Superpixel segmentation as a stand-alone tool decreases computational load by reducing the number of primitives in the image domain, while at the same time increasing discriminative information [9, 10]. These factors have motivated the fast development of diverse superpixel segmentation techniques starting from the pioneering work of Ren and Malik  and followed by diverse approaches including the ones reported in [9, 12, 13, 14].
In particular, the Simple Linear Iterative Clustering (SLIC) 
algorithm is a top reference solution, and probably the most widely-used approach, that fulfils desirable properties such as computational tractability and good boundary adherence. SLIC performs image segmentation into superpixels, building on Lloyd’s algorithm for -means clustering. The general approach is an iterative scheme which adapts the segmentation at each iteration such that the updated domains consist of points which are similar, in distance or colour, to a particular segment in the previous step.
The central observation of SLIC is that using a similarity-metric, which includes spatial distance in the image, one can justify a limitation on the search range for the updates. This limit yields to a vastly improved computational performance of SLIC when compared to traditional segmentation algorithms. However, the introduction of a limited search range also has downsides: (1) large uniform domains are segmented into unnecessarily small superpixels and (2) in regions with more structure, i.e. more objects, the final superpixel size is much smaller than the search radius of SLIC; thus, many distance calculations are actually obsolete and computational efficiency could be further enhanced.
Motivated by the aforementioned drawbacks, in this work we propose an extension of the SLIC algorithm which we call dSLIC, where d stands for dynamic. Our solution allows for a dynamic search field in each iteration, thus allowing the algorithm and final superpixels to better adjust to structure which is prevalent in the image (see Fig. 1). While this is an important part of our solution our contributions are: (1) We propose a structure measure that allows for dynamic adjustment of the search range according to the density of objects/boundaries. (2) We show that our proposed distance calculations allows: (i) searching, in structure-poor parts, larger domains to connect meaningful uniform regions and (ii) reducing, in structure-rich parts, the search radius to save computational resources. (3) We demonstrate that injecting our structure measure to the SLIC computation leads to a segmentation closer to the ground-truth. (4) We provide evidence of the general applicability of our solution with several datasets, and compare against some work from the body of literature.
2 Background From Lloyd to SLIC
Consider an input image of integer width and integer height as , where is the image domain. For our purpose, could be for greyscale images or a subset of for colour images. Then, segmenting the input into superpixels based on -means clustering can be formulated as a minimisation problem in the following form:
Definition 2.1 (Segmentation in -means clustering).
Given an image , where , a segmentation into superpixels is a partition of such that:
Each is path-connected, with respect to the usual grid on .
For each we have .
where is a metric on the space and is the feature function on the set of all partitions of the image grid.
Intuitively speaking, represents the main features of each cluster and is a measure for similarity between any two points in the space .
A fairly traditional approach to image segmentation is -means clustering and in particular Lloyd’s algorithm . The idea is to compute the point in closest to the mean (which we shall call the cluster center) of all cluster points, as , and to update the segmentation iteratively, ensuring at each step that we assign points to the nearest cluster from the previous step. Inspired by this concept, Achata et al. in  proposed the SLIC algorithm which is a local version of the Lloyd’s algorithm.
In the setting of SLIC, a distance measure is used as: For define
where is Lab-space in the colour image case and just intensity in the grey-scale image case, and is a parameter which tunes the importance of spatial as compared to Lab-distance. The central observation exploited by SLIC is that if the spatial distance between two image points () is large, then the distance is large and its calculation can be spared in order to enhance computational efficiency. While SLIC has demonstrated powerful results, it is more limited by its construction. These limitations are addressed and motivate our proposed solution.
3 Structure Adjusting Superpixels
In this section, we address how the failure of SLIC is related to the modelling hypotheses, and how these failures motivate our proposed solution, dSLIC.
Whilst SLIC provides fast and qualitative image segmentation, one can observe - from the description given in the previous section - that SLIC is restricted by its own definition. Notably, these restrictions are two-fold. Firstly, SLIC tends to segment large uniform regions in an image with more superpixels than are intuitively necessary. Secondly, in search domains with many boundaries, the resulting superpixels size is smaller than SLIC’s search radius.
Proposed Solution dSLIC. The central idea to our approach is that the problems described above could be overcome by dynamically adjusting the search range according to the density of structure in a given part of the image.
The presence of boundaries and hence of non-uniform parts in an image can be captured by the size of the discrete gradient of the image. Particularly, if we work with greyscale images with then will be large on edges of the image and provide an indicator of such in the interval . For colour images, we calculate the gradient and all following measures simply by converting to greyscale first. However, the gradient - as local descriptor of the image - does not allow determining if a given point belongs, or not, to an image part with many boundaries. Thus, we propose the following measure of structure in the image:
is a Gaussian kernel of variance. In practise, we found that the following additional scaling is able to deal with any given input image:
Our function is plotted in Fig 2. From these examples, we can observe that is small in uniform regions, such as the sky, and large in non-uniform regions such as the trees and people. This comes from the fact that the normed gradient provides a local indicator for existent structure and the Gaussian convolution allows us to spread this information across a neighbourhood. In order to rescale the search radius appropriately we define:
where denotes the average of on the image grid, and propose the following dynamic distance computation:
The overall procedure of our dSLIC method - which dynamically adjusts the search field size according to our structure measure - is listed in Algorithm 1.
4 Experimental results
In this section we describe in detail the experiments that we conducted to evaluate our dSLIC algorithm.
Data Description. We evaluated our dSLIC algorithm using images coming from three datasets: (i) The Berkeley Segmentation Dataset 500 , (ii) The Stanford Background Dataset  and (iii) The Fashionista dataset [18, 10]. All results presented in this section were run under the same condition, and using an Intel Core i7 CPU at 3.40 GHz-64GB.
Results. We divided our evaluation scheme in two parts: (1) The first, which is the main focus of this work, demonstrates the advantages of our solution (dSLIC) - from both qualitative and quantitative points of view - against the SLIC algorithm. (2) We offer an initial insight comparison between dSLIC and some works from the state-of-the-art. In this work, in (1) we set since it yields balance between uniformity of shape and boundary adherence.
We started with visual evaluation of our approach compared against SLIC. Upon visual inspection of the results in Fig. 4, we can observe that dSLIC is able to combat the problems encountered with SLIC, in that it samples larger superpixels into uniform regions, avoiding in this way segmenting the input images into unnecessarily small superpixels. More precisely, this positive effect is illustrated in the sample output in Fig. 4, in which we highlight from (a) both the hair and pants that were more properly grouped into the same superpixels. SLIC in that case failed to fully segment the hair and added avoidable segments to the pants. dSLIC was also more successful on properly identifying the face and the background in (b) where those details were lost in the results from SLIC. Similarly, the segmentation results of the woman in (c) show proper grouping of the face and the sweater.
To further evaluate the results, we also offer quantitative analysis based on two well-used metrics for superpixels evaluation. The first metric is undersegmentation error which measure conformity to the true boundaries. The second metric is the achievable segmentation accuracy (ASA) which is a performance upperbound measure that gives higher achievable accuracy when superpixels are utilised as units for object segmentation. These performance metrics are plotted against the number of superpixels for both SLIC and dSLIC approaches, which were obtained from segmented 15% of randomly selected images of all datasets.
The plot on the left side of Fig. 3 shows the undersegmentation error curves of both approaches where we can observe that the proposed algorithm outperforms SLIC at all the superpixel counts and reduces the error rate by more than 20%. Similarly, the ASA curves - that appear on the right side of Fig. 3 - show that dSLIC yields a better achievable segmentation upperbound at all the superpixel counts. With dSLIC, the ASA is 95% with 200 superpixels where the same accuracy can only be achieved with 1000 superpixels for SLIC. This improvement comes at a negligible cost in runtime ().
While the main aim of this work is to offer evidence about the performance improvement of our approach over SLIC, we also offer an insight comparison of our solution against some work from the state of the art, particularly [12, 14]. All results were adapted to the same conditions for fair comparison. Fig. 5 shows selected images comparing the results of each of the compared approaches. Visual assessment of the figure shows that our solution was able to identify shapes’ details and merge regions with uniform domain. Clear examples can be seen in the segmentation of the faces and the moon structure in (a) and the face and wooden branch in (b) and (c) respectively. Our algorithm was also able to properly unify small details in the image such as the duck’s beak and the house structure in examples (d) and (e). We also noticed that among the compared algorithms, SLIC and dSLIC demanded the lowest computational load.
We have considered the problem of superpixel image segmentation, which is of theoretical interest and practical importance. We build on the state-of-the-art algorithm SLIC  by introducing a dynamic search range based on a structure measure. This helps avoid both unnecessary oversegmentation of uniform areas, and repeatedly searching object-dense areas. Numerical experiments showed evidence that our proposed algorithm, dSLIC, outperforms the SLIC solution in terms of undersegmentation error (20%) and achievable accuracy. Visual assessment of the results confirms that dSLIC provides more meaningful superpixels in the same linear runtime. This work offers an initial proof of concept of our method dSLIC. Future work may include an extensive comparison and analysis against more works from the state-of-the-art.
-  Ngo, Tran-Thanh and Collet, Christophe and Mazet, Vincent. Automatic rectangular building detection from VHR aerial imagery using shadow and image segmentation. IEEE International Conference on Image Processing (ICIP). pp. 1483–1487, 2015.
-  Huang, Xinyu and Li, Chen and Shen, Minmin and Shirahama, Kimiaki and Nyffeler, Johanna and Leist, Marcel and Grzegorzek, Marcin and Deussen, Oliver. Stem cell microscopic image segmentation using supervised normalized cuts. IEEE International Conference on Image Processing (ICIP), pp. 4140–4144, 2016.
-  Shen, Haocheng and Zhang, Jianguo and Zheng, Weishi. Efficient symmetry-driven fully convolutional network for multimodal brain tumor segmentation. IEEE International Conference on Image Processing (ICIP), 2017.
Yan, Junjie and Yu, Yinan and Zhu, Xiangyu and Lei, Zhen and Li, Stan Z. Object detection by labeling superpixels. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5107–5116, 2015.
-  Liu, Fayao and Shen, Chunhua and Lin, Guosheng. Deep convolutional neural fields for depth estimation from a single image. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5162–5170, 2015.
-  Lu, Jiangbo and Yang, Hongsheng and Min, Dongbo and Do, Minh N. Patch match filter: Efficient edge-aware filtering meets randomized search for fast correspondence field estimation. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1854–1861, 2013.
-  Menze, Moritz and Geiger, Andreas. Object scene flow for autonomous vehicles. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp.3061–3070, 2015.
-  Wang, Shu and Lu, Huchuan and Yang, Fan and Yang, Ming-Hsuan. Superpixel tracking. IEEE International Conference on Computer Vision (ICCV), pp. 1323–1330, 2015.
-  Achanta, Radhakrishna and Shaji, Appu and Smith, Kevin and Lucchi, Aurelien and Fua, Pascal and Süsstrunk, Sabine. SLIC superpixels compared to state-of-the-art superpixel methods. IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), vol.34, pp. 2274–2282, 2012.
-  Stutz, David and Hermans, Alexander and Leibe, Bastian. Superpixels: An evaluation of the state-of-the-art. Computer Vision and Image Understanding, 2017.
-  Ren, Xiaofeng and Malik, Jitendra. Learning a classification model for segmentation. IEEE International Conference on Computer Vision (ICCV), 2003.
-  Vedaldi, Andrea and Soatto, Stefano. Quick shift and kernel methods for mode seeking. European Conference on Computer Vision (ECCV), pp. 705–718, 2008.
-  Van den Bergh, Michael and Boix, Xavier and Roig, Gemma and de Capitani, Benjamin and Van Gool, Luc. SEEDS: Superpixels extracted via energy-driven sampling. European Conference on Computer Vision (ECCV), pp. 13–26, 2012.
-  Tang, Dai and Fu, Huazhu and Cao, Xiaochun. Topology preserved regular superpixel IEEE International Conference on Multimedia and Expo (ICME), pp. 765–768, 2012.
-  Lloyd, Stuart. Least squares quantization in PCM. IEEE transactions on information theory, vol. 28, pp. 129–137, 1982.
-  Arbelaez, Pablo and Maire, Michael and Fowlkes, Charless and Malik, Jitendra. Contour detection and hierarchical image segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), vol. 33, pp. 898–916, 2011.
-  Gould, Stephen and Fulton, Richard and Koller, Daphne. Decomposing a scene into geometric and semantically consistent regions. IEEE International Conference on Computer Vision (ICCV), pp. 1–8, 2009.
-  Yamaguchi, Kota and Kiapour, M Hadi and Ortiz, Luis E and Berg, Tamara L. Parsing clothing in fashion photographs. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3570–3577, 2012.