7

I want to segment an image but someone told me that the Euclidean distance for RGB is not as good as HSV -- but for HSV, as not all H, S, V are of the same range so I need to normalize it. Is it a good idea to normalize HSV and then do clustering? If so, how should I normalize on HSV scale?

Thanks

Has QUIT--Anony-Mousse
  • 70,714
  • 12
  • 123
  • 184
wudanao
  • 666
  • 1
  • 6
  • 20

3 Answers3

9

As HSV components are signify Hue, Saturation and gray intensity of a pixel they are not correlated to each other in terms of color, each component have its own role in defining the property of that pixel, like Hue will give you information regarding color (wavelength in other terms) Saturation always shows how much percentage of white is mixed with that color and Value is nothing but magnitude of that color(in other term Intensity), that is why all components of HSV space not follow same scale for representation of the values while hue can goes negative(because these are cyclic values) on the scale as well but intensity (V) will never goes negative, so normalization will not help in clustering much, the Better idea is you should apply clustering only on Hue if you want to do color clustering.

Now why Euclidean is not good for multi-channel clustering is because its distribution along mean is spherical(for 2D circular) so if it can not make any difference between (147,175,208) and (208,175,147) both will have same distance from the center, its better to use Mahalanobis Distance for distance calculation because it uses Co-variance matrix of the components which makes this distance distribution Parabolic along the mean.

so if you want to do color segmentation in RGB color space use mahalanobis distance(but it will computationally extensive so it will slows down clustering process) and if you want to do clustering in HSV color space use Hue for the segmentation of colors and than use V for fine tuning of segmentation output.

Hope it will help. Thank You

Ankit Dixit
  • 730
  • 4
  • 11
7

Hue is cyclic.

Do not use the mean (and thus, k-means) on such data.

Has QUIT--Anony-Mousse
  • 70,714
  • 12
  • 123
  • 184
4

Firstly you need to know why HSV is more preffered than RGB in image segmentation. HSV separates color information (Chroma) and image intensity or brightness level (Luma) which is very useful if you want to do image segmentation. For example if you try to use RGB approach for a photo with sea as the background there is a big chance the dominant RGB component in the sea is not blue (usually because of shadow or illumination). But if you are using HSV, value is separated and you can construct a histogram or thresholding rules using only saturation and hue.

There is a really good paper that compared both RGB and HSV approach and I think it will be a good read for you -> http://www.cse.msu.edu/~pramanik/research/papers/2002Papers/icip.hsv.pdf

Niko Adrianus Yuwono
  • 10,592
  • 7
  • 37
  • 61
  • thank you very much for your answer. Can I have some comment on if you should normalize the HSV when doing clustering? – wudanao Sep 08 '15 at 10:04
  • @wudanao Sorry for the late reply, I think I will only take the Hue and Saturation from HSV image and create a histogram from it and then normalize the histogram before comparing it to another image – Niko Adrianus Yuwono Sep 09 '15 at 00:03