# Research on the Method of Coke Optical Tissue Segmentation Based on Adaptive Clustering

Authors: Huaiguang Liu; Liheng Zhang; Shiyang Zhou; Li Fang
Journal: International Journal of Photoenergy
 (2021)

---

## Abstract

The microstructure is the key factor for quality discriminate of coke. In view of the characteristics of coke optical tissue (COT), a segmentation method of coke microstructures based on adaptive clustering was proposed. According to the strategy of multiresolution, adaptive threshold binarization and morphological filtering were carried out on COT images with lower resolution. The contour of the COT body was detected through the relationship checking between contours in the binary image, and hence, COT pixels were picked out to cluster for tissue segmentation. In order to get the optimum segmentation for each tissue, an advancedK-means method with adaptive clustering centers was provided according to the Calinski-Harabasz score. Meanwhile, Euclidean distance was substituted with Mahalanobis distance between each pixel in HSV space to improve the accuracy. The experimental results show that compared with the traditional K-means algorithm, FCM algorithm, and Meanshift algorithm, the adaptive clustering algorithm proposed in this paper is more accurate in the segmentation of various tissue components in COT images, and the accuracy of tissue segmentation reaches 94.3500%.


---

## Body

## 1. Introduction

In recent years, blast furnace ironmaking technology had developed with the continuous development of the steel industry. So blast furnace ironmaking also puts forward higher requirements on the metallurgical properties of coke [1–3]. As an indispensable raw material and fuel in the blast furnace ironmaking, coke plays the role of heating agent, reducing agent, carburizing agent, and material column framework in the blast furnace [4–7]. Coke structures are one of the most important factors affecting the quality of coke. Its optical tissue composition has a direct impact on the reactivity of coke, its strength after reaction, and its thermal conductivity. Therefore, analysis and study of coke optical tissues are of great practical significance for blast furnace ironmaking and coking coal blending [8–10].The relationship between coke microstructures and coke properties had attracted a great deal of research attention since the 1980s. For example, Singh et al. [11] studied the thermal resistance of coking coal, Yang et al. [12] discussed the carbonization properties and microstructures of coke, and Lin et al. [13] studied the influence of semicoke optical structures on the carbonization properties. In recent years, the use of digital image processing technology for the analysis and identification of coke microstructures has also aroused widespread interest, but research results are mainly focused on the determination of coke porosity parameters; the automated research on coke microstructures progresses slowly [14–24]. Based on image processing methods, Ghosh et al. [14] measured coke microstructure information about porosity, pore size distribution, pore wall thickness, radius, circumference, shape, and other structural parameters. Compared with volume analysis, image analysis provides more information on coke structures. Shohei et al. [15] established a coke model with a microstructure in order to study the influence of microstructures including pores, cracks, and inert materials on the shrinkage of coke and performed thermal stress analysis using finite element methods.Segmentation of COTs is a prerequisite for subsequent COT identification and classification. Chen et al. [25] integrated an iterative mesh clustering algorithm into the image segmentation algorithm to improve the segmentation accuracy of COTs. The algorithm worked well for the segmentation of COTs and provided a reliable basis for the automatic identification of coke microstructures. Zhou et al. [26] proposed a segmentation algorithm combining mean drift and edge confidence for COT images. The experimental results showed that the algorithm was more reasonable and effective in partitioning between the different optical textures of the coke. However, the above two methods were clustered on the whole COT image, the algorithm is not highly targeted. In this paper, the binary image of the COT image was obtained based on the adaptive threshold binarization and morphological filtering algorithm. While finding all the contours of the binary image, the contour hierarchy matrix and the contour area coefficient were introduced to filter out the contour of the main body in the COT image, and then, the pixels of the main body were obtained. Finally, the pixels in the main body were subjected to adaptive clustering with K-means to realize the segmentation of each tissue component, comparing with the tissue segmentation algorithms in literature [25] and literature [26]; the algorithm proposed eliminates the effect of the pore area pixels on the effectiveness of clustering and improves the processing speed of the algorithm; it is more targeted to directly cluster the tissue pixels of the main body. At the same time, the clustering feature of this article is color feature, which is simpler than texture feature. In addition, by introducing the hierarchical matrix, the main body of the optical tissue image can be extracted to the greatest extent. On the basis of traditional K-means, certain improvements have been made to the similarity measurement method, the determination of the optimal cluster K value, and the selection of the initial cluster centers to form the adaptive clustering algorithm of this article, making the result of clustering tissue segmentation closer to the result of manual tissue segmentation, which also lays the foundation for the subsequent automatic identification and classification of various tissue components in COT images.


## 2. Acquisition and Characterization of COT Images

### 2.1. Acquisition of COT Image

The COTs are the microstructures observed under a polarized light microscope with a magnification of 400-600 [27]. The micrograph acquisition process is shown Figure 1.Figure 1
The acquisition process of COT image.As shown in Figure1, first, the focal light film specimen was placed on a carrier plate with mastic and flattened, then placed on the loading platforms to focus and correct the center of the objective lens. Second, under the incident halogen light source, adjust the light source aperture and field of view aperture so that the brightness of the field of view in the evelens is moderate, the light is uniform, and the image is clear. Finally, use the AxioCam HRC CCD camera to capture the observed COT image, the light signal into electrical signals after the signal to form a digital image on the computer.


### 2.2. Characteristics of COTs

Typical COTs are isotropic, mosaic tissue (coarse grain, medium grain, and fine grain), fiber tissue, flake tissue, inert tissue, etc. (Figure2). Its morphological characteristics in the microscopic state are as follows:
(1)
Inert tissue: irregular shape, isochromatic region of orange or red in color, relatively gentle changes with light change(2)
Fiber tissue: brighter color with green, trip-like distribution, and certain continuity(3)
Mosaic tissue: small isochromatic regions, the large dispersion, and widely distributed(4)
Flake tissue: brighter color with thin edges, regular shape, small interconnection area, and good color consistencyFigure 2
Several common COT images: (a) fine-grained mosaic tissue; (b) medium-grained mosaic tissue; (c) coarse-grained mosaic tissue; (d) coarse-grained incomplete fiber tissue; (e) complete fiber tissue; (f) flake tissue.
(a)(b)(c)(d)(e)(f)


## 2.1. Acquisition of COT Image

The COTs are the microstructures observed under a polarized light microscope with a magnification of 400-600 [27]. The micrograph acquisition process is shown Figure 1.Figure 1
The acquisition process of COT image.As shown in Figure1, first, the focal light film specimen was placed on a carrier plate with mastic and flattened, then placed on the loading platforms to focus and correct the center of the objective lens. Second, under the incident halogen light source, adjust the light source aperture and field of view aperture so that the brightness of the field of view in the evelens is moderate, the light is uniform, and the image is clear. Finally, use the AxioCam HRC CCD camera to capture the observed COT image, the light signal into electrical signals after the signal to form a digital image on the computer.


## 2.2. Characteristics of COTs

