Ask Your Question

Greg Walsh's profile - activity

2016-10-12 03:28:56 -0500 received badge  Nice Answer (source)
2015-07-09 20:27:14 -0500 received badge  Teacher (source)
2015-03-02 10:42:08 -0500 received badge  Necromancer (source)
2014-07-17 19:11:24 -0500 commented question CIE Lab conversion error

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

2014-07-16 17:26:24 -0500 answered a question L*u*v* and L*a*b* Color Space are Non-Euclidean in 8U

Yes. However in Lab, the scaling for a and b are the same, differing only by an offset, which is removed if you take the difference using only "a" and "b". So if you wanted to check to see if the color was similar looking, and not worry about the "L" component, then you could just form a norm on the "a" and the "b" parts.

Myself I just use the floating point version, which is left alone.

2014-07-16 17:20:00 -0500 asked a question 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.