Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CIE Lab conversion error

I am converting a cv::Mat(1,1,CV_32FC3) matrix using cvtColor and CV_BGR2Lab.

The answer I get back does not conform to the formula given in the documentation, but does at points. So I am baffled as to what I am doing wrong. I can hardly believe this is wrong in OpenCV.

It appears that the cube root part of the CIE Lab formula is not implemented. So, for example, Black (0,0,0) is converted correctly, as is while (1,1,1), and other colors, such as blue (1,0,0), green (0,1,0), and red (0,0,1).

However all in between colors seem wrong. For example, gray (128/255 128/255 128/255), or approximately 0.5020 for each entry, gives me Lab = (53.5850 0 0), when it should return the value (76.1895 0 0).

I have plotted the entire range of gray and see that cube root part of Open CV's implementation seems to be missing.