Typical COTs are isotropic, mosaic tissue (coarse grain, medium grain, and fine grain), fiber tissue, flake tissue, inert tissue, etc. (Figure2). Its morphological characteristics in the microscopic state are as follows:
(1)
Inert tissue: irregular shape, isochromatic region of orange or red in color, relatively gentle changes with light change(2)
Fiber tissue: brighter color with green, trip-like distribution, and certain continuity(3)
Mosaic tissue: small isochromatic regions, the large dispersion, and widely distributed(4)
Flake tissue: brighter color with thin edges, regular shape, small interconnection area, and good color consistencyFigure 2
Several common COT images: (a) fine-grained mosaic tissue; (b) medium-grained mosaic tissue; (c) coarse-grained mosaic tissue; (d) coarse-grained incomplete fiber tissue; (e) complete fiber tissue; (f) flake tissue.
(a)(b)(c)(d)(e)(f)


## 3. Pixel Extraction of the Main Body in COT Image

The focal light film specimen was made by embedding toner into a transparent gel and curing, grinding, and polishing [28]. Since the gelatinous material does not reflect light when imaged under a polarizing microscope, COT images often consist of a darker background (pixels that are not in the main body) and colored pixels in the main body that reflects polarized light (Figure 2). In order to obtain each tissue from COT image more accurately, reduce the input of subsequent pixels, and improve the pertinence and effectiveness of clustering, the pixels of the main body that reflect polarized light should be segmented first.According to the characteristics of COTs, this paper proposed a tracking method based on contour level. The implicative relationship between the contours was used to obtain the contour of the pixels in the main body and then obtains the pixels in the main body. Meanwhile, according to the strategy of multiresolution, the contour of the main body is more holistic at smaller resolutions. Therefore, the algorithm first performs multiresolution decomposition of the COT image to ensure the integrity of the contour while improving the processing speed. The multiresolution decomposition in this paper is 0.25 times the original image size; in other words, the width and height of the image become half of the original size. The processing is shown in Figure3.Figure 3
Flowchart of the body in COT image extraction algorithm.


### 3.1. Adaptive Threshold Binarization

It can be seen from Figure2 that the main body of the COT image is brighter than the background area. In order to extract the brighter tissue in the main body from the darker background, the image needs to be presegmented. Commonly used image segmentation algorithms include threshold-based segmentation algorithms, such as fixed threshold segmentation, Otsu segmentation, and adaptive threshold binarization segmentation; edge detection-based segmentation algorithms, such as Canny edge detection algorithm; and region-based segmentation algorithms, such as watershed segmentation algorithm and morphology segmentation algorithm [29].It can be seen from Figure4 that the three traditional algorithms of Otsu, morphology, and watershed do not perform well in the segmentation of the main body in the COT image, and there are serious undersegmentation in the inert area at the upper left of the image (circled by the red ellipse). In contrast, the watershed algorithm performs better, but there is still a certain oversegmentation (circled by the red ellipse in Figure 4(f)) in the pore area. If the image was directly processed by the adaptive threshold algorithm, the entire main body will have a more serious undersegmentation (Figure 4(e)). In order to avoid the above problems, this paper introduces an adaptive threshold binarization segmentation algorithm, calculates the threshold value for each pixel separately, and averages the n×n pixels around the pixel point Pi,j to obtain the threshold value F^; then, the result of subtracting the threshold offset C from F^ is used as the threshold of the pixel [30], the schematic diagram of the binarization threshold was shown in Figure 5 which is
(1)Fi,j=F^i,j‐C.Figure 4
The segmentation effect of several traditional algorithms in the main body: (a) original; (b) Otsu; (c) morphological; (d) watershed; (e) fix threshold; (f) adaptive threshold.
(a)(b)(c)(d)(e)(f)Figure 5
Schematic diagram of binarization correspondence.There are two methods of averaging, one is the arithmetic average of local neighborhood blocks, the other is the weighted average of local neighborhood blocks, which replaces the original pixel grayscale with the weighted average of the pixel grayscale within the pixel neighborhood blocks [31].
(2)F^i,j=∑M,NPi,jQi,j,M,N,M,NI^I^Aij,where Qi,j,M,N is the weighted value corresponding to pixel M,N within neighborhood Aij and Pi,j is the central pixel value.A Gaussian weighted average algorithm was chosen, whose weightQi,j,M,N is a Gaussian transformation of the grayscale difference between these neighborhood pixels and the central pixel. The Gaussian function curve shape is similar to the general correlation function curve shape. So this is an ideal algorithm for averaging weighted characteristics.
(3)Qi,j,M,N=1/2πσ2e‐M‐i2+N‐j2/2σ2∑M,NI^I^Aij1/2πσ2e‐M‐i2+N‐j2/2σ2,M,NI^I^Aij.It can be seen from Figure6(b) that the COT image after adaptive threshold binarization still has denser noise in the main body. However, the pixel values of the nonmain body are basically the same. After morphological filtering, the noise of the main body has been suppressed to a certain extent.Figure 6
Image binarization: (a) original; (b) adaptive threshold binarization; (c) morphological filtering adaptive threshold binarization.
(a)(b)(c)


### 3.2. Contour Screening of the Main Body

