In this tutorial. I have explained what is RGB and CIE LAB color space. Then, I have shown an example in MATLAB where I converted an image from sRGB to LAB
Showing posts with label sRGB. Show all posts
Showing posts with label sRGB. Show all posts
Saturday, July 26, 2014
Convert RGB to CIE LAB with explanation, MATLAB example
In this tutorial. I have explained what is RGB and CIE LAB color space. Then, I have shown an example in MATLAB where I converted an image from sRGB to LAB
Tuesday, March 12, 2013
watch out while using sRGB2lab
Imagine you have a 8 bit/color channel (24bit image) and you want to convert RGB values (assuming in sRGB color space) into LAB color space. SO you do the following
rgb=imread('peppers.png');
lab = applycform(rgb,makecform('srgb2lab'));
rgb=imread('peppers.png');
lab = applycform(rgb,makecform('srgb2lab'));
Where rgb is a NxMx3 matrix of unint8 type and so does the lab. Everything seems fine! But try the following:
Lmax= max(max(lab(:,:,1))) % maximum L of LAB should be within 100
but is it the case? NO?
You will notice that Lmax is beyond 100 and the reason is lab is in uint8 type
Therefore, if you want a normalized L value from LAB do the following
lab_d=lab2double(lab); % normalization !!!
Now try
max(max(lab_d(:,:,1))) % L should be <=100
Therefore, watch out! But, color your life! :)
Subscribe to:
Posts (Atom)