You are on page 1of 7

Anil Z Chitade et. al. / International Journal of Engineering Science and Technology Vol.

2(10), 2010, 5319-5325

COLOUR BASED IMAGE SEGMENTATION USING K-MEANS CLUSTERING


ANIL Z CHITADE
Department of civil Engineering, MANIT, Bhopal Bhopal-51, Madhyapradesh, India anilchitade@manit.ac.in http://manit.ac.in

DR. S.K. KATIYAR


Department of civil Engineering, MANIT, Bhopal Bhopal-51,Madhyapradesh,India http://manit.ac.in Abstract: Primarily due to the progresses in spatial resolution of satellite imagery, the methods of segment-based image analysis for generating and updating geographical information are becoming more and more important. This work presents a novel image segmentation based on colour features with K-means clustering unsupervised algorithm. In this we did not used any training data. The entire work is divided into two stages. First enhancement of color separation of satellite image using decorrelation stretching is carried out and then the regions are grouped into a set of five classes using K-means clustering algorithm. Using this two step process, it is possible to reduce the computational cost avoiding feature calculation for every pixel in the image. Although the colour is not frequently used for image segmentation, it gives a high discriminative power of regions present in the image. Keywords: Spatial Resolution, Image segmentation, K-means, Satellite Image, Pixel. 1. Introduction: In remote sensing, the process of image segmentation is defined as: the search for homogenous regions in an image and later the classification of these regions. It also means the partitioning of an image into meaningful regions based on homogeneity or heterogeneity criteria (Haralick et al; 1992). Image segmentation techniques can be differentiated into the following basic concepts: pixel oriented, Contour-oriented, region-oriented, modeloriented, colour oriented and hybrid (M.Neubert,et al; 2005). Colour segmentation of image is a crucial operation in image analysis and in many computer vision, image interpretation, and pattern recognition system, with applications in scientific and industrial field(s) such as medicine, Remote Sensing, Microscopy, contentbased image and video retrieval, document analysis, industrial automation and quality control ( Ricardo Dutra, et al;2008). The performance of colour segmentation may significantly affect the quality of an image understanding system (H.S.Chen et al; 2006).The most common features used in image segmentation include texture, shape, grey level intensity, and colour.The constitution of the right data space is a common problem in connection with segmentation/classification. In order to construct realistic classifiers, the features that are sufficiently representative of the physical process must be searched. In the literature, it is observed that different transforms are used to extract desired information from remote-sensing images or biomedical images (Mehmet Nadir Kurnaz et al; 2005).Segmentation evaluation techniques can be generally divided into two categories (supervised and unsupervised). The first category is not applicable to remote sensing because an optimum segmentation (ground truth segmentation) is difficult to obtain. Moreover, available segmentation evaluation techniques have not been thoroughly tested for remotely sensed data. Therefore, for comparison purposes, it is possible to proceed with the classification process and then indirectly assess the segmentation process through the produced classification accuracies. (Ahmed Darwish, et al; 2003). For image segment based classification, the images that need to be classified are segmented into many homogeneous areas with similar spectrum information firstly, and the image segments features are extracted based on the specific requirements of ground features classification. The color homogeneity is based on the standard deviation of the spectral colors, while the shape homogeneity is based on the compactness and

ISSN: 0975-5462

5319