The arriving image after adaptive threshold binarization and morphological filtering is the binarized image, where the contours are the continuous edge formed by the white pixels in the 8 neighborhoods of all black pixels in the binarized image. A topological analysis of an optically organized binarized image was performed, and a binarized image row scans to determine all contours and their hierarchical relationships. Since these contours have a one-to-one correspondence with the regions of the original image, they can be used to represent the original image [32].Figure7(a) is a line scan of a local binarized image of size 9×9 with one complete contour, where 1 indicates normalized white pixels and 0 indicates black pixels. Scan line by line from the first to the ninth line, if a pixel value of 0 is encountered in the scan, starting from the first neighboring pixel on the left, traverse all the pixels in its 8 neighborhoods clockwise. The pixel value of 1 is the contour pixel during traversa, which was shown by the green pixels in Figures 7(b) and 7(c).Figure 7
Binarized image lines scan to determine contour: (a) local binarized image pixel line scan; (b) third line scan; (c) seventh line scan.
(a)(b)(c)All contours can be obtained by performing the above process on the processed binarized image. Based on the connectivity of the contour region, the complete contours that emerge during the scan are numbered and recorded asCi. i is added with 1 each time a new contour was found, so that all contours in the binarized image can be obtained. Finally, the coordinates (pin,qin) of the ith contour pixel are stored in the corresponding set of contour Mi.
(4)Mi=pi1,qi1,pi2,qi2,pi3,qi3Lpin,qin.The contours extracted in the binarized image usually include small and incomplete edges, so it is necessary to filter out the noise contours and retain the contours of the main body. A contour hierarchy-based tracking method was proposed to analyze the contour hierarchy matrixHi and then use the connotation relationship between contours to obtain the contours of the main body in the COT image. The flowchart of the contour extraction algorithm is shown in Figure 8.Figure 8
Flow chart of the contour selection algorithm of the main body.Some of the contours may be inside some other contours, in which case the outer contours are referred to as the parent contours and the inner contours as the child contours, while some other contours have no containment relationship with each other and are of the same level as each other. This implication relation is the hierarchy of contours, which can be represented by the hierarchical matrix [32].Each hierarchical matrix is an array of four elementsAiBiCiDi, where Ai represents the serial number of the next contour in the same level, Bi represents the serial number of previous contour in the same level, Ci represents the serial number of its first child contour, and Di represents the serial number of its paternity contour. If the specified contour does not exist, it was indicated by -1.Analyze with the schematic diagram of the contour hierarchy in Figure9. The red number is the contour ordinal. The green number is the organizational, for example, the organization of contour 0 is 0, whose next contour in the same level is contour 4, there is no previous contour, the child contour is contour 1, and there is no parent contour, so its hierarchical matrix is [4 -1 1 -1]. The hierarchical matrices of the other contours are shown in Table 1.Figure 9
Schematic diagram of contour hierarchy.Table 1
Hierarchical matrix for all contours in Figure9.
Contour ordinalHierarchical matrix0[4 -1 1 -1]1[-1 -1 2 0]2[3 -1 -1 1]3[-1 2 -1 1]4[5 0 -1 -1]5[-1 4 -1 -1]Based on the characteristics of the contour image, it is known that all contours can be divided into three main categories, namely, the largest contour, the contours inside the largest contour, and the contours outside the largest contour.The algorithm proposed traverses the hierarchical matrixHi=AiBiCiDi of each contour and judges whether Di is -1. If Di is -1, it means that the contour has no parent contour, then the contour that meets this condition is the contour of the largest contour, and the same level of the largest contour of the third component Ci of the hierarchical matrix of these contours is the serial number of their first child contour, and then traverse the first two components Ai and Bi of these child contour hierarchical matrices to get other child contours of the same level contours. If Di is not -1, it means that the contour has a parent contour. Similarly, traverse the first two components Ai and Bi of this part of the contour to get all the child contours of this part of the contour. Finally, if both Di and Ci are -1, it means that this contour has neither a parent contour nor a child contour, and then, this part of the contours was directly discarded.Following the filtering rule above, the contours retained in Figure9 have ordinal numbers 0, 1, 2, and 3. That is the largest contour and the internal contour of the largest contour. All contours of the sample image were processed in the same way, and the results are shown in Figure 10(c).Figure 10
Pixel extraction of the main body in COT image: (a) all contours; (b) the largest contour marking; (c) the largest contour and internal contours; (d) contour of the main body; (e) match the original image; (f) pixels of the main body in COT image.
(a)(b)(c)(d)(e)(f)As can be seen from Figure10(c), there are still many small contours inside the largest contour. In combination with the COT image features, some of these internal contours are the contours of the main body in COT image, while others are noise contours in the main body. In order to obtain the pixels in the main body more completely, further filtering of the contours within the largest contour is required. Therefore, the contour coefficient βi is introduced from the point of view of the contour envelope area.
(5)βi=SiSmaxβi∈0,1.In formula (5), Si is the area of each contour, Smax is the envelope area of the largest contour, and set the appropriate contour retention confidence level η. If η≤βi, this contour was retained; otherwise, this contour was eliminated. As shown in Figure 10(d), the noise contours inside the largest contour are basically eliminated, leaving only part of the larger pore contours. These contours are the contours of the main body of the COT image. Match the contour of the main body with the original image, as shown in Figure 10(e); basically, all the pixels of the main body in the original image are selected. The segmentation of the main body in the original image was finally realized, and the segmentation result is shown in Figure 10(f).


## 3.1. Adaptive Threshold Binarization

It can be seen from Figure2 that the main body of the COT image is brighter than the background area. In order to extract the brighter tissue in the main body from the darker background, the image needs to be presegmented. Commonly used image segmentation algorithms include threshold-based segmentation algorithms, such as fixed threshold segmentation, Otsu segmentation, and adaptive threshold binarization segmentation; edge detection-based segmentation algorithms, such as Canny edge detection algorithm; and region-based segmentation algorithms, such as watershed segmentation algorithm and morphology segmentation algorithm [29].It can be seen from Figure4 that the three traditional algorithms of Otsu, morphology, and watershed do not perform well in the segmentation of the main body in the COT image, and there are serious undersegmentation in the inert area at the upper left of the image (circled by the red ellipse). In contrast, the watershed algorithm performs better, but there is still a certain oversegmentation (circled by the red ellipse in Figure 4(f)) in the pore area. If the image was directly processed by the adaptive threshold algorithm, the entire main body will have a more serious undersegmentation (Figure 4(e)). In order to avoid the above problems, this paper introduces an adaptive threshold binarization segmentation algorithm, calculates the threshold value for each pixel separately, and averages the n×n pixels around the pixel point Pi,j to obtain the threshold value F^; then, the result of subtracting the threshold offset C from F^ is used as the threshold of the pixel [30], the schematic diagram of the binarization threshold was shown in Figure 5 which is
(1)Fi,j=F^i,j‐C.Figure 4
The segmentation effect of several traditional algorithms in the main body: (a) original; (b) Otsu; (c) morphological; (d) watershed; (e) fix threshold; (f) adaptive threshold.
(a)(b)(c)(d)(e)(f)Figure 5
Schematic diagram of binarization correspondence.There are two methods of averaging, one is the arithmetic average of local neighborhood blocks, the other is the weighted average of local neighborhood blocks, which replaces the original pixel grayscale with the weighted average of the pixel grayscale within the pixel neighborhood blocks [31].
(2)F^i,j=∑M,NPi,jQi,j,M,N,M,NI^I^Aij,where Qi,j,M,N is the weighted value corresponding to pixel M,N within neighborhood Aij and Pi,j is the central pixel value.A Gaussian weighted average algorithm was chosen, whose weightQi,j,M,N is a Gaussian transformation of the grayscale difference between these neighborhood pixels and the central pixel. The Gaussian function curve shape is similar to the general correlation function curve shape. So this is an ideal algorithm for averaging weighted characteristics.
(3)Qi,j,M,N=1/2πσ2e‐M‐i2+N‐j2/2σ2∑M,NI^I^Aij1/2πσ2e‐M‐i2+N‐j2/2σ2,M,NI^I^Aij.It can be seen from Figure6(b) that the COT image after adaptive threshold binarization still has denser noise in the main body. However, the pixel values of the nonmain body are basically the same. After morphological filtering, the noise of the main body has been suppressed to a certain extent.Figure 6
Image binarization: (a) original; (b) adaptive threshold binarization; (c) morphological filtering adaptive threshold binarization.
(a)(b)(c)


## 3.2. Contour Screening of the Main Body

