Ask Your Question

separating lab image into 3 components

asked 2015-06-14 05:43:12 -0500

diegomez_86 gravatar image

updated 2017-09-06 12:39:25 -0500

Hello Everyone, I want to dividide a BGR image into 3 images containing the 3 different CIE Lab color components (with just one channel). I know that I can do something like this:

 #include <opencv2/opencv.hpp>

 using namespace std;
 using namespace cv;

 int main( int argc, char** argv )
      Mat src = imread( "/home/diego/Documents/sunset.jpg", -1 ), lab;
      cvtColor(src, lab, CV_BGR2Lab);
      imshow("lab", lab);
      return 0;

And this gives me a kind of result like this

image description

However I read something that tells me that I need to treat the Luminance between 0 and 100, and a,b with values between -127 to 127 (So I don't know if this image is right or wrong). I would like to ask what is meant with these values... are these ones the pixel values, are these ones normalized values from the original 0 to 255? Are the values of this 3 channel image representing L((lab[0]), A(lab[1]), and B(lab[2])?

I have checked in several webpages to give me an idea but I just see very theoretical information about how the 3 axis Lab color space is composed but nothing that I can convert into real things.

Thanks and sorry for so many questions.

edit retag flag offensive close merge delete


Hi, and thanks. I already did it. and solved it with split as you said... Actually it was pretty easy. I didn't have to cope with all of those questions cause OpenCV did the job for me.

diegomez_86 gravatar imagediegomez_86 ( 2015-06-15 18:06:19 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-15 02:17:55 -0500

What is your input image? what you want to achieve? What you cannot understand? If you want to split a Lab color space image, you have to use Split() explained here

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-06-14 05:43:12 -0500

Seen: 1,347 times

Last updated: Jun 14 '15