Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

I am converting color from RGB to CIELab to train a GMM. When I get back the mean of clusters of the GMM I have sometimes negatives values in RGB space. I was wondering if the mean of only visible color can be non visible color ? Therefore I was also wondering if the visual color of CIELab forms a convex shape.

EDIT: I'm using Expectation-Minimization of OpenCV to train the Gaussian Mixture Model.

share|improve this question
    
It sounds like your colors are out of gamut. Which RGB color space are you working in? –  Emre Feb 5 '13 at 6:31
    
@Emre I guess it's the ISO RGB, where in normalized, (1,1,1) is white and (0,0,0) is black. I think I'm out of gamut but how can it be possible ? –  Seltymar Feb 5 '13 at 7:11
    
How did you convert to and from L*a*b* and RGB? –  Emre Feb 5 '13 at 7:55
    
@Emre I took the algorithm from this site easyrgb.com/index.php?X=MATH. I converted RGB to XYZ then XYZ to CIEL*a*b*. –  Seltymar Feb 5 '13 at 8:17
add comment

1 Answer

up vote 1 down vote accepted

You are implicitly using sRGB, a small color space. You might like to try using scRGB, a similar color space that allows such values.

The average of visible colors should also be visible, however the calculation should be performed in a perceptual color space for the result to be more meaningful; L*a*b* is better than sRGB.

Another question to ponder is whether the centers make sense in L*a*b*. Perhaps you have a bug?

share|improve this answer
    
Ok, I see that in fact, sRGB is very a small part of the visible color. But as all colors are taken in sRGB space, even after converting in L*a*b*, the mean should stay in the subset define by sRGB, right ? I am not sure as it is a gaussian. It can also come from a bug. –  Seltymar Feb 5 '13 at 9:11
    
I think sRGB gamut in L*a*b is a non-convex shape, hence the line connecting two points can lay partly outside of the shape including its centroid (the color average). The resulting color can be theoretically out of sRGB gamut. You can make use larger RGB space (e.g. scRGB as Emre mentioned) or make use of some gamut mapping technique. –  Libor Feb 7 '13 at 16:26
    
@Libor thank you. That sounds logic. I will try with the scRGB space. –  Seltymar Feb 8 '13 at 0:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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