The arriving image after adaptive threshold binarization and morphological filtering is the binarized image, where the contours are the continuous edge formed by the white pixels in the 8 neighborhoods of all black pixels in the binarized image. A topological analysis of an optically organized binarized image was performed, and a binarized image row scans to determine all contours and their hierarchical relationships. Since these contours have a one-to-one correspondence with the regions of the original image, they can be used to represent the original image [32].Figure7(a) is a line scan of a local binarized image of size 9×9 with one complete contour, where 1 indicates normalized white pixels and 0 indicates black pixels. Scan line by line from the first to the ninth line, if a pixel value of 0 is encountered in the scan, starting from the first neighboring pixel on the left, traverse all the pixels in its 8 neighborhoods clockwise. The pixel value of 1 is the contour pixel during traversa, which was shown by the green pixels in Figures 7(b) and 7(c).Figure 7
Binarized image lines scan to determine contour: (a) local binarized image pixel line scan; (b) third line scan; (c) seventh line scan.
(a)(b)(c)All contours can be obtained by performing the above process on the processed binarized image. Based on the connectivity of the contour region, the complete contours that emerge during the scan are numbered and recorded asCi. i is added with 1 each time a new contour was found, so that all contours in the binarized image can be obtained. Finally, the coordinates (pin,qin) of the ith contour pixel are stored in the corresponding set of contour Mi.
(4)Mi=pi1,qi1,pi2,qi2,pi3,qi3Lpin,qin.The contours extracted in the binarized image usually include small and incomplete edges, so it is necessary to filter out the noise contours and retain the contours of the main body. A contour hierarchy-based tracking method was proposed to analyze the contour hierarchy matrixHi and then use the connotation relationship between contours to obtain the contours of the main body in the COT image. The flowchart of the contour extraction algorithm is shown in Figure 8.Figure 8
Flow chart of the contour selection algorithm of the main body.Some of the contours may be inside some other contours, in which case the outer contours are referred to as the parent contours and the inner contours as the child contours, while some other contours have no containment relationship with each other and are of the same level as each other. This implication relation is the hierarchy of contours, which can be represented by the hierarchical matrix [32].Each hierarchical matrix is an array of four elementsAiBiCiDi, where Ai represents the serial number of the next contour in the same level, Bi represents the serial number of previous contour in the same level, Ci represents the serial number of its first child contour, and Di represents the serial number of its paternity contour. If the specified contour does not exist, it was indicated by -1.Analyze with the schematic diagram of the contour hierarchy in Figure9. The red number is the contour ordinal. The green number is the organizational, for example, the organization of contour 0 is 0, whose next contour in the same level is contour 4, there is no previous contour, the child contour is contour 1, and there is no parent contour, so its hierarchical matrix is [4 -1 1 -1]. The hierarchical matrices of the other contours are shown in Table 1.Figure 9
Schematic diagram of contour hierarchy.Table 1
Hierarchical matrix for all contours in Figure9.
Contour ordinalHierarchical matrix0[4 -1 1 -1]1[-1 -1 2 0]2[3 -1 -1 1]3[-1 2 -1 1]4[5 0 -1 -1]5[-1 4 -1 -1]Based on the characteristics of the contour image, it is known that all contours can be divided into three main categories, namely, the largest contour, the contours inside the largest contour, and the contours outside the largest contour.The algorithm proposed traverses the hierarchical matrixHi=AiBiCiDi of each contour and judges whether Di is -1. If Di is -1, it means that the contour has no parent contour, then the contour that meets this condition is the contour of the largest contour, and the same level of the largest contour of the third component Ci of the hierarchical matrix of these contours is the serial number of their first child contour, and then traverse the first two components Ai and Bi of these child contour hierarchical matrices to get other child contours of the same level contours. If Di is not -1, it means that the contour has a parent contour. Similarly, traverse the first two components Ai and Bi of this part of the contour to get all the child contours of this part of the contour. Finally, if both Di and Ci are -1, it means that this contour has neither a parent contour nor a child contour, and then, this part of the contours was directly discarded.Following the filtering rule above, the contours retained in Figure9 have ordinal numbers 0, 1, 2, and 3. That is the largest contour and the internal contour of the largest contour. All contours of the sample image were processed in the same way, and the results are shown in Figure 10(c).Figure 10
Pixel extraction of the main body in COT image: (a) all contours; (b) the largest contour marking; (c) the largest contour and internal contours; (d) contour of the main body; (e) match the original image; (f) pixels of the main body in COT image.
(a)(b)(c)(d)(e)(f)As can be seen from Figure10(c), there are still many small contours inside the largest contour. In combination with the COT image features, some of these internal contours are the contours of the main body in COT image, while others are noise contours in the main body. In order to obtain the pixels in the main body more completely, further filtering of the contours within the largest contour is required. Therefore, the contour coefficient βi is introduced from the point of view of the contour envelope area.
(5)βi=SiSmaxβi∈0,1.In formula (5), Si is the area of each contour, Smax is the envelope area of the largest contour, and set the appropriate contour retention confidence level η. If η≤βi, this contour was retained; otherwise, this contour was eliminated. As shown in Figure 10(d), the noise contours inside the largest contour are basically eliminated, leaving only part of the larger pore contours. These contours are the contours of the main body of the COT image. Match the contour of the main body with the original image, as shown in Figure 10(e); basically, all the pixels of the main body in the original image are selected. The segmentation of the main body in the original image was finally realized, and the segmentation result is shown in Figure 10(f).


## 4. Color Space Transformation

RGB is a common model for displaying color images. In the RGB color space, R, G, B three components have strong correlation. So it is not good at color image segmentation and analysis. Therefore, it is necessary to select a more appropriate color space for clustering. Common color spaces include YUV, Lab, and HSV space. The HSV color space is more akin to the human emotional perception of color [33, 34], which encapsulates three pieces of information about the hue, brightness, and saturation of the color. Therefore, the pixels in the main body of COT image are transformed from RGB space to HSV space.From the distribution of normalized scatter plots of pixels of the main body in two different spaces in Figure11, it is obvious that the density distribution of pixels of the main body in HSV space is more suitable for the selection of clustering centers, and the degree of dissimilarity between clusters is more accurate.Figure 11
Color space transformation: (a) pixels of the main body in RGB space; (b) pixels of the main body in HSV space; (c) normalized scatter plot of pixels of the main body in RGB space; (d) normalized scatter plot of pixels of the main body in HSV space.
(a)(b)(c)(d)


## 5. Extraction of COTs Based on Adaptive Clustering

As can be seen from Figure2, different COTs will have different colors and morphology. We can sort out the different components by color. However, its color will be different for different lighting. So it is not suitable for segmentation with fixed color thresholds. To be more adaptable, the method of adaptive clustering with K-meanswas adopted to extract each COT. Convert the previously extracted pixels of the main body to in HSV space (Figure 11(b)) as the input of clustering. By dividing the pixels of the main body into K clusters, this results in a high degree of similarity within clusters and a low degree of similarity between clusters.K-means is an unsupervised learning algorithm proposed by MacQueen [35]. It is often used in image segmentation and has the advantages of being fast, simple, intuitive, and easy to implement [36]. Traditional K-means needs to manually determine the number of clusters K, which cannot accurately determine the number of optimal clustering centers. Besides, since the initial clustering center was selected randomly, the clustering process is prone to fall into the local optimal solution. If there are duplicate clustering centers, the clustering results will contain empty clusters, which will render the cluster results meaningless. In order to solve the shortcomings of traditional algorithms. This paper studies and proposes a K-means adaptive clustering algorithm, which was optimized from the similarity measurement method, the determination of the optimal cluster K value, and the selection of the initial cluster centers.


### 5.1. Similarity Measurement Method

