Problem with LAb color space

asked 2013-07-24 06:47:55 -0500

Hi everyone,

This is my first post even if I read the forum quite often.

I am having an issue with coversion from BGR to Lab space but it seems that I am the only one having this problem at the moment. I searched on the forum and on stack overflow for this issue but I found nothing.

I tried to use the standard function cv::cvtColor(bgrImg,labImg,CV_BGR2Lab) however i have an issue with the input data type.

If my inputs are both cv::Mat then i have no problem and I have an output Mat of type CV_8U3C with values in the range [0,255] for all channels.

However if I define input and output matrix as Mat3f (I understood from the documentation that this is possible) then all pixels in the output matrix have a value of [100,0,0]. Did I get something wrong from the documentation?

I am using opencv 2.4.6 prebuilt for windows. My ide is Visual Studio 2012 with VC2010 compiler. I tried also opencv 2.4.5 but the same problem esists.

Thanks in advance, Alessandro

edit retag flag offensive close merge delete

Comments

2

Have you scaled your matrix to the range 0-1? Also, since your output matrix is of type float: do you print the values correctly?

Guanta gravatar imageGuanta ( 2013-07-24 07:25:36 -0500 )edit