# 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.

Add your code approach please. You could be doing something wrong there.

Thanks for looking at this problem. I must be doing something wrong with the code. cv::Mat tmp(1,1,CV_32FC3); Vec3f* pRow = tmp.ptr<Vec3f>(0); for(int k = 0; k < 3; k++) pRow[0].val[k] = (float) 0.5; cvtColor(tmp,tmp,CV_BGR2Lab)

I think I will make a very small project which does this with the vanilla deployment of OpenCV