The traditionalK-means algorithm generally uses the Euclidean distance as a measure of the distance between clustered pixels. The similarity between pixel sample xi=xih,xis,xiv and pixel sample xj=xjh,xjs,xjv is usually expressed by the Euclidean distance between them:
(6)dxi,xj=xih−xjh2+xis−xjs2+xiv−xjv2,where xi=xih,xis,xiv represents the data of three channels H, S, and V for pixel Xi.Obviously, the smaller the distance, the greater the similarity [37]. However, Euclidean distance does not distinguish the difference between different attributes of samples [38]. It also fails to include the influence of the population change and difference of samples in the distance size. So Mahalanobis distance was proposed to measure the similarity between samples instead of Euclidean distance. Mahalanobis distance is a method to calculate the similarity between two samples by covariance distance [39, 40]. Compared with Euclidean distance, it is not disturbed by the dimension and measurement scale of samples, while also removing the influence of intersample correlation.
(7)d∗xi,xj=xih−xjh,xis−xjs,xiv−xjvTM−1xih−xjh,xis−xjs,xiv−xjv.In formula (7), d∗xi,xj is the Mahalanobis distance between sample pixel i to j, xi=xih,xis,xiv and xj=xjh,xjs,xjv are the corresponding pixel values in the HSV space, and M is the covariance matrix of the samples. When i=j, the Mahalanobis distance d∗xi,xj satisfies the following conditions:
(8)d∗xi,xj≥0,d∗xi,xj=d∗xj,xi,d∗xi,xj≤d∗xi,xk+d∗xk,xj.


### 5.2. Determine the Optimal Cluster NumberK

As can be seen from the color distribution of coke microimages in HSV space, there are only some types of COTs in an image. In order to reduce the iteration time of the algorithm, the upper limit ofK is set to 6 in the process of searching the best cluster on color clustering. So the Calinski-Harabasz scores are introduced to evaluate each cluster [41]. The Calinski-Harbasz score is computed by assessing interclass and intraclass variance.
(9)SCH=SSEN−kSSMk−1.In formula (9), where k is the number of clusters, N is the number of training sets, SSE is the interclass variance, and SSM is the intraclass variance.
(10)SSE=trBk,Bk=∑i=1knici−cFci−cfT.In formula (10), where Bk is the interclass covariance matrix, trBk is the trace of the interclass covariance matrix, ci is the center of this class, and cf is for all data points.
(11)SSM=trMk,Mk=∑i=1k∑xix−cix−ciT.In formula (11), where Mk is the intraclass covariance matrix, trMk is the trace of the intraclass covariance matrix. By analyzing Equation (9), it can be seen that the global best-clustered K value is obtained at the highest SCH score.


### 5.3. Selection of Initial Cluster Centers

In order to overcome the shortcomings of randomly selecting the initial cluster centers in traditionalK-means clustering, this paper uses the maximum and minimum distance method to determine the cluster centers. The steps are as follows:
(1)
Extract a pixel value setN at equal intervals from the main body of the COT image obtained by the preliminary segmentation(12)N=N1,N2,N3,⋯Ni(2)
Extract any point in the setN as the first initial cluster center K1, and calculate the distance between K1 and other sample points, and take the point with the largest distance as the second cluster center K2(3)
For each remaining sample pointNj in the set N, calculate the distance dji from the existing cluster center Ni, and take mindji as the representative distance of the point Nj; select the sample point corresponding to the maximum value in mindji as the next cluster center(4)
Repeat the above steps and calculate theSCH score in the iterative process for each additional cluster center until the best cluster K value was found, and then, determine the attribution of each pixel in the main body of the COT image according to the principle of minimum distance


## 5.1. Similarity Measurement Method

The traditionalK-means algorithm generally uses the Euclidean distance as a measure of the distance between clustered pixels. The similarity between pixel sample xi=xih,xis,xiv and pixel sample xj=xjh,xjs,xjv is usually expressed by the Euclidean distance between them:
(6)dxi,xj=xih−xjh2+xis−xjs2+xiv−xjv2,where xi=xih,xis,xiv represents the data of three channels H, S, and V for pixel Xi.Obviously, the smaller the distance, the greater the similarity [37]. However, Euclidean distance does not distinguish the difference between different attributes of samples [38]. It also fails to include the influence of the population change and difference of samples in the distance size. So Mahalanobis distance was proposed to measure the similarity between samples instead of Euclidean distance. Mahalanobis distance is a method to calculate the similarity between two samples by covariance distance [39, 40]. Compared with Euclidean distance, it is not disturbed by the dimension and measurement scale of samples, while also removing the influence of intersample correlation.
(7)d∗xi,xj=xih−xjh,xis−xjs,xiv−xjvTM−1xih−xjh,xis−xjs,xiv−xjv.In formula (7), d∗xi,xj is the Mahalanobis distance between sample pixel i to j, xi=xih,xis,xiv and xj=xjh,xjs,xjv are the corresponding pixel values in the HSV space, and M is the covariance matrix of the samples. When i=j, the Mahalanobis distance d∗xi,xj satisfies the following conditions:
(8)d∗xi,xj≥0,d∗xi,xj=d∗xj,xi,d∗xi,xj≤d∗xi,xk+d∗xk,xj.


## 5.2. Determine the Optimal Cluster NumberK

As can be seen from the color distribution of coke microimages in HSV space, there are only some types of COTs in an image. In order to reduce the iteration time of the algorithm, the upper limit ofK is set to 6 in the process of searching the best cluster on color clustering. So the Calinski-Harabasz scores are introduced to evaluate each cluster [41]. The Calinski-Harbasz score is computed by assessing interclass and intraclass variance.
(9)SCH=SSEN−kSSMk−1.In formula (9), where k is the number of clusters, N is the number of training sets, SSE is the interclass variance, and SSM is the intraclass variance.
(10)SSE=trBk,Bk=∑i=1knici−cFci−cfT.In formula (10), where Bk is the interclass covariance matrix, trBk is the trace of the interclass covariance matrix, ci is the center of this class, and cf is for all data points.
(11)SSM=trMk,Mk=∑i=1k∑xix−cix−ciT.In formula (11), where Mk is the intraclass covariance matrix, trMk is the trace of the intraclass covariance matrix. By analyzing Equation (9), it can be seen that the global best-clustered K value is obtained at the highest SCH score.


## 5.3. Selection of Initial Cluster Centers

In order to overcome the shortcomings of randomly selecting the initial cluster centers in traditionalK-means clustering, this paper uses the maximum and minimum distance method to determine the cluster centers. The steps are as follows:
(1)
Extract a pixel value setN at equal intervals from the main body of the COT image obtained by the preliminary segmentation(12)N=N1,N2,N3,⋯Ni(2)
Extract any point in the setN as the first initial cluster center K1, and calculate the distance between K1 and other sample points, and take the point with the largest distance as the second cluster center K2(3)
For each remaining sample pointNj in the set N, calculate the distance dji from the existing cluster center Ni, and take mindji as the representative distance of the point Nj; select the sample point corresponding to the maximum value in mindji as the next cluster center(4)
Repeat the above steps and calculate theSCH score in the iterative process for each additional cluster center until the best cluster K value was found, and then, determine the attribution of each pixel in the main body of the COT image according to the principle of minimum distance


## 6. Experiments and Result Analysis

### 6.1. Preparation of Focal Film Specimen

The coal samples selected for this experiment came from four different batches of Saaji coal from the Central Research Institute of Baowu Group. A focal light film specimen should be prepared according to the provisions of China Coal Industry Association GB/T16773-2008 before taking the images. The carbon powder is embedded in a special mold of transparent unsaturated resin for curing. The diameter of the sample shall not be smaller than 22 mm; the volume of the cement must be less than 1/3. After curing, it is manually ground and polished until there are no obvious pitting or scratches under the 20x dry objective lens or oil immersion objective lens. A sample of the prepared focal light film specimen is shown in Figure12.Figure 12
A sample of the prepared focal light film specimen.Generally speaking, the magnification of the microscopic image is 400~600. In order to compromise, the magnification of the microscope in this article is 500. The experimental platform is shown in Figure13.Figure 13
Experimental platform and sample images.


