Color Image Segmentation Using Automated
Color Image Segmentation Using Automated
Abstract- Segmentation implies the division of an image into different objects or connected regions
that do not overlap. Though, extensive research has been done in creating many different
approaches and algorithms for image segmentation, however, it is still not very clear to assess
whether one algorithm produces more accurate segmentations than another, whether it be for a
particular image or set of images, or more generally, for a whole class of images [7]. A reliable and
accurate segmentation of an image is, in general, very difficult to achieve by purely automatic means.
Present researches on image segmentation using clustering algorithms reveals that K-means
clustering algorithm so far produces best results but some improvements can be made to improve
the results. The biggest disadvantage of our heavy usage of k-means clustering, is that it means we
would have to think of a k each time, which really doesn’t make too much sense because we would
like to algorithm to solve this on his own. Therefore we tried to find the K automatically and so create
segmentation without any human giving “hints” to the algorithm.
Keywords: automated k-means, clustering, RGB, HSV, segmentation, color space, cluster, image
processing, color image, K-means clustering.
GJCST-F Classification: I.2.10, I.3.3
ColorImageSegmentationusingAutomatedKMeansClusteringwithRGBandHSVColorSpaces
Strictly as per the compliance and regulations of:
© 2017. Md. Rakib Hassan, Romana Rahman Ema & Tajul Islam. This is a research/review paper, distributed under the terms of the
Creative Commons Attribution-Noncommercial 3.0 Unported License http://creativecommons.org/licenses/by-nc/3.0/), permitting all
non-commercial use, distribution, and reproduction inany medium, provided the original work is properly cited.
Color Image Segmentation using Automated
K-Means Clustering with RGB and HSV
Color Spaces
Md. Rakib Hassan α, Romana Rahman Ema σ & Tajul Islam ρ
2017
Abstract- Segmentation implies the division of an image into objectives like reduce overall deviation, maximize
different objects or connected regions that do not overlap. property, reduce the options or reduce the error rate of
Year
Though, extensive research has been done in creating many the classifier. In image processing, it is still not very clear
different approaches and algorithms for image segmentation, to measure whether one algorithm express more
however, it is still not very clear to assess whether one
accurate segmentation than another, whether it be for 33
algorithm produces more accurate segmentations than
another, whether it be for a particular image or set of images,
related image, particular image or set of images, or
Global Journal of Computer Science and Technology ( F ) Volume XVII Issue II Version I
or more generally, for a whole class of images [7]. A reliable more usually, for a whole class of each images [4].
and accurate segmentation of an image is, in general, very
difficult to achieve by purely automatic means. Present
researches on image segmentation using clustering
algorithms reveals that K-means clustering algorithm so far
produces best results but some improvements can be made
to improve the results. The biggest disadvantage of our heavy
usage of k-means clustering, is that it means we would have to
think of a k each time, which really doesn’t make too much Figure 1: Segmentation Technique with automated “K”
sense because we would like to algorithm to solve this on his
own. Therefore we tried to find the K automatically and so The modern researches on digital image
create segmentation without any human giving “hints” to the segmentation generally use K-means clustering
algorithm. So we tried to make the process automatic. In this algorithm which doesn’t express best results but after
paper, the combined segmentation of RGB and HSV color some elevation of K-means algorithm, it could express
spaces give more accurate segmentation result compared to the results better. In this paper, the combined
segmentation of single color space. For keeping the k
segmentation of RGB and HSV color spaces give more
parameter as small as possible, we had to keep different
intensity levels of the same color on the same segment to
accurate segmentation result compared to
estimate the right k automatically for the algorithm. segmentation of single color space our main objectives
Keywords: automated k-means, clustering, RGB, HSV, while segmenting images of different kind like using the
segmentation, color space, cluster, image processing, RGB color space where we wanted to get rid of different
color image, K-means clustering. intensity level of the same color shade which is not
satisfied. Hence, we thought of another representation
I. Introduction to color images the HSV color space which will ease our
solution to segmentation
W
ith the impetuous improvement in the digital
technology, digital image play very significant II. Related Work
role in modern era with its rapidly uses at
medical sector and the visualization sector. Digital Gudrun J. Klinker, Steven A. Shafer and Takeo
image can be described as a large number array of Kanade observed Physical Approach to Color Image
discrete dots where each dot has a brightness level understanding with additional example through
associated with it. opposed to k means and Anil Z Chitade evaluated the
These dots are simply represents as pixels or Color based image segmentation using kmeans
picture elements. Image segmentation is defined as; clustering. R. C. Gonzalez and R. E. Woods described
“the search for homogeneous regions in an image and Digital Image Processing where YZang presented a
later the classification of these images”. Segmentation review on image segmentation techniques with remote
signifies the partition of an image into different objects sensing perspective.
or connected regions that do not overlap. Highly use of Pena M, Barbakh W, Fyfe C discussed the
Real world image segmentation issues have multiple Principal Manifolds for Data Visualization and Dimension
Reduction. McAndrew A analyzing Digital Image
Author α σ ρ: Dept. of Computer Science and Engineering (CSE), North Processing with Matlab Notes for SCM2511 Image
Western University, Khulna, Bangladesh. e-mails: [email protected], Processing. Marques, Blanca NP, Pina P works with
[email protected], [email protected]
2017
Figure 5: HSV Color Space
Year
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 35
example, the value is high and when the hue is red, the
Global Journal of Computer Science and Technology ( F ) Volume XVII Issue II Version I
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]:
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. Figure 6: Sample to HSV Converted Result
2017
Year
Figure 11: Sample Image from Fruit-Ninja Game
On fruit ninja game play image we sampled the 37
different colors from all the individual fruits in the game,
Global Journal of Computer Science and Technology ( F ) Volume XVII Issue II Version I
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.
Figure 10: Proposed Technique of HSV Color
Segmentation
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 Figure 12: HSV Result with Automated K after Color
a) Performance Matrices Segmentation
We discovered that even though the K-Means Hence, we thought of another representation to
algorithm does a great job, but when we tried to make color images the HSV color space which will ease our
the process automatic with the right automatic K, even solution to segmentation. The HSV color space has
though we were in a restricted world of images, the different parameters for the HUE, the SATURATION and
process wasn’t easy, and obviously our results are not the VALUE (intensity) of the pixel. Again, the fully
perfect, but not too far away. On images of unknown automatic algorithm isn’t perfect, the usage of the
source, the problem becomes much harder. So we minimum distance condition isn’t enough to accurately
proposed an algorithm to minimize the K parameter by estimate the K parameter but we do ideas on how to
itself, at the beginning of time it starts with high value of improve it. In the restricted world of game play images,
K, and then iteration ally reducing it, until we meet a HSV based segmentation did much better than the RGB
certain condition, which generally has to do with the version. The fact that we can ignore the pixels intensity
minimum distance between the centers of the level opened up a way to clearly segment the picture
segmentation. Now, the problem is to choose a based on hue only, which, in this scenario specifically is
condition which will make the algorithm stop and very good.
calculate the “right” k. We can easily fix this certain
No representation is better than the other often a direct result of the success or failure of
Year
though we wanted to emphasize this fact, so we provide segmentation. However, an authentic and exact
examples from real world images; there HSV color segmentation of an image is, in general, very difficult to
acquire by purely automatic means. Considering the
38 space to eliminate different intensities of the same hue
isn’t performing too well, as opposed to RGB. pros and cons of the main algorithm used (K-Means
Global Journal of Computer Science and Technology ( F ) Volume XVII Issue II Version I
2017
comparatively better task but the process commits little
bit ambiguous while we have try to choose the actual k.
Year
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 39
Figure 17: RGB Result on Fruit image after Color
K, and X-means algorithm which didn’t supposed to
Segmentation
Global Journal of Computer Science and Technology ( F ) Volume XVII Issue II Version I
give a result that would glut [2]. So we tried to make the
We know that different “shades” of the same method instinctive, even though we were in a strict world
color (different intensities) are basically multiplication by of images, the work is not easy and accurate but not
a constant of a basic vector in the RGB space. The most impossible by any means. When worked with RGB color
disadvantage of our excessive usage of k-means space, our proposed technique is not gave us suitable
clustering is that it means we would have to think of a k result. The optimal K value and the automated K value is
every time, which really not the perfect way because we quite difference.
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. Figure 19: Optimal and Automated K value on HSV
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.
choose a k makes using it a bit problematic. When we Applications (0975 – 8887) Volume 41– No.20,
tried to make the process automatic but the job wasn’t March 2012.
easy, and obviously our results are not perfect, but not 6. Dibya Jyoti Bora1, Anil Kumar Gupta2, Fayaz
too far away. The characteristics which we use for our Ahmad Khan3 "Comparing the Performance of
working procedure is color: As most of us know, the L*A*B* and HSV Color Spaces with Respect to
different figures in the game are fruits, which usually Color Image Segmentation" , International Journal of
have very different colors, and so segmentation by Emerging Technology and Advanced Engineering
colors usually gives a very correct feel of objects, and Website: www.ijetae.com (ISSN 2250-2459, ISO
can be a good preprocessing for stages like object 9001:2008 Certified Journal, Volume 5, Issue 2,
recognition. We found the numbers we used to February 2015).
terminate the reduction of K based on samplings from 7. YZang“A review on image segmentation techniques
2017
game play images and manipulations on the results, with remote sensing perspective” IAPRS Vienna,
general pictures are not supposed to work this way. Austria, July 5–7, 2010, IAPRS, Vol. XXXVIII.
Year
However we wanted to emphasize the fact that no 8. Navneet Kaur et.al “ Bacteria foraging based image
representation is better than the other. In the restricted segmentation “An International Journal of
40 world of Game play images, HSV based segmentation Engineering Sciences ISSN: 2229-6913 Issue July
did much better than the RGB version. The fact that we 2012, Vol. 6.
Global Journal of Computer Science and Technology ( F ) Volume XVII Issue II Version I
can ignore the pixels intensity level opened up a way to 9. Rajeshwar Dass et.al “Image Segmentation
clearly segment the picture based on hue only, which, in Techniques” IJECT Vol. 3, Issue 1, Jan. - March
this scenario specifically is very good. HSV 2012 [7] Y. Zhong, K. Karu et.al, "Locating Text in
representation is not better generally all the time, Complex Color Images," Pattern Recognition, vol.
because for real world images, the RGB representation 28, no. 10, pp. 1523-1535, October 1995.
gave us better outcomes which show us about the 10. Pena M, Barbakh W, Fyfe C (2007).. "Principal
importance of having different representations of the Manifolds for Data Visualization and Dimension
same object. Those methods we implemented that did Reduction", chapter TopologyPreserving Mappings
not get the best performance. We tried to get the right K for Data Visualization, pages 132–152. Springer,
but it was so much difficult for us to detect it. We only 2007. ISBN 978-3-540-73749-0.
worked with RGB color pace and HSV color space. We 11. McAndrew A (2004). "An Introduction to Digital
tried to get best result with RGB and HSV color space Image Processing with Matlab Notes for SCM2511
with our automated K-Means algorithm but all time we Image Processing 1", School of Computer Science
did not get best result from our proposed algorithm. and Mathematics, Victoria University“
Not only that, it was so much difficult to get the right K 12. http://www.numericaltours.com/matlab/multidim_1_
from our proposed algorithm. In future we will try to color/”, Access Date: 05-04-2017.
modify our proposed automated K-Means algorithm to 13. Marques, Blanca NP, Pina P (2005). "Pattern
get the accurate K all time at all color space. Now we Recognition and Image Analysis" Singh, S.; Singh,
only worked with two color space but in future we will M.; Apte, C.; Perner, P. Estoril, Portugal, (2005),
like to work with more color space like CMYK, L*a*b, ISBN: 978-3-540-28833-6.
YCBCR, HSL etc. after work with these color spaces we 14. Kardi Teknomo – K Mean Clustering Tutorial.
can easily compare which will be best for image 15. Lloyd SP (1957.: "Least squares quantization in
segmentation. pcm." Technical note, Bell Laboratories, 1957.
Published in 1982 in IEEE Transactions on
References Références Referencias Information Theory 28, 128-137.
16. Kardi Teknomo – K Mean Clustering Tutorial,
1. Gudrun J. Klinker, Steven A. Shafer and Takeo
Teknomo, Kardi. K-Means Clustering Tutorials.
Kanade, “A Physical Approach to Color Image
http:\\people. revoledu.com\kardi\ tutorial\kMean\
Understanding,” International Journal of Computer
17. Krishna K, Narasimha MM (1999). “Genetic K-
Vision, Vol. 4, No. 1, pp. 738, 1990.
.
means algorithm,” IEEE Trans. on Systems, Man
2. Anil Z Chitade “Color based image segmentation and Cybernetics, Vol. 29,1999, pp. 3. Linda GS,
using kmeans clustering” International Journal of George CS (2001). “Computer Vision”, pp 279-325,
Engineering science and Technology, Vol. 2(10), New Jersey, Prentice-Hall, ISBN 0-13-030796-3.
2010, 5319-5325. 18. Barbakh w, Crowe M, Fyfe C (2006).. "A family of
3. R. C. Gonzalez and R. E. Woods, Digital Image novel clustering algorithms. In 7th international
Processing. Addison-Wesley, 1993. conference on intelligent data engineering and
4. Tan, Steinbach, Kumar "Introduction to Data Mining", automated learning", IDEAL2006, pages 283–290,
4/18/2004 . University of Burgos, Spain, September 2006.
5. C. Mythili and V.Kavitha "Color Image Segmentation Springer. ISSN 03029743 ISBN-13978-3-540-
using ERKFCM", International Journal of Computer 454854.
2017
trees. Machine Learning, 1995.
23. Adams, R. and L. Bischof, Seeded Region Growing.
Year
IEEE Trans. Pattern Analysis and Machine
Intelligence, 1994. 16: p. 641-647. 41
24. Cheng, H.D., et al., Color Image Segmentation:
Global Journal of Computer Science and Technology ( F ) Volume XVII Issue II Version I
Advances and Prospects. Pattern Recognition,
2001. 34: p. 2259-2281.
25. Comaniciu, D., V. Ramesh, and P. Meer. Real-Time
Tracking of Non-Rigid Objects using Mean Shift. in
IEEE Conf. Computer Vision and Pattern
Recognition. 2000: p. 142-149.
26. Y. Li and Y. Shen, “Robust image segmentation
algorithm using fuzzy clustering based on kernel-
induced distance measure,” in Proceedings of the
International Conference on Computer Science and
Software Engineering, 2008, vol. 1, pp. 1065-1068.
27. D. E. Ilea and P. F. Whelan, “Color image
segmentation using a spatial k-means clustering
algorithm,” in . Proceedings of the Irish Machine
Vision & Image Processing Conference 2006 (IMVIP
2006), Dublin City University, 2006, pp. 146–53.
28. N. R. Pal and S. K. Pal, “A review on image
segmentation techniques,” Pattern Recognition, vol.
26, no. 9, pp. 1227-1294, 1993.
29. H. C. Chen and S. J. Wang, “Visible color
difference-based quantitative evaluation of colour
segmentation,” in Proceedings of the IEEE -72-
Conference on Vision Image and Signal processing,
2006, vol. 153, no. 5, pp. 598-609.
www.GlobalJournals.org