Keywords

1 Introduction

In the computer vision and image analysis, it has been the key point as how to effectively segment objects out of image. All kinds of segment algorithms have been proposed by many scholars, which could be basically divided into three categories. Category 1, named as threshold algorithm, which segments objects utilizing the whole or partial of the image. This knowledge is generally presented by histogram graphics. This tool is very popular and the easiest segment method characterized by fast speed processing and low cost. The threshold algorithm could automatically determine the threshold value, which generally includes the P rate threshold algorithm, histogram contour analysis threshold algorithm and the optimal threshold algorithm, etc. [1]. The determination of threshold value and noise in the image signal will directly impact the efficiency of segmentation. Category 2, contour-based segment, which replies on the detector to locate the image peripheral and the located peripheral, presents the discontinuity of images in regard to gray value, color and stripe. Methods are commonly used to include threshold of image contour, blurry contour and Hough exchange segmentation, etc. Yet this segmentation may probably lead to errors like creating contours that do not exist and with missing image boundary that is supposed to be there. These errors are due to the noisy signal or other unnecessary signals in the useful image signals. Category 3, region-based segment, it satisfies the conditions of complete segmentation and conformity of maximum region. It features the ability of robustness to image noise signals. Methods are widely used to include region merge, region split, automatic seeded region growing, etc. This methodology of segmentation may probably cause image distortion due to non-perfect parameter configuration like under growing (excessive regions) or over growing (short regions). Different characteristics could be utilized for algorithms of contour-based segmentation and region-based segmentation like brightness, stripe and velocity field. For the automatic seeded region growing algorithm, many scholars introduce the pyramid and quad crossing data structure to describe the image and thus achieve good outcome of segmentation. But there’s a drawback for the pyramid data structure and quad data structure to describe the image as they heavily rely on the orientation, location and the relative size of object [2]. It may end up with pretty different demonstrations of pyramid or quad data crossing format for two similar images with little difference or even two images of same description with the minor background changing. Recently, some scholars propose the idea of clustering algorithm to segment gray-valued image, and the experimental results are very positive, yet the initial classification of the sample base and the selection of sample points will greatly affect the outcome of segmentation. The effective color image segmentation based on the improved K-means clustering algorithm is presented in this article, first of all the coarse segmentation is executed to extract the targeted area utilizing the optimal threshold algorithm, the next step is to mark the continuity of segmented area in order to identify the contour of the maximum-sized continuity area, finally the targeted area is precisely segmented by the means of the improved K-means clustering algorithm. For those excessively small-area images leftover during the process, a merge methodology is introduced to deal with over-segmented images. And experiments have shown that this theory is very effective to segment natural images and proves to be very positive and exciting [3, 4]. Furthermore, it shows its robustness to noisy signals [5, 6].

2 The Optimal Threshold Algorithm

The optimal threshold algorithm is to have probability density function of two or more normal distributions approximately represent the image histogram, the threshold value is the closet gray value of lest probability of the maximum value of the two or more normal distributions and it results the most accurate segmentation. The general segmentation for the optimal threshold is by the means of iteration methodology to get the best segmentation of images, the initial threshold value is

$$ T^{0} = {{\left( {f_{1} + f_{m} } \right)} \mathord{\left/ {\vphantom {{\left( {f_{1} + f_{m} } \right)} 2}} \right. \kern-0pt} 2} $$
(63.1)

The \( f_{1} \) represents the min gray value, \( f_{m} \) represents the max gray value.

The threshold value \( T^{k} \) of the \( k{\text{th}} \) iteration will separate the image into two parts, target image and background image, thus the mean gray value of \( f_{0} \) and \( f_{B} \) can be calculated per below formula [7, 8],

$$ f_{0} = \frac{{\sum\limits_{{f(i,j) < T^{k} }} {f(i,j) \times W(i,j)} }}{{\sum\limits_{{f(i,j) < T^{k} }} {W(i,j)} }} $$
(63.2)
$$ f_{B} = \frac{{\sum\limits_{{f(i,j) > T^{k} }} {f(i,j) \times W(i,j)} }}{{\sum\limits_{{f(i,j) > T^{k} }} {W(i,j)} }} $$
(63.3)

The \( f(i,j) \) represents the gray value of point \( (i,j) \) in the image, the \( W(i,j) \) represents the weighted coefficient of point \( (i,j) \). If the \( (k + 1){\text{th}} \) iteration threshold value of version 1.0 is \( T^{k + 1} \).

$$ T^{k + 1} = {{\left( {f_{0} + f_{B} } \right)} \mathord{\left/ {\vphantom {{\left( {f_{0} + f_{B} } \right)} 2}} \right. \kern-0pt} 2} $$
(63.4)

3 The Mark of Image Pixel of Continuity Region

If the image is shared by many regions using the threshold segmentation, it is necessary to have them marked in order to extract them. The effective and simple way to mark the segmented binary image in the different region is to check the continuity between each individual pixel and the adjacent pixels. Scan the binary images from left to right and from top to bottom, if the gray value of pixel is 1, mark it as objected pixel of continuity, and if it shares the continuity with two or more objects they will be treated as same ones and connects them all. But if during the process of scan, the gray value of 0 is identified, a new object mark would be added. The method of eight-region continuity is adopted in this article, check the left and top side of the pixel and two adjacent pixels of top diagonal [911]. The scan will start from the first row and will only look at the continuity of adjacent pixel on the left of the current pixel, then just look at the continuity of adjacent pixel on the top of the first column of the current pixel, finally it will scan the last column continuity of adjacent pixels both on the left and on the top of the current pixel.