### 6.2. Extracting Experiment of Pixels in the Main Body of COT Image

The hardware platform for this experiment is an Intel Core i7-6700HQ CPU, GTX950M with 8 GB of RAM. Extracting algorithm of pixels in the main body of COT image and adaptive clustering algorithm were both written in python.In the process of extracting the pixels of the main body of the image, this article selects 4 typical COT images from different batches of focal film specimen. Sample 1 is inert fibrous tissue, sample 2 is coarse-grained fibrous tissue, sample 3 is inert fibrous sheet-like tissue, and sample 4 is inert fibrous tissue. The image sizes are2752×2208, 1950×1523, 1300×1030, and 1300×1030, four sample images with different tissue components are selected for processing, and the results of the algorithm proposed and the traditional segmentation algorithm are compared with the results of manual segmentation of the pixels in the main body. The comparison result is shown in Figure 14.Figure 14
Different methods to extract the pixels of the main body: (a) original image; (b) Otsu algorithm; (c) morphological filtering; (d) watershed algorithm; (e) fix threshold; (f) adaptive threshold; (g) proposed.Further, in order to verify the segmentation effect of the algorithm proposed, we define a segmentation accuracyλ of the main part to evaluate, and its expression is as follows:
(13)λ=1−A−A∩B+B−A∩BAλ∈0,1,where B is the number of pixels of the main body segmented by the algorithm and A is the number of pixels of the main body of the artificially marked image. The larger the λ, the better the segmentation effect of the main body, since the algorithm proposed searches for the pixels of the main part at 0.25 times the original resolution; it is necessary to restore to the original size of the image and then perform the segmentation of the four algorithms. The values of A and B for each image are shown in Table 2, substituting the A and B values of each sample in Table 2 under different segmentation algorithms into formula (13) to obtain the corresponding segmentation accuracy of the main body part; the result is λ in Table 2.Table 2
Segmentation accuracy rateλ of the main body.
MethodSamplesABA∩BλMean ofλOtsuSample 1Sample 2Sample 3Sample 442821481660915543138654317245589610859864167365022552438937106914536974149461756.56%63.35%59.42%74.42%63.4375%MorphologySample 1Sample 2Sample 3Sample 4428214816609155431386543171441781579940136889172056143815457989613628417205633.50%34.91%24.98%26.30%29.9225%WateredSample 1Sample 2Sample 3Sample 442821481660915543138654317311190514128115079595721063066040136644143775655414870.53%79.48%67.67%91.95%77.4075%Fix thresholdSample 1Sample 2Sample 3Sample 442821481660915543138654317371330921475994740574930993567876163238640724348632379.92%67.26%62.68%73.29%70.7875%Adaptive thresholdSample 1Sample 2Sample 3Sample 44282148166091554313865431726843481397909575520621966218684482520136182237997739.45%15.20%27.27%21.09%25.7525%ProposedSample 1Sample 2Sample 3Sample 442821481660915543138654317419960816261175299146409484199608162345552818964094898.07%97.58%96.93%97.95%97.6352%It can be seen from Table2 that compared with the traditional algorithm, this method proposed has the best segmentation effect on the main body of the COT image among the six different methods, and the average segmentation accuracy is up to 97.6352%.


### 6.3. Adaptive Clustering Experiment

Perform traditionalK-means clustering and improved adaptive clustering on the extracted pixels of the main body. In order to make the clustering results more accurate, the algorithm proposed clusters the segmented body part at the original resolution, rather than at a lower resolution. Through a large number of observations, the upper limit of the COT type of each image is 4. Therefore, in order to further reduce the time used for clustering, the upper limit of the number of iterations K in each clustering process was set to 6; the Calinski-Harabasz score was used to evaluate the clustering effect to determine the best K value of clustering. During the clustering process, the K value and its Calinski-Harabasz evaluation score changes are shown in Figure 15.Figure 15
Clustering process under Calinski-Harabasz evaluation score: (a) traditionalK-means algorithm under Calinski-Harabasz evaluation score; (b) adaptive clustering process under Calinski-Harabasz evaluation score.
(a)(b)It can be seen from Figure15 that the horizontal axis is the cluster K value, and the vertical axis is the cluster score. For the Calinski-Harabasz score, the highest score corresponds to the best cluster K value. In the iterative process, the SCH score and clustering time data corresponding to the best K value are shown in Table 3.Table 3
Comparison of cluster-related parameters before and after improvement.
SampleTraditionalK-means clusteringAdaptive clusteringSCHBestK valueTime (s)SCHBestK valueTime (s)Sample 1282441.58313.6364976.3127.3Sample 2303055.97410.1329605.7624.2Sample 3182682.8436.5210946.2336.1Sample 4169756.1046.2326028.1423.6Mean××9.1××5.3It can be seen from Table3 that the traditional K-means clustering takes a long time to determine the best cluster K value under the evaluation of the Calinski-Harabasz score. The average clustering time for each image is 9.1 seconds, and the best K value obtained under this evaluation score is different from the number of tissue types in a single image, which will cause the tissues with basically the same color to be divided into multiple similar clusters, so it is also not suitable for segmentation of COTs.On the contrary, the optimalK value determined by the improved adaptive clustering under the evaluation of the Calinski-Harabasz score is consistent with the number of tissue types in the image itself. The algorithm running time for a single image is significantly reduced compared to the traditional K-means algorithm; the average running time of the algorithm for each image is 5.3 s.In order to compare the difference between the algorithm proposed and several other common clustering algorithms, traditionalK-means clustering, Meanshift clustering, and FCM clustering were performed on the main pixels of the four sample images. At the same time, in order to further improve the clustering of traditional algorithms for class segmentation effects, this article still clusters four typical sample images in the HSV space at the original resolution of the three traditional methods; the segmentation semantic map of different methods is shown in Figure 16.Figure 16
The clustering effect of several different methods: (a) the main body of the COT image; (b) traditionalK-means algorithm; (c) FCM algorithm; (d) Meanshift algorithm; (e) proposed method.From Figure16, to a large extent, it can be seen that the traditional K-means algorithm, FCM algorithm, and Meanshift algorithm will generate more classes than the actual number of organizations in the division of tissues. But the algorithm in this paper is consistent in the number of categories of tissue segmentation with the types of tissues contained in the original image, and the distribution of tissues is also roughly consistent with the results of manual segmentation.In order to quantitatively measure the segmentation effect of each method, we define the tissue segmentation accuracy rateΔ to represent the accuracy of the algorithm segmentation, and the expression of Δ is as follows:
(14)Δ=∑iPi∩Qi∑iQi,wherePi is the number of pixels of the ith tissue segmented by the algorithm in a picture and Qi is the artificial segmentation number of pixels of the corresponding tissue. The value of Δ evaluates the matching degree with the manual segmentation result. In the four algorithms, the artificial tissue segmentation results of each image are the same. The number of tissue types for samples 1, 2, and 4 is 2, the number of artificial tissue segmentation pixels for each tissue is Q1 and Q2, and the number of tissue types for sample 3 is 3, so the number of pixels for artificial tissue segmentation is Q1, Q2, and Q3, respectively. In the same way, each clustering pixel obtained by each clustering algorithm corresponds to the number of segmentation types, and the number of pixels Pi of each type was counted. The specific values of Pi and Qi of the 4 images under the 4 clustering algorithms are shown in Table 4.Table 4
Pi and Qi of the 4 images under the 4 clustering algorithms.
MethodSamplesP1P2P3Q1Q2Q3∑iPi∩Qi∑iQiK-meansSample 13490480603890—32106651034641—35824444245306Sample 21008768482352—1146766435362—12925321582128Sample 3271424113136188437198768109544163115420388471427Sample 4371987224016—325483291164—495447616647FCMSample 114500481807339—32106651034641—24162804245306Sample 2931334533578—1146766435362—12193511582128Sample 332723921475130979198768109544163115295024471427Sample 429153599034—325483291164—318147616647MeanshiftSample 128697951135788—32106651034641—34454434245306Sample 2658384463827—1146766435362—9035331582128Sample 33761891098346998198768109544163115225961471427Sample 4497606117300—325483291164—403948616647ProposedSample 130704461112857—32106651034641—40059454245306Sample 21124813501061—1146766435362—14867821582128Sample 3190605111880172324198768109544163115441146471427Sample 4339976295635—325483291164—588822616647Substituting the data in Table4 into formula (14) to obtain the corresponding tissue segmentation accuracy rate Δ, the results are shown in Table 5.Table 5
Comparison of the accuracy and running time of COT segmentation of several different clustering algorithms.
SampleK-meansFCMMeanshiftProposedΔTime (s)ΔTime (s)ΔTime (s)ΔTime (s)Sample 184.39%13.656.92%56.881.16%58.494.36%7.3Sample 281.70%10.177.07%31.557.11%42.393.97%4.2Sample 389.17%6.562.58%15.147.93%32.193.58%6.1Sample 480.35%6.251.59%14.665.51%28.395.49%3.6Mean83.9025%9.162.0400%29.562.9275%40.294.3500%5.3From Table5, it can be seen that the traditional K-means algorithm, Meanshift algorithm, and FCM algorithm are different in the tissue segmentation accuracy of the 4 sample images. The average tissue segmentation accuracy are 83.9025% (K-means), 62.0400% (FCM), and 62.9275% (Meanshift). The adaptive clustering algorithm proposed has the highest segmentation accuracy Δ of the COTs, with an average segmentation accuracy of 94.3500%, and the running time of the algorithm proposed is much lower than that of the other three clustering methods. The average segmentation time of each image is 5.3 seconds.