Anil Z Chitade et. al. / International Journal of Engineering Science and Technology Vol. 2(10), 2010, 5319-5325 smoothness of shape. There are two principles in the iteration of parameters:1) In addition to necessary fineness, we should choose a scale value as large as possible to distinguish different regions; 2) we should use the color criterion where possible. Because the spectral information is the most important in imagery data, the quality of segmentation would be reduced in high weightiness of shape criterion. This work presents a novel image segmentation based on colour features from the images. In this we did not used any training data and the work is divided into two stages. First enhancing color separation of satellite image using decorrelation stretching is carried out and then the regions are grouped into a set of five classes using K-means clustering algorithm. Using this two step process, it is possible to reduce the computational cost avoiding feature calculation for every pixel in the image. Although the colour is not frequently used for image segmentation, it gives a high discriminative power of regions present in the image. The present work is organized as follows: Section 2 describes the data resources and software used. Section 3 describes the enhancing color separation of satellite image using decorrelation stretching. Section 4 describes the K-means clustering method. In section 5 the proposed method of segmentation of image based on colour with K-means clustering is presented and discussed. Experimental results obtained with suggested method are shown in section 6. Finally, section 7 concludes with some final remarks. 2. Data Resources and Software used For this research purpose we used fused image combining IRS Cartosat-1 and LISS-III using discrete wavelength transform technique. The images are of parts of Bhopal city, the capital of Madhya Pradesh, India. The entire work is carried out using MatLab v7.5, Erdas-Imaginev9.1, and MS-Office. 3. De-correlation Stretching De-correlation stretching enhances the color separation of an image with significant band-to-band correlation. The exaggerated colors improve visual interpretation and make feature discrimination easier. We apply decorrelation stretching with the de-corrstretch function. The number of color bands, NBANDS, in the image is taken three. But we can apply de-correlation stretching regardless of the number of color bands. The original color values of the image are mapped to a new set of color values with a wider range. The color intensities of each pixel are transformed into the color eigenspace of the NBANDS-by-NBANDS covariance or correlation matrix, stretched to equalize the band variances, and then transformed back to the original color bands. To define the band wise statistics, we can use the entire original image, with the subset option, or any selected subset of it. 4. K-Means Clustering There are many methods of clustering developed for a wide variety of purposes. Clustering algorithms used for unsupervised classification of remote sensing data vary according to the efficiency with which clustering takes place (John R Jenson, 1986).K-means is the clustering algorithm used to determine the natural spectral groupings present in a data set. This accepts from analyst the number of clusters to be located in the data. The algorithm then arbitrarily seeds or locates, that number of cluster centers in multidimensional measurement space. Each pixel in the image is then assigned to the cluster whose arbitrary mean vector is closest. The procedure continues until there is no significant change in the location of class mean vectors between successive iterations of the algorithms (Lillesand and Keiffer, 2000). As K-means approach is iterative, it is computationally intensive and hence applied only to image subareas rather than to full scenes and can be treated as unsupervised training areas (Lillesand & Keiffer, 2000). The typical iteration sequence for the net migration of the cluster means is shown in fig 1.

ISSN: 0975-5462

5320

Anil Z Chitade et. al. / International Journal of Engineering Science and Technology Vol. 2(10), 2010, 5319-5325

Fig 1: The typical iteration sequence for the net migration of the cluster means

5. Color-Based Segmentation Using K-Means Clustering The basic aim is to segment colors in an automated fashion using the L*a*b* color space and K-means clustering. The entire process can be summarized in following steps Step 1: Read the image Read the image from mother source which is in .JPEG format, which is a fused image of part of Bhopal city of Madhya Pradesh, India with DWT fusion algorithm of Cartosat-1 and LISS-IV of Indian satellite IRS-P6 and IRS-1D. Step 2: For colour separation of an image apply the Decorrelation stretching Step 3: Convert Image from RGB Color Space to L*a*b* Color Space How many colors do we see in the image if we ignore variations in brightness? There are three colors: white, blue, and pink. We can easily visually distinguish these colors from one another. The L*a*b* color space (also known as CIELAB or CIE L*a*b*) enables us to quantify these visual differences.The L*a*b* color space is derived from the CIE XYZ tristimulus values. The L*a*b* space consists of a luminosity layer 'L*', chromaticity-layer 'a*' indicating where color falls along the red-green axis, and chromaticity-layer 'b*' indicating where the color falls along the blue-yellow axis. All of the color information is in the 'a*' and 'b*' layers. We can measure the difference between two colors using the Euclidean distance metric. Convert the image to L*a*b* color space. Step 4: Classify the Colors in 'a*b*' Space Using K-Means Clustering Clustering is a way to separate groups of objects. K-means clustering treats each object as having a location in space. It finds partitions such that objects within each cluster are as close to each other as possible, and as far from objects in other clusters as possible. K-means clustering requires that you specify the number of clusters to be partitioned and a distance metric to quantify how close two objects are to each other. Since the color information exists in the 'a*b*' space, your objects are pixels with 'a*' and 'b*' values. Use K-means to cluster the objects into three clusters using the Euclidean distance metric. Step 5: Label Every Pixel in the Image Using the Results from K-MEANS For every object in our input, K-means returns an index corresponding to a cluster.Label every pixel in the image with its cluster index. Step 6: Create Images that Segment the Image by Color. Using pixel labels, we have to separate objects in image by color, which will result in five images.

ISSN: 0975-5462

5321

