### 3.1 Description of the algorithm scheme

The outline of the proposed method can be characterized as follows.

First, Frost filtering algorithm and morphological closing algorithm are used to remove noise and enhance input image. The main effect of Frost filtering algorithm is to remove speckles, and the main effect of morphological algorithm is to eliminate details which are smaller than the structuring element, connect adjacent regions, and smooth boundaries. The image after this step has fewer details and is smoother than the original image, and pixels belonging to the same region connect more closely with each other, so the sense of integrity of the image becomes higher. We mainly pay attention to segment the image into several large classes correctly while ignoring preserving the details, so the image with higher sense of integrity is more suitable for later processing.

Second, the input image is segmented into multiple disjoint regions using MSER algorithm. The MSER algorithm often returns a lot of MSERs and most pixels in the image can be assigned to the MSERs, but there still exist some regions which are not considered to be stable regions. Thus, the input image is composed of multiple disjoint regions including the MSERs and the regions which are not MSERs. The average intensity of every region is computed and assigned to every pixel in it.

Third, all the regions after MSER procedure are treated as nodes and a graph structure is constructed to represent them. In this article, an improved strategy is developed for the graph construction. We assign different number of nodes to represent each region according to area ratio between the region and the smallest region, instead of considering each region as only one graph node. Let *m*_{1} be the area of the smallest area *r*_{1} and *m*_{2} be the area of the other region *r*_{2}, we assign one node to represent *r*_{1} and *n* nodes to represent *r*_{2}, where n=\sqrt{{m}_{2}/{m}_{1}}. The advantage of determining the numbers of nodes representing the regions based on area ratio is that it takes account of the area differences among the regions and keeps more information of the image after MSER procedure. In this way, better segmentation result can be gained with more information. As the graph has been constructed, similarity matrix *A* can be computed. The weight *A*(*i*, *j*) between nodes *i* and *j* which represent two different regions is defined as

A\left(i,j\right)=\text{exp}\left[-\frac{{\u2225g\left(i\right)-g\left(j\right)\u2225}_{2}^{2}}{2{\sigma}^{2}}\right]*\text{exp}\left[-\frac{1}{2{\eta}^{2}}*\frac{\text{dist}\left(i,j\right)}{\text{max}\left(\text{dist}\left(i,j\right)\right)}\right]

(4)

where *g*(*i*) is the intensity value of region *i*, and ∥ ⋅ ∥_{2} denotes the Euclidean distance. *σ* is a scaling factor that determines the sensitivity of *A*(*i*, *j*) to intensity difference between regions *i* and *j*. dist(*i*, *j*) denotes the spatial distance between regions *i* and *j*, and it is defined as the minimal pixel distance between the two regions, max(dist(*i*, *j*)) denotes the maximal spatial distance among all the regions. The smaller the spatial distance of two regions is, the greater that possibility of clustering the two regions to be one class is. *η* is an adjusting constant that determines the sensitivity of *A*(*i*, *j*) to the spatial distance between the regions *i* and *j*.

Finally, as the similarity matrix has been computed, the SC method is applied to solve the region partitioning problem. In the fifth step of original SC method, K-means algorithm is used for clustering. Because K-means algorithm is sensitive to the initialization of the centers, the clustering result is not stable. It has been proved that KHM algorithm is much more stable and performs better than K-means algorithm [26], so KHM algorithm instead of K-means algorithm is applied in this step to enhance stability and performance of the SC method in this article.

In the proposed method, the node number *h* is depend on the number of regions after MSER procedure instead of the size of input image *N*, *h* is always much less than *N*, so the computational cost of the proposed method is reduced dramatically. In addition, the partitioning of graph based on regions is more robust and insensitive to noise than that based on pixels.

### 3.2 Implementation procedure

To illustrate the implementation process of the proposed method, a natural scene image is used as an example, as depicted in Figure 1a. The image can be clustered into three classes: river, trees, and grass. The image size is 300 × 200.

#### 3.2.1. Frost filtering and morphological closing procedure

Figure 1b is the resultant image after Frost filtering procedure and Figure 1c is the resultant image after morphological closing procedure. The windows of Frost filter and morphological closing are set to 3 × 3 and 7 × 7, respectively. In this step, noise is removed and sense of integrity of the image becomes higher than the original one. The image after this procedure is more suitable for later processing.

#### 3.2.2. MSER procedure

Figure 1d is the resultant image after MSER procedure, the connected pixels with the same color depict one region. The parameter Δ is set to 7. As a result, 30 regions are produced by MSER procedure.

#### 3.2.3. Improved weighted graph construction strategy

In this step, the regions produced by MSER procedure are treated as nodes and a weighted graph is constructed. In this article, an improved strategy is developed for the graph construction. We assign different numbers of nodes to represent each region according to area ratio between the region and the smallest region, instead of considering each region as only one graph node. Let *m*_{1} be the area of the smallest area *r*_{1} and *m*_{2} be the area of the other region *r*_{2}, we assign one node to represent *r*_{1} and *n* nodes to represent *r*_{2}, where n=\sqrt{{m}_{2}/{m}_{1}}. For example, the area of the smallest region in Figure 1d is 42, the area of one of the other regions is 2151; thus, we assign one node to represent the smallest region and n=\sqrt{2151/42}\approx 7 nodes to represent the other one.

The nodes representing the same region have the same feature value and the weights among them are 1. Every two nodes in the graph have one weighted edge. Figure 2 is a sketch map of the weighted graph structure of regions which are represented by two nodes, three nodes, and four nodes in the graph, respectively, and all the nodes have the weighted edges between each other.

The advantage of determining the numbers of nodes representing the regions based on area ratio is that it takes account of the area differences among the regions and keeps more information of the image after MSER procedure. In this way, a better segmentation result can be gained with more information. In addition, the computational cost only slightly increases as the node number increases according to experiments.

#### 3.2.4. Similarity matrix computation

As the weighted graph has been constructed, similarity matrix can be computed. The elements of the similarity matrix are calculated according to (4).

#### 3.2.5. Final segmentation using SC method

As the similarity matrix has been computed, SC method is applied to perform the final segmentation. In this procedure, KHM algorithm instead of K-means algorithm is used to improve stability and performance of the segmentation. The regions produced by MSER algorithm are clustered into several classes with the improved SC method. The final segmentation result of Figure 1a is depicted in Figure 1e. The segmentation result is satisfactory and the image is correctly clustered into three classes, namely, river, trees, and grass, which proves the validity of the proposed approach.

Figure 1f is the segmentation result when considering each region as one graph node. It can be seen from Figure 1f that the segmentation result is not satisfactory, which proves the disadvantage of considering each region as only one graph node. It also shows that better segmentation results can be achieved by using the proposed graph construction strategy.