## 6.1. Preparation of Focal Film Specimen

The coal samples selected for this experiment came from four different batches of Saaji coal from the Central Research Institute of Baowu Group. A focal light film specimen should be prepared according to the provisions of China Coal Industry Association GB/T16773-2008 before taking the images. The carbon powder is embedded in a special mold of transparent unsaturated resin for curing. The diameter of the sample shall not be smaller than 22 mm; the volume of the cement must be less than 1/3. After curing, it is manually ground and polished until there are no obvious pitting or scratches under the 20x dry objective lens or oil immersion objective lens. A sample of the prepared focal light film specimen is shown in Figure12.Figure 12
A sample of the prepared focal light film specimen.Generally speaking, the magnification of the microscopic image is 400~600. In order to compromise, the magnification of the microscope in this article is 500. The experimental platform is shown in Figure13.Figure 13
Experimental platform and sample images.


## 6.2. Extracting Experiment of Pixels in the Main Body of COT Image

The hardware platform for this experiment is an Intel Core i7-6700HQ CPU, GTX950M with 8 GB of RAM. Extracting algorithm of pixels in the main body of COT image and adaptive clustering algorithm were both written in python.In the process of extracting the pixels of the main body of the image, this article selects 4 typical COT images from different batches of focal film specimen. Sample 1 is inert fibrous tissue, sample 2 is coarse-grained fibrous tissue, sample 3 is inert fibrous sheet-like tissue, and sample 4 is inert fibrous tissue. The image sizes are2752×2208, 1950×1523, 1300×1030, and 1300×1030, four sample images with different tissue components are selected for processing, and the results of the algorithm proposed and the traditional segmentation algorithm are compared with the results of manual segmentation of the pixels in the main body. The comparison result is shown in Figure 14.Figure 14
Different methods to extract the pixels of the main body: (a) original image; (b) Otsu algorithm; (c) morphological filtering; (d) watershed algorithm; (e) fix threshold; (f) adaptive threshold; (g) proposed.Further, in order to verify the segmentation effect of the algorithm proposed, we define a segmentation accuracyλ of the main part to evaluate, and its expression is as follows:
(13)λ=1−A−A∩B+B−A∩BAλ∈0,1,where B is the number of pixels of the main body segmented by the algorithm and A is the number of pixels of the main body of the artificially marked image. The larger the λ, the better the segmentation effect of the main body, since the algorithm proposed searches for the pixels of the main part at 0.25 times the original resolution; it is necessary to restore to the original size of the image and then perform the segmentation of the four algorithms. The values of A and B for each image are shown in Table 2, substituting the A and B values of each sample in Table 2 under different segmentation algorithms into formula (13) to obtain the corresponding segmentation accuracy of the main body part; the result is λ in Table 2.Table 2
Segmentation accuracy rateλ of the main body.
MethodSamplesABA∩BλMean ofλOtsuSample 1Sample 2Sample 3Sample 442821481660915543138654317245589610859864167365022552438937106914536974149461756.56%63.35%59.42%74.42%63.4375%MorphologySample 1Sample 2Sample 3Sample 4428214816609155431386543171441781579940136889172056143815457989613628417205633.50%34.91%24.98%26.30%29.9225%WateredSample 1Sample 2Sample 3Sample 442821481660915543138654317311190514128115079595721063066040136644143775655414870.53%79.48%67.67%91.95%77.4075%Fix thresholdSample 1Sample 2Sample 3Sample 442821481660915543138654317371330921475994740574930993567876163238640724348632379.92%67.26%62.68%73.29%70.7875%Adaptive thresholdSample 1Sample 2Sample 3Sample 44282148166091554313865431726843481397909575520621966218684482520136182237997739.45%15.20%27.27%21.09%25.7525%ProposedSample 1Sample 2Sample 3Sample 442821481660915543138654317419960816261175299146409484199608162345552818964094898.07%97.58%96.93%97.95%97.6352%It can be seen from Table2 that compared with the traditional algorithm, this method proposed has the best segmentation effect on the main body of the COT image among the six different methods, and the average segmentation accuracy is up to 97.6352%.


## 6.3. Adaptive Clustering Experiment