Anil Z Chitade et. al. / International Journal of Engineering Science and Technology Vol. 2(10), 2010, 5319-5325 Step 7: Segment the Nuclei into a Separate Image Then programmatically determine the index of the cluster containing the blue objects because Kmeans will not return the same cluster_idx value every time. We can do this using the cluster center value, which contains the mean 'a*' and 'b*' value for each cluster. 6. Experimental Results The various experiment carried out on the above said imagery in MATLAB v7.5. The complete process and the standard results are summarized in subsequent figure2.

2.b.De-coreltion Stretch image,2.c.Object in Cluster one, 2.d. Object in Cluster two,2.e.Object in Cluster three,2.f. Object in Cluster four, 2.g. Object in Cluster five, 2.h. Clustered index image, 2.i. Nucle of cluster one, 2.j. Nucle of cluster two,2.k. Nucle of cluster three, 2.l. Nucle of cluster four,2.m. Nucle of cluster five ( Nomenclature from upper left to right)
Fig 2: The Results of colour segmentation

ISSN: 0975-5462

5322

Anil Z Chitade et. al. / International Journal of Engineering Science and Technology Vol. 2(10), 2010, 5319-5325 The code written in MATLAB is self explanatory and given below: %% % Reading and displaying image % he = imread('C:\Documents and Settings\Administrator\Desktop\color_segmentation\test.jpg'); imshow(he), title('LISS 4 + CARTOSAT 1 fused image'); text(size(he,2),size(he,1)+15,... 'Image courtesy of RS and GIS , Civil Engg, MANIT Bhopal,INDIA', ... 'FontSize',7,'HorizontalAlignment','right'); %% % Creating color transformation from sRGB to L*a*b % cform = makecform('srgb2lab'); % Applying above color transform to the sRGB image % lab_he = applycform(he,cform); % Converting into double % ab = double(lab_he(:,:,2:3)); % obtaining rows and columns of transformed image % nrows = size(ab,1); ncols = size(ab,2); % Reshaping image taking each value column wise % ab = reshape(ab,nrows*ncols,2); % No of clusters to be created with five iterations % nColors = 5; [cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...'Replicates',5); % Reshaping and showing the clusters % pixel_labels = reshape(cluster_idx,nrows,ncols); imshow(pixel_labels,[]), title('image labeled by cluster index'); %% % creating five element array % segmented_images = cell(5); % Creating tiles for three different colors % rgb_label = repmat(pixel_labels,[1 1 3]); % Assigning clustered objects to array(segmented_image) % for k = 1:nColors color = he; color(rgb_label ~= k) = 0; segmented_images{k} = color; end %% % displaying different cluster objects % imshow(segmented_images{1}), title('objects in cluster 1'); %% imshow(segmented_images{2}), title('objects in cluster 2'); %% imshow(segmented_images{3}), title('objects in cluster 3'); %% imshow(segmented_images{4}), title('objects in cluster 4'); %% imshow(segmented_images{5}), title('objects in cluster 5'); %% % Evaluating mean of all cluster centers % mean_cluster_value = mean(cluster_center,2); % Sorting the mean cluster array and storing sorted index in idx %

ISSN: 0975-5462

5323

