## 2 Materials and Methods
### Boundary Adjustment  
The preliminary segmentation results were formed at one time and further optimization was required. In Figure 2, the shape of the superpixel was not regular enough, especially in the content-sparse region. There were several under-segmentation errors in the area pointed by the red arrow in the image. It can be seen that boundary adjustment significantly improved the compactness and boundary adherence of superpixels.  
The boundary pixels of the initial superpixels were allocated to obtain better compactness and boundary adherence. Among pixels connected to \(S_{i}\), the pixels that do not belong to \(S_{i}\) are boundary pixels. For each boundary pixel, calculate the distance between the boundary pixel and the adjacent superpixel, and assign the boundary pixel to the superpixel which is nearest to it. Boundary adjustment is an iterative process. The iteration is terminated when the set number of iterations is reached.  
In the distance Equation (5), the color distance term affects the adherence of superpixels boundary, and spatial distance term affects the compactness of superpixels. To enhance the content sensitivity of superpixels, we define the new distance measurement as follows:  
\[D^{\prime}(v_{1},v_{2})=\sqrt{\lambda^{2}\frac{\|\mathbf{x}_{1}-\mathbf{x}_{2 }\|_{2}^{2}}{N_{x}^{2}}+\|\mathbf{c}_{1}-\mathbf{c}_{2}\|_{2}^{2}\cdot I(i)} \tag{7}\]  
When the value \(I(i)\) is higher, the color distance is more considered. When the value \(I(i)\) is lower, the spatial distances should be more considered.  
Figure 1: Illustration of the aggregation process of superpixels. The vertices represent pixels and the edges represent similarities. (**a**)The vertex 15 is the nearest neighbor of the tree (red vertex 11), (**b**) the tree aggregates the nearest neighbor, (**c**) update the average attribute of the tree, (**d**) expand the search scope of the tree and find the next nearest neighbor(vertex 9).  
Figure 2: Image segmentation results with 400 superpixels. (**a**) Superpixel segmentation results after minimum spanning tree clustering, (**b**) superpixel segmentation results after boundary adjustment.  
Boundary adjustment does not guarantee the superpixel connectivity. In the procedure, a superpixel may be split into several unconnected sub-superpixels. Connectivity is taken into account of the procedure of boundary adjustment and additional steps are not required. For too small sub-superpixels, they will merge with the nearest superpixel. The pseudo code of boundary adjustment is presented Algorithm 3.  
```
Input: Initial Superpixel label map \(L\) and the maximum number of iterations Maxiter Output: Optimized Superpixel label map \(L\) While iter < Maxiterdo for each superpixel \(S_{i}\)do for each boundary vertex \(v_{i}\)do for Each connected neighbor \(v_{j}\) of \(v_{i}\) that are not in \(S_{i}\)do  Get the superpixel \(S_{j}\) which \(v_{j}\) belongs to  Compute \(D^{\prime}(v_{j},C_{j})\) and \(D^{\prime}(v_{j},C_{i})\) using Equation (7) if\(D^{\prime}(v_{j},C_{i})\)<\(D(v_{j},C_{j})\)then \(L[v_{j}]=k_{i}\)  Update \(C_{i}\) and \(C_{j}\) using Equation (6)  Update the boundary vertices endif endfor endfor endwhile
```  
**Algorithm 3**Boundary adjustment  
For an image with \(n\) pixels, it is obvious that the complexity of the image local entropy and the seed sampling strategy are O(\(n\)). In the minimum spanning tree clustering phase, the number of pixels in the priority queue is much smaller than \(n\). Thereby, the impact of priority queues on computational complexity is not very obvious. In the boundary adjustment stage, the computational cost in each iteration is O(\(n_{B}\)), in which \(n_{B}\) is the number of boundary pixels. In practice, \(n_{B}\ll n\). In the comprehensive analysis, the proposed algorithm is of linear complexity O(\(n\)).