# I. Introduction ith the impetuous improvement in the digital technology, digital image play very significant role in modern era with its rapidly uses at medical sector and the visualization sector. Digital image can be described as a large number array of discrete dots where each dot has a brightness level associated with it. These dots are simply represents as pixels or picture elements. Image segmentation is defined as; "the search for homogeneous regions in an image and later the classification of these images". Segmentation signifies the partition of an image into different objects or connected regions that do not overlap. Highly use of Real world image segmentation issues have multiple objectives like reduce overall deviation, maximize property, reduce the options or reduce the error rate of the classifier. In image processing, it is still not very clear to measure whether one algorithm express more accurate segmentation than another, whether it be for related image, particular image or set of images, or more usually, for a whole class of each images [4]. The modern researches on digital image segmentation generally use K-means clustering algorithm which doesn't express best results but after some elevation of K-means algorithm, it could express the results better. In this paper, the combined segmentation of RGB and HSV color spaces give more accurate segmentation result compared to segmentation of single color space our main objectives while segmenting images of different kind like using the RGB color space where we wanted to get rid of different intensity level of the same color shade which is not satisfied. Hence, we thought of another representation to color images the HSV color space which will ease our solution to segmentation Pattern Recognition and Image Analysis MacQueen J proposed some methods for classification and analysis of multivariate observations. Y. Li and Y. Shen done a great job about Robust image segmentation algorithm using fuzzy clustering based on kernel-induced distance measure whereas D. E. Ilea Clustering (also called unsupervised learning) is the method of partitioning a data-set into various groups. Sometimes the members of every group are as similar (close) as probable to one another, and sometimes different groups are as dissimilar (far) as possible from one another [9]. Clustering can discover previously unperceived relationships in a data set. There are various applications for cluster analysis. Cluster analysis can be used to discover and distinguish customer segments for marketing purposes. In Biology, it uses at alignment of plants and animals given their features. Not only that it can also be used in pattern recognition spatial data analysis, image processing etc. [20] In other words, clustering means collection of data or distribution a large data set into smaller data sets of some similarity [5]. An important appearance in clustering is how to designate the similarity between individual objects, Clusters can be made from objects with the possibility of high similarity within clusters and low similarity between clusters [7]. Commonly, to measure similarity or dissimilarity between objects there are many popular methods, such as Euclidean, Manhattan and Minkowski are used. A distance function executes a lower value for similar objects that are more similar to one another. Requirements of good cluster: ? The ability to discover some or all of the hidden clusters also handle high dimensionality. ? Within-cluster similarity and between-cluster dissimilarity and Scalable, Interpretable and usable ? Ability to deal with various types of attributes, can deal with noise and outliers. Hierarchical Clustering is a set of nested clusters organized as a hierarchical tree and on the other hand Partitioning Clustering is a division data objects into non-overlapping subsets (clusters) such that each data object is in exactly one subset [4]. The k-means algorithm works like to cluster "n" number of objects based on characteristic into k partitions, where k < n. Simply speaking it is an algorithm to group or to classify objects based on their corresponding features into K number of group. Here K is always positive integer number [16]. In general, the group is created based on minimizing the sum of distances between the corresponding clusters centroid and data [5] [11]. # c) Basic Steps of K -Means Clustering Algorithm Given n objects, choose k number of clusters to be determined. Choose k objects randomly as the initial cluster. Assign each object to their closest cluster center. Update the center of each cluster (Calculate mean points) until no changes on cluster centers (i.e. Centroids do not change location any more). A number of other strategies stands for verifying K, including cross-verify, information criteria, the information the silhouette procedure, theoretic jump procedure and also the G-means algorithm. In addition, monitoring the classification of data points across various groups provides acumen into how the algorithm is partitioning the data for each K. # d) Choosing "K" of K -Means Clustering Algorithm The algorithm described over discovers the clusters and data set labels for an individual pre-chosen K. To discover the number of clusters in the data, the user needs to operate the K-means clustering algorithm for a range of K values and compare the outcomes. In general, there is no procedure for recognizing exact value of K [18]. # Figure 4: Elbow Point Example One of the metrics that is generally used to compare outcomes across several values of K is the mean distance between data points and their cluster centroid. Since increasing the number of clusters will always maximize this metric and minimize the distance to data points to the ultimate of reaching zero when K is the same as the number of data points. Thus, this metrics cannot be used as the absolute target. # e) HSV Color Space HSV color space will be more compatible for conduct with segmentation of rough color images. We can describe HSV color space with the help of a hex cone with three extensions where the middle vertical axis describes the intensity [level 18]. Here H represents Hue. Basically Hue is an angle, which range is [0,2 ?] comparative to angle 0 at red axis, 2 ?/3 at green axis, 4?/3 at blue axis and red again at 2?. S represents Saturation, which represents how authentic the hue is with respect to a white section. This can be concern of as the depth or integrity of color and is measured as a long range distance from the middle axis with properties between 0 at the center to 1 at the outer surface [13]. While, for a given intensity and hue, if the saturation is qualified from 0 to 1, the comprehend color switch from a shade of gray to the most authentic form of the color represented by its hue. Diagrammatic view is given below [5]: V represents Value which percentage is between 0 to 100. This percentage range can be concern as the amount of light expressing a color. For example, the value is high and when the hue is red, the color seems bright. On the other hand, it looks dark when the value is low. Following figures show the HSV converted image of the original image [5]: RGB color space is also called additive color space, which can be described well based on the RGB color model [10]. Three chromaticity's is represented by a particular RGB color space which includes the red, green, and blue additive primaries, and also generate any chromaticity with a triangle which represented by Year 2017 ( ) F those fundamental colors. A gamma correction curve and a white point chromaticity also requires for the total specification of an RGB color space [12]. Three colored lights for red, green, and blue are produced and described from An RGB color space, for example, shining three lights together onto a white wall in a dark room: one red light, one green light, and one blue light, each with dimmers. If only the red light is on, the wall will be red. If only the green light is on, the wall will look green. If the red and green lights are on together, the wall will look yellow. Dim the red light and the wall will become more of a yellow-green. Dim the green light instead, and the wall will become more orange. Typical RGB input devices are color TV and video cameras, image scanners, video games, and digital cameras. # IV. Methodology To generate the best practical segmentation, we intend to use images with known characteristics, where most popular use about the segmentation is color. Our aim is to find out an amusing way to segment the image by the colors with the k means clustering algorithm, which includes mapping the image pixels to the RGB color space and HSV color space (i.e. if pixel 4, 5 holds the values red: 50, green: 30, blue: 20, we map it to the point (50, 30, 20) on a 3d space representing the RGB and HSV values). Our proposed function works like to adjust the input to the format of k means procedure for expects to get and ran a few tests. Our motivation was to keep the k parameter as small as possible to estimate the right k automatically for the algorithm. For that, we had to keep different intensity levels of the same color on the same segment; for example trying to keep light green and dark green in the same segment. Our basic supposition for this part of the work, was that whether given a data set of n clusters, when we operate K means algorithm with parameter k=m (Where m>n). The centers which is created by the algorithm would be closer to each other than if we ran the algorithm with the parameter k=n (the actual number of clusters). So the minimum distance between the cluster centers would decrease. # Figure 9: Proposed Technique of RGB Color Segmentation To reduce the K parameter, we start with a high value of K, and iteration ally reducing it, until we go an indicated condition, which normally has to do with the minimum distance between the centers of the segmentation resulted by the k-means algorithm. For calculate the sample values of RGB and HSV we used Matlab. Of the colors we wanted to separate, we tried to take the algorithm to a point where it wouldn't accumulate those colors under the corresponding segment. If we consider the minimum distance between the colors then we can use a condition that will force the k to be small enough that the various segments generated will be at least as far from one another, as the various colors of the game play world, we won't get a segment with colors "close to one another". We confined heavily on our basic supposition, associated with hope that various intensity of the same color may be closer to one another, after decreasing K value and increases the minimum distance our proposed algorithm is ends. Basically various "shades" of the same color are multiplication by a constant of a basic vector in the RGB space. If in the data set there are several clusters, each one representing several intensity level of the color. Our main goal is to get rid of various intensity level of the same color hue. Hence, the illustration to color images the HSV color space which will comfort our solution to segmentation [8]. The HSV color space has several parameters for the HUE, SATURATION and VALUE (intensity) of the pixel, and so we get instinctive access to the actual hue of the pixel, without any concerns about several intensity level. # V. Performance Results # a) Performance Matrices We discovered that even though the K-Means algorithm does a great job, but when we tried to make the process automatic with the right automatic K, even though we were in a restricted world of images, the process wasn't easy, and obviously our results are not perfect, but not too far away. On images of unknown source, the problem becomes much harder. So we proposed an algorithm to minimize the K parameter by itself, at the beginning of time it starts with high value of K, and then iteration ally reducing it, until we meet a certain condition, which generally has to do with the minimum distance between the centers of the segmentation. Now, the problem is to choose a condition which will make the algorithm stop and calculate the "right" k. We can easily fix this certain condition based on our knowledge of the game play images, like the colors existing in the world. On fruit ninja game play image we sampled the different colors from all the individual fruits in the game, and using the minimum distance between the fruits as a starting point for a terminating condition. We noticed with this result, the perceive areas to be segment and assigned to in the result. The background got divided to two segments. Here someone can argue that if we segment the image based only on colors, but we wanted it to be a good pre-processing for a later by object recognition algorithm. But as we started implementing this method, we realized that there is much simpler solution. Hence, we thought of another representation to color images the HSV color space which will ease our solution to segmentation. The HSV color space has different parameters for the HUE, the SATURATION and the VALUE (intensity) of the pixel. Again, the fully automatic algorithm isn't perfect, the usage of the minimum distance condition isn't enough to accurately estimate the K parameter but we do ideas on how to improve it. In the restricted world of game play images, HSV based segmentation did much better than the RGB version. The fact that we can ignore the pixels intensity level opened up a way to clearly segment the picture based on hue only, which, in this scenario specifically is very good. Year 2017 ( ) F No representation is better than the other though we wanted to emphasize this fact, so we provide examples from real world images; there HSV color space to eliminate different intensities of the same hue isn't performing too well, as opposed to RGB. # b) Working Results when HSV is better than RGB The major step we did was the HSV color space to get a clearer segmentation view to us, for better out come in the future we like to add the K recognition feature which still requires work to be fully functional. Here is several samples of the results we achieved, with some annotations: From the figure number 12 and 13 we get a clear view that our proposed K-means clustering algorithm give better output on Game play images and also can segment properly without giving any human hints of find out the number of "K." # c) Working Results when RGB is better than HSV Segmentation by colors generally show a very perfect sense of the picture, and can be a decent preprocessing for stages like object visualization. The role of segmentation is authentic in most tasks requiring image analysis. The success or failure of the process is often a direct result of the success or failure of segmentation. However, an authentic and exact segmentation of an image is, in general, very difficult to acquire by purely automatic means. Considering the pros and cons of the main algorithm used (K-Means Clustering) and the fact that segmentation can be understand differently by different people, we set our minds to several goals. When we worked with Real world Images our RGB results were so much better than HSV Color Space method. We got proper segmentations. Here some results are given below: For the segmentation we have proposed the idea of k means clustering algorithm which involves mapping the image pixel to the RGB color space and HSV color space. We proposed some function to set the input to the format the k-means iteration expects, and ran few tests where the outputs were quite impressive [8]. For keeping the k parameter as small as possible, to estimate the right k automatically for the algorithm, we had to keep various intensity levels of the color on the same segment. We know that different "shades" of the same color (different intensities) are basically multiplication by a constant of a basic vector in the RGB space. The most disadvantage of our excessive usage of k-means clustering is that it means we would have to think of a k every time, which really not the perfect way because we would like to proposed the algorithm to solve this by own. Therefore we attempted to get the K automatically and so express segmentation without any user giving "hints" to the algorithm. As we explained before, for these scenarios (Game play images), RGB isn`t Performing exceptionally well. # d) Comparison between optimal K-Means and Automated K-Means Algorithom For the scenario (Game play images), RGB isn`t Performing well. If the color set is known then for the same color hue we don't need to give different Segments to different intensity levels, K-Means algorithm on the HSV color space does more impressive job. From below example we can easily compare the K value between Optimal K-Means and our Automated K-Means at RGB and HSV Color space. On RGB color space, the optimal K value and the Automated K value was not so close. So on game play images, our proposed automated K-Means algorithm could not provide impressive result; On the other hand when we worked with automated K-Means on HSV Color space, we got the K value so much closer with optimal K-Means value. So most of the times it gave us impressive result and also achieved our goal. But it is difficult to say HSV result is all time better than RGB result with our proposed automated K-Means algorithm. Although K-means algorithm does comparatively better task but the process commits little bit ambiguous while we have try to choose the actual k. We efficient about various ways to select the right "K" for the algorithm, like G-Means clustering, which uses statistics and hypotheses about the data to calculate the K, and X-means algorithm which didn't supposed to give a result that would glut [2]. So we tried to make the method instinctive, even though we were in a strict world of images, the work is not easy and accurate but not impossible by any means. When worked with RGB color space, our proposed technique is not gave us suitable result. The optimal K value and the automated K value is quite difference. Work with normal K-means algorithm has quite few problems regarding the color segmentation of images that it we would have to think of "K" each time for segmentation result, which is one of the biggest disadvantage of k-means clustering algorithm. Basically it doesn't make too much intuition because we would like to do algorithm to execute this by own. When we worked with HSV Color space, the optimal K vale and the automated K value is quite same which assure us that our automated K-means algorithm performed better at HSV color space. # VI. Conclusion and Future Work We discovered that even though the K-Means algorithm does a great job, the fact that we have to Year 2017 ( ) F choose a k makes using it a bit problematic. When we tried to make the process automatic but the job wasn't easy, and obviously our results are not perfect, but not too far away. The characteristics which we use for our working procedure is color: As most of us know, the different figures in the game are fruits, which usually have very different colors, and so segmentation by colors usually gives a very correct feel of objects, and can be a good preprocessing for stages like object recognition. We found the numbers we used to terminate the reduction of K based on samplings from game play images and manipulations on the results, general pictures are not supposed to work this way. However we wanted to emphasize the fact that no representation is better than the other. In the restricted world of Game play images, HSV based segmentation did much better than the RGB version. The fact that we can ignore the pixels intensity level opened up a way to clearly segment the picture based on hue only, which, in this scenario specifically is very good. HSV representation is not better generally all the time, because for real world images, the RGB representation gave us better outcomes which show us about the importance of having different representations of the same object. Those methods we implemented that did not get the best performance. We tried to get the right K but it was so much difficult for us to detect it. We only worked with RGB color pace and HSV color space. We tried to get best result with RGB and HSV color space with our automated K-Means algorithm but all time we did not get best result from our proposed algorithm. Not only that, it was so much difficult to get the right K from our proposed algorithm. In future we will try to modify our proposed automated K-Means algorithm to get the accurate K all time at all color space. Now we only worked with two color space but in future we will like to work with more color space like CMYK, L*a*b, YCBCR, HSL etc. after work with these color spaces we can easily compare which will be best for image segmentation. 1![Figure 1: Segmentation Technique with automated "K"](image-2.png "Figure 1 :") ![and P. F. Whelan gave a complete overview about Color image segmentation using a spatial k-means clustering algorithm. N. R. Pal and S. K. Pal gave A review on image segmentation techniques and Pattern Recognition in their paper and H. C. Chen and S. J. Wang works with Visible color difference-based quantitative evaluation of color segmentation, III. Description of Image Segmentation Features a) Clustering](image-3.png "") 2![Figure 2: Partioning and Hierarchical Clusteringb) K-Means ClusteringThe k-means algorithm works like to cluster "n" number of objects based on characteristic into k partitions, where k < n. Simply speaking it is an algorithm to group or to classify objects based on their corresponding features into K number of group. Here K is always positive integer number[16]. In general, the group is created based on minimizing the sum of distances between the corresponding clusters centroid and data[5] [11].](image-4.png "Figure 2 :") 3![Figure 3: Procedures of K-Means Clustering Algorithm](image-5.png "Figure 3 :") 5![Figure 5: HSV Color Space](image-6.png "Figure 5 :") 6![Figure 6: Sample to HSV Converted Resultf) RGB Color SpaceA color image f?RN×3 is made of three independent images, one for each channel red, green and blue which is called RGB color space[11]. Here Size N= n×n of the image; where n = 256; N = n*n. RGB is the most widely used color space, that each color image is combination of three different images, those are Red image, Blue image and black image[12].](image-7.png "Figure 6 :") 7![Figure 7: RGB Color Space](image-8.png "Figure 7 :") 8![Figure 8: Sample to RGB Converted Result](image-9.png "Figure 8 :") 10![Figure 10: Proposed Technique of HSV Color Segmentation](image-10.png "Figure 10 :") 11![Figure 11: Sample Image from Fruit-Ninja Game](image-11.png "Figure 11 :") 12![Figure 12: HSV Result with Automated K after Color Segmentation](image-12.png "Figure 12 :") 13![Figure 13: RGB Result with Automated K after Color Segmentation](image-13.png "Figure 13 :") 14![Figure 14: HSV Result on Fish image after Color Segmentation We know about the importance of having different representations of the same object, and how each one opens up a world of tools to use on it, lets you get a part of the information easily, while hiding some of the redundant information.](image-14.png "Figure 14 :") 15![Figure 15: HSV Result on Bird image after Color Segmentation](image-15.png "Figure 15 :") 16![Figure 16: RGB Result on Flower image after Color Segmentation](image-16.png "Figure 16 :") 17![Figure 17: RGB Result on Fruit image after Color Segmentation](image-17.png "Figure 17 :") 18![Figure 18: Optimal and Automated K value on RGB](image-18.png "Figure 18 :") 19![Figure 19: Optimal and Automated K value on HSV](image-19.png "Figure 19 :") © 2017 Global Journals Inc. (US) * A Physical Approach to Color Image Understanding GudrunJKlinker StevenAShafer TakeoKanade International Journal of Computer Vision 4 1 738 1990 * Color based image segmentation using kmeans clustering Anil Z Chitade International Journal of Engineering science and Technology 2 10 2010 * RCGonzalez REWoods Digital Image Processing Addison-Wesley 1993 * Introduction to Data Mining Tan Steinbach Kumar 4/18/2004 * Color Image Segmentation using ERKFCM CMythili VKavitha International Journal of Computer Applications 41 20 March 2012 * Comparing the Performance of L*A*B* and HSV Color Spaces with Respect to Color Image Segmentation International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com Dibya Jyoti Bora1, Anil Kumar Gupta2, Fayaz Ahmad Khan3 2250-2459 9001 2 2008. February 2015 Certified Journal * A review on image segmentation techniques with remote sensing perspective Yzang IAPRS July 5-7, 2010 IAPRS. XXXVIII * Bacteria foraging based image segmentation NavneetKaur An International Journal of Engineering Sciences 2229-6913 6 July 2012 * Locating Text in Complex Color Images RajeshwarDass KZhong Karu Image Segmentation Techniques" IJECT 3 1 Jan. -March 2012. October 1995 Pattern Recognition * Principal Manifolds for Data Visualization and Dimension Reduction MPena WBarbakh CFyfe chapter TopologyPreserving Mappings for Data Visualization Springer 2007. 2007 * An Introduction to Digital Image Processing with Matlab Notes for SCM2511 Image Processing 1 AMcandrew 2004 School of Computer Science and Mathematics, Victoria University * BlancaNpMarques P ;Pina SSingh MSingh CApte PPerner Estoril Pattern Recognition and Image Analysis Portugal 2005. 2005 * KardiTeknomo -K Mean ClusteringTutorial * Least squares quantization in pcm SPLloyd IEEE Transactions on Information Theory 28 1957. 1957 Bell Laboratories Technical note Published in 1982 in * KardiTeknomo -K Mean ClusteringTutorial Teknomo . K-Means ClusteringKardi Tutorials * Genetic Kmeans algorithm KKrishna MMNarasimha IEEE Trans. on Systems, Man and Cybernetics 3. Linda GS, George CS 29 1999. 1999. 2001 Prentice-Hall Computer Vision * A family of novel clustering algorithms Barbakh W MCrowe CFyfe 7th international conference on intelligent data engineering and automated learning Spain Springer 2006. September 2006 University of Burgos * MVeloso EWinner SLenser JBruce TBalch Vision-Servoed Localization and Behaviors for an Autonomous Quadruped Legged Robot Artificial Intelligence Planning Systems 2000 * Cognachrome image capture device 1999 Newton Laboratories * The weighted nearest neighbor rule for class dependent sample sizes TABrown JKoplowitz IEEE Transactions on Information Theory 1979 * Multivariate decision trees CEBrodley PEUtgoff Machine Learning 1995 * Seeded Region Growing RAdams LBischof IEEE Trans. Pattern Analysis and Machine Intelligence 16 1994 * HDCheng Color Image Segmentation: Advances and Prospects. Pattern Recognition 2001 34 * Real-Time Tracking of Non-Rigid Objects using Mean Shift DComaniciu VRamesh PMeer IEEE Conf. Computer Vision and Pattern Recognition 2000 * Robust image segmentation algorithm using fuzzy clustering based on kernelinduced distance measure YLi YShen Proceedings of the International Conference on Computer Science and Software Engineering the International Conference on Computer Science and Software Engineering 2008 1 * Color image segmentation using a spatial k-means clustering algorithm DEIlea PFWhelan Proceedings of the Irish Machine Vision & Image Processing Conference the Irish Machine Vision & Image Processing Conference 2006. 2006 Dublin City University IMVIP 2006 * A review on image segmentation techniques NRPal SK Pattern Recognition 26 9 1993 * Visible color difference-based quantitative evaluation of colour segmentation HCChen SJWang Proceedings of the IEEE -72-Conference on Vision Image and Signal processing the IEEE -72-Conference on Vision Image and Signal processing 2006 153