Anil Z Chitade et. al. / International Journal of Engineering Science and Technology Vol. 2(10), 2010, 5319-5325 [tmp, idx] = sort(mean_cluster_value); %% n1_cluster_num = idx(1); L = lab_he(:,:,1); n1_idx = find(pixel_labels == n1_cluster_num); L_n1 = L(n1_idx); is_light_n1 = im2bw(L_n1,graythresh(L_n1)); nuclei_labels = repmat(uint8(0),[nrows ncols]); nuclei_labels(n1_idx(is_light_n1==false)) = 1; nuclei_labels = repmat(nuclei_labels,[1 1 3]); n1_nuclei = he; n1_nuclei(nuclei_labels ~= 1) = 0; imshow(n1_nuclei), title('n1 nuclei'); %% n2_cluster_num = idx(2); L = lab_he(:,:,1); n2_idx = find(pixel_labels == n2_cluster_num); L_n2 = L(n2_idx); is_light_n2 = im2bw(L_n2,graythresh(L_n2)); nuclei_labels = repmat(uint8(0),[nrows ncols]); nuclei_labels(n2_idx(is_light_n2==false)) = 1; nuclei_labels = repmat(nuclei_labels,[1 1 3]); n2_nuclei = he; n2_nuclei(nuclei_labels ~= 1) = 0; imshow(n2_nuclei), title('n2 nuclei'); %% n3_cluster_num = idx(3); L = lab_he(:,:,1); n3_idx = find(pixel_labels == n3_cluster_num); L_n3 = L(n3_idx); is_light_n3 = im2bw(L_n3,graythresh(L_n3)); nuclei_labels = repmat(uint8(0),[nrows ncols]); nuclei_labels(n3_idx(is_light_n3==false)) = 1; nuclei_labels = repmat(nuclei_labels,[1 1 3]); n3_nuclei = he; n3_nuclei(nuclei_labels ~= 1) = 0; imshow(n3_nuclei), title('n3 nuclei'); %% n4_cluster_num = idx(4); L = lab_he(:,:,1); n4_idx = find(pixel_labels == n4_cluster_num); L_n4 = L(n4_idx); is_light_n4 = im2bw(L_n4,graythresh(L_n4)); nuclei_labels = repmat(uint8(0),[nrows ncols]); nuclei_labels(n4_idx(is_light_n4==false)) = 1; nuclei_labels = repmat(nuclei_labels,[1 1 3]); n4_nuclei = he; n4_nuclei(nuclei_labels ~= 1) = 0; imshow(n4_nuclei), title('n4 nuclei'); %% n5_cluster_num = idx(5); L = lab_he(:,:,1); n5_idx = find(pixel_labels == n5_cluster_num);

ISSN: 0975-5462

5324

Anil Z Chitade et. al. / International Journal of Engineering Science and Technology Vol. 2(10), 2010, 5319-5325 L_n5 = L(n5_idx); is_light_n5 = im2bw(L_n5,graythresh(L_n5)); nuclei_labels = repmat(uint8(0),[nrows ncols]); nuclei_labels(n5_idx(is_light_n5==false)) = 1; nuclei_labels = repmat(nuclei_labels,[1 1 3]); n5_nuclei = he; n5_nuclei(nuclei_labels ~= 1) = 0; imshow(n5_nuclei), title('n5 nuclei'); 5. Conclusion Using color based image segmentation; it is possible to reduce the computational cost avoiding feature calculation for every pixel in the image. Although the color is not frequently used for image segmentation, it gives a high discriminative power of regions present in the image. This kind of image segmentation may be used for mapping the changes in land use land cover taken over temporal period in general but not in particular. References
Ahmed Darwish, et al, Image Segmentation for the Purpose Of Object-Based Classification,, 2003 IEEE,pp 2039-2041 Darren MacDonald,et al; Evaluation of colour image segmentation hierarchies, Proceeding of the 3rd Canadian conference on computer and Robot Vision, IEEE, 2006, pp -[3] H C Chen et al, Visible color difference-based quantitative evaluation of colour segmentation,IEEE proceeding ,Vis image signal process vol.153 No.5 Oct 2006 pp 598-609. [4] Jean-Christophe Devaux et al; Aerial colour image segmentation by Karhunen-Loeve transform, 0-7695-0750-6, IEEE 2000, pp 309312. [5] Jun Tang, A color image segmentation algorithm based on region growing, 978-1-4244-6349-7, IEEE, vol 6, 2010, pp 634-637 [6] Mehmet Nadir Kurnaz,et al; Segmentation of remote-sensing images by incremental neural network, Pattern Recognition Letters 26 (2005) 10961104, pp 1096-1103. [7] N Bartneck et al; Colour segmentation with polynomial classification,0-8186-2915-0/92, 1992, pp 635-638. [8] Nae-Joung Kwak et al; color image segmentation using edge and adaptive threshold value based on the image characteristics,IEEE proceeding0-7803-8639-6,2004, pp 555-558. [9] Lingkui Meng, et al, Study on Image Segment Based Land Use Classification and Mapping, 2009 IEEE, pp [10] Pal N.R.et al; A review on image segmentation techniques, Pattern Recognition 26(9), 1993, pp1277-1294. [11] Ricardo Dutra da Silva et al; Satellite image segmentation using wavelet transforms based on color and texture features, ISVC 2008, part II, LNCS 5359, 2008, pp 113-122 [12] Robert A Schowengerdt, Remote sensing- models and Methods for Image Processing, IIIrd edition, Elsevier Inc. [1] [2]

ISSN: 0975-5462

5325