Perform traditionalK-means clustering and improved adaptive clustering on the extracted pixels of the main body. In order to make the clustering results more accurate, the algorithm proposed clusters the segmented body part at the original resolution, rather than at a lower resolution. Through a large number of observations, the upper limit of the COT type of each image is 4. Therefore, in order to further reduce the time used for clustering, the upper limit of the number of iterations K in each clustering process was set to 6; the Calinski-Harabasz score was used to evaluate the clustering effect to determine the best K value of clustering. During the clustering process, the K value and its Calinski-Harabasz evaluation score changes are shown in Figure 15.Figure 15
Clustering process under Calinski-Harabasz evaluation score: (a) traditionalK-means algorithm under Calinski-Harabasz evaluation score; (b) adaptive clustering process under Calinski-Harabasz evaluation score.
(a)(b)It can be seen from Figure15 that the horizontal axis is the cluster K value, and the vertical axis is the cluster score. For the Calinski-Harabasz score, the highest score corresponds to the best cluster K value. In the iterative process, the SCH score and clustering time data corresponding to the best K value are shown in Table 3.Table 3
Comparison of cluster-related parameters before and after improvement.
SampleTraditionalK-means clusteringAdaptive clusteringSCHBestK valueTime (s)SCHBestK valueTime (s)Sample 1282441.58313.6364976.3127.3Sample 2303055.97410.1329605.7624.2Sample 3182682.8436.5210946.2336.1Sample 4169756.1046.2326028.1423.6Mean××9.1××5.3It can be seen from Table3 that the traditional K-means clustering takes a long time to determine the best cluster K value under the evaluation of the Calinski-Harabasz score. The average clustering time for each image is 9.1 seconds, and the best K value obtained under this evaluation score is different from the number of tissue types in a single image, which will cause the tissues with basically the same color to be divided into multiple similar clusters, so it is also not suitable for segmentation of COTs.On the contrary, the optimalK value determined by the improved adaptive clustering under the evaluation of the Calinski-Harabasz score is consistent with the number of tissue types in the image itself. The algorithm running time for a single image is significantly reduced compared to the traditional K-means algorithm; the average running time of the algorithm for each image is 5.3 s.In order to compare the difference between the algorithm proposed and several other common clustering algorithms, traditionalK-means clustering, Meanshift clustering, and FCM clustering were performed on the main pixels of the four sample images. At the same time, in order to further improve the clustering of traditional algorithms for class segmentation effects, this article still clusters four typical sample images in the HSV space at the original resolution of the three traditional methods; the segmentation semantic map of different methods is shown in Figure 16.Figure 16
The clustering effect of several different methods: (a) the main body of the COT image; (b) traditionalK-means algorithm; (c) FCM algorithm; (d) Meanshift algorithm; (e) proposed method.From Figure16, to a large extent, it can be seen that the traditional K-means algorithm, FCM algorithm, and Meanshift algorithm will generate more classes than the actual number of organizations in the division of tissues. But the algorithm in this paper is consistent in the number of categories of tissue segmentation with the types of tissues contained in the original image, and the distribution of tissues is also roughly consistent with the results of manual segmentation.In order to quantitatively measure the segmentation effect of each method, we define the tissue segmentation accuracy rateΔ to represent the accuracy of the algorithm segmentation, and the expression of Δ is as follows:
(14)Δ=∑iPi∩Qi∑iQi,wherePi is the number of pixels of the ith tissue segmented by the algorithm in a picture and Qi is the artificial segmentation number of pixels of the corresponding tissue. The value of Δ evaluates the matching degree with the manual segmentation result. In the four algorithms, the artificial tissue segmentation results of each image are the same. The number of tissue types for samples 1, 2, and 4 is 2, the number of artificial tissue segmentation pixels for each tissue is Q1 and Q2, and the number of tissue types for sample 3 is 3, so the number of pixels for artificial tissue segmentation is Q1, Q2, and Q3, respectively. In the same way, each clustering pixel obtained by each clustering algorithm corresponds to the number of segmentation types, and the number of pixels Pi of each type was counted. The specific values of Pi and Qi of the 4 images under the 4 clustering algorithms are shown in Table 4.Table 4
Pi and Qi of the 4 images under the 4 clustering algorithms.
MethodSamplesP1P2P3Q1Q2Q3∑iPi∩Qi∑iQiK-meansSample 13490480603890—32106651034641—35824444245306Sample 21008768482352—1146766435362—12925321582128Sample 3271424113136188437198768109544163115420388471427Sample 4371987224016—325483291164—495447616647FCMSample 114500481807339—32106651034641—24162804245306Sample 2931334533578—1146766435362—12193511582128Sample 332723921475130979198768109544163115295024471427Sample 429153599034—325483291164—318147616647MeanshiftSample 128697951135788—32106651034641—34454434245306Sample 2658384463827—1146766435362—9035331582128Sample 33761891098346998198768109544163115225961471427Sample 4497606117300—325483291164—403948616647ProposedSample 130704461112857—32106651034641—40059454245306Sample 21124813501061—1146766435362—14867821582128Sample 3190605111880172324198768109544163115441146471427Sample 4339976295635—325483291164—588822616647Substituting the data in Table4 into formula (14) to obtain the corresponding tissue segmentation accuracy rate Δ, the results are shown in Table 5.Table 5
Comparison of the accuracy and running time of COT segmentation of several different clustering algorithms.
SampleK-meansFCMMeanshiftProposedΔTime (s)ΔTime (s)ΔTime (s)ΔTime (s)Sample 184.39%13.656.92%56.881.16%58.494.36%7.3Sample 281.70%10.177.07%31.557.11%42.393.97%4.2Sample 389.17%6.562.58%15.147.93%32.193.58%6.1Sample 480.35%6.251.59%14.665.51%28.395.49%3.6Mean83.9025%9.162.0400%29.562.9275%40.294.3500%5.3From Table5, it can be seen that the traditional K-means algorithm, Meanshift algorithm, and FCM algorithm are different in the tissue segmentation accuracy of the 4 sample images. The average tissue segmentation accuracy are 83.9025% (K-means), 62.0400% (FCM), and 62.9275% (Meanshift). The adaptive clustering algorithm proposed has the highest segmentation accuracy Δ of the COTs, with an average segmentation accuracy of 94.3500%, and the running time of the algorithm proposed is much lower than that of the other three clustering methods. The average segmentation time of each image is 5.3 seconds.


## 7. Conclusions

Since the COT image is composed of a bright main body and a dark nonbody, if the pixels of the main body are not extracted, the pixel input of the clustering algorithm will be very large, which will affect the timeliness of the clustering. Therefore, the concept of contour hierarchical matrix is introduced, and then, the hierarchical relationship between contours and the contour area coefficient are used to extract the pixels of the main body of the tissue to achieve presegmentation. The segmentation accuracy of traditional algorithms in the main body of the COT image is Otsu (63.4375%), morphology (29.9225%), watered (77.4075%), fix threshold (70.7875%), and adaptive threshold (25.7525%). But the segmentation accuracy of the main body of the algorithm proposed is as high as 97.6352%. Compared with these algorithms, the algorithm proposed has the highest degree of completeness in the segmentation of the main body of the COT image.The main body pixels obtained by presegmentation are transformed into HSV space, and adaptive clustering is performed on the basis of the original resolution of the image. The accuracy of the three traditional clustering segmentation algorithms in the main body of the tissue segmentation isK-means (83.9025%), FCM (62.0400%), and Meanshift (62.9275%). However, the tissue segmentation accuracy of adaptive clustering proposed is as high as 94.3500%, and the average processing time of a single image is 5.3 s. Compared with the traditional clustering algorithms, the processing speed of the algorithm proposed is faster, the accuracy of tissue segmentation is the highest, and it is closer to the result of manual segmentation, which provides the basis for the subsequent recognition of various COTs.



---

*Source: 4378823-2021-10-19.xml*