4 The Improved K-means Clustering Algorithm

The optimal threshold algorithm is adopted in the RGB space of the colorful image to get the binary value of R, G and B space individually, then identify the binary continuity of image region by the use of eight-region continuity method and determine the maximum region’s external contour by locating the coordinates of leftmost, rightmost, topmost and bottommost pixel. Locate the maximum regional contour and classify it by evenly dividing the region into fine sub-regions, calculate the means for the five sub-regions by following formula,

$$ m_{ij} = \frac{1}{N}\sum\limits_{{y_{j} \in \xi }} {y_{j} } \quad (i = 1, \ldots ,4,5;\,j = r,g,b) $$
(63.5)

\( m_{ij} \) represents the mean value of the \( i{\text{th}} \) sub-region under the \( j{\text{th}} \) space, \( N_{i} \) represents the number of pixels, \( y_{j} \) represents the pixel gray value under the \( j{\text{th}} \) space, \( \tau_{ij} \) represents the scope of the \( i{\text{th}} \) sub-region under the jth space. For example, \( m_{2r} \) represents the mean value of the second sub-region under the \( r{\text{th}} \) color space.

The distance measurement in between each pixel and mean \( m_{ij} \) of each external contour is described per following formula,

$$ J_{i} = \sum {||y_{j} - m_{ij} ||}^{2} \quad (i = 1,2,3,4,5;\,j = r,g,b) $$
(63.6)

\( y_{j} \) represents the gray value of external contour under the jth space.

When the \( J_{i} \) is the minimum among the five ones, classify the current one into the category \( C_{i} \) and then dynamically adjust the clustering center by following formula,

$$ m_{ij} = \frac{1}{{N_{i} }}\sum\limits_{{y_{j} \in C_{i} }} {y_{j} } \quad (i = 1, \ldots ,4,5;j = r,g,b) $$
(63.7)

\( N_{i} \) represents the number of pixels in the category \( C_{i} \), when \( N_{i} \) is less than the threshold value set the \( N_{i} \) as infinity and merge the category quantity accordingly.

5 Processing of Image Signals Identified as Tiny Region

For those excessively small-area images leftover during the process of segmentation, they can be treated as noise and less important signals. They might be reorganized and merged into the adjacent regions per following steps:

  1. 1.

    Search for the smallest image region \( R_{\hbox{min} } \).

  2. 2.

    Locate the closest one \( \left( R \right) \) among the adjacent clustering center regions according to the center of \( R_{\hbox{min} } \) and merge the \( R_{\hbox{min} } \) into \( R \).

  3. 3.

    Repeat steps 1 and 2 till all tiny regions are merged whose sizes are less than the predetermined scale.

6 Experiment Analysis

The methodology of iterated coarse segmentation in the color image space of RGB which is presented in this article will lead to the extraction of the maximum subregion and reduce the amount of the clustering center of the targeted areas, which is very helpful to precisely segment images by the adoption of the K-means dynamic clustering algorithm. This experiment is divided into non-noise images segmentation and adding “Salt and Pepper” and “gaussian” noise image segmentation. The number of continuity region of binary images in the Fig. 63.1 and in the Fig. 63.2 is 19 and 9, respectively. It segments the images for the each connected region accurately by the use of K-means dynamic clustering algorithm and merges the leftover tiny-sized images into the adjacent regions according to Euclidean distance finally. Here is the experimental result and analysis.

Fig. 63.1
figure 1

Experimental result contrast. a Original image. b The algorithm of region grow. c The C-means clustering algorithm. d Method in this article

Fig. 63.2
figure 2

Noise image segment. a Original image. b The K-means clustering algorithm. c Method in this article

Figure 63.1 analyzes the way how the clustering algorithm decides and classifies the sample and the key sample point’s selection will greatly affect the segmentation result. It is obvious that there is still a partial background image in the picture c of Fig. 63.1 after the C-means clustering algorithm segmentation. For the picture b in the Fig. 63.1, it is clear that the object image contour is not completely segmented out of the background image using the algorithm of region grow and in this case the over grow problem arises(two objects in the bottom left corner are connected to each other). This is because there is always a possibility of over grow or under grow if the parameter configuration is not to optimal for the segmentation algorithm based on the region grow. The picture d is the experiment result using the algorithm presented in this article and much better compared with the other two.

Figure 63.2 analyzes that partial background images may not be completely segmented using the algorithm presented in this article when noisy signal is mixed, but the algorithm presented in the article is able to completely segment the two small flowers in the bottom left corner compared with the clustering algorithm, so it shows the robustness to noise signal.

7 Conclusions

In this article, it presents the coarse segmentation of the color image to identify the maximum subordinate target region, then implements the accurate segmentation based on the K-means clustering algorithm. The experiments have proved better performance using this methodology, but it will take more time if there are many and small-sized sub-targets in the color image. The future research will be focused on the real-time segmentation of color image.