If one feature of my objects is color, how to compute similarity between two objects?

It is correct to transform it to RGB and use Euclidean distance in 3D? Or is there any acceptable one dimensional ordering of colors (as in the case of rainbow)?

| cite | improve this question | | | | |
  • $\begingroup$ Your colors are given in the rgb coding ? $\endgroup$ – Stéphane Laurent Oct 10 '12 at 8:38
  • $\begingroup$ No, my question is how it would be solved in general case. So suppose that I see for example two apples in nature and I want to measure similarity of their colors. $\endgroup$ – Miroslav Sabo Oct 10 '12 at 8:58
  • 1
    $\begingroup$ But how would you encode the colors of the apples ? $\endgroup$ – Stéphane Laurent Oct 10 '12 at 10:15
  • $\begingroup$ That's the right question. Maybe we could use camera and then analyze it by PC to extract color features. $\endgroup$ – Miroslav Sabo Oct 10 '12 at 10:24
  • 1
    $\begingroup$ Ok, I see that the question is not well defined, thank you for the comment. So maybe the only way how to improve the question is to compare only two pixels in an image. But as you mentioned @whuber, definition of similarity is still controversial. $\endgroup$ – Miroslav Sabo Oct 10 '12 at 17:55

Not an expert but: Any one dimensional ordering is likely arbitrary. Some form of Euclidean distance is probably what you need, but the question is: colour as perceived by whom? The human eye is differently sensitive to different colours, and the base unit is the 'just noticeable difference'. Check the Wikipedia page.

On the other hand it wouldn't exactly be incorrect simply to measure the Euclidean distance between the RGB dimensions. I think this might be the correct measure if you were interested in the amount of light emitted/reflected, for instance, rather than how (non-colour blind) humans perceive the different colours.

| cite | improve this answer | | | | |
  • $\begingroup$ Thank you for constructive answer and also for very suitable link. $\endgroup$ – Miroslav Sabo Oct 10 '12 at 9:44
  • $\begingroup$ @MiroslavSabo I have typed "distance rgb colors" on Google (without the quote marks). It yields interesting links about similarity of coulours. $\endgroup$ – Stéphane Laurent Oct 10 '12 at 10:15
  • 2
    $\begingroup$ The Wikipedia page gives a good overview. But note that all discussed color spaces are device independent whereas @MiroslavSabo seems to only have device dependent RGB values. You cannot go from RGB to something like CIELAB without knowing the specific display characteristics. $\endgroup$ – caracal Oct 10 '12 at 10:19
  • 1
    $\begingroup$ It's not totally clear but in the comments Miroslav talks about measuring the colour of "two apples in nature," which would be quite different from comparing RGB values for a shape to be displayed on a screen. For the latter case there is a similar question on stackoverflow with some good-sounding answers. $\endgroup$ – Stuart Oct 10 '12 at 10:28
  • 2
    $\begingroup$ @Stuart To measure (device independent) cone excitations corresponding to a scene in nature, you need multispectral imaging and apply the cone fundamentals (their spectral sensitivity curves) at each pixel. From raw cone excitations, you can convert into any perceptual color space you want, including the ones used for calculating distance measures. $\endgroup$ – caracal Oct 10 '12 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.