Conversion of RGB images into Lab color space
24 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I tried to convert the RGB image into Lab color space using following two codes in MATLAB2014b(first code use RGB while second code use sRGB). For both code, output Lab images are different. I cannot get any use able data using these images. Also, my images are totally different from few images, I found on internet of Lab color space (I searched Lab image on internet to know how Lab images look like).
Codes which I used are below:
first code
A = imread('C:\Users\Naseeb\Desktop\images\1.jpg');
lab = rgb2lab(A);
imshow(lab);
Second Code:
A = imread('C:\Users\Naseeb\Desktop\images\1.jpg');
colorTransform = makecform('srgb2lab');
lab = applycform(A, colorTransform);
imshow(lab);
Also, I observe that image obtained from second code is same as image I get by converting RGB into YCrCb image. How can I get correct Lab image.
I'm attaching my images with this. Original image (RGB image which used to convert into Lab); 1st code (Lab image from 1st code); 2nd code (Lab image from 2nd code); internet image (which I found on internet to know how Lab image look like)
5 comentarios
Andrew Lee
el 30 de Nov. de 2021
may I know at the end of this, which code did you use for the conversion. And how did you store the La*b* values which ranged from 0to100 for L, and -128to127 for a* & b* so that you can furthere process with it?
Respuestas (1)
Image Analyst
el 20 de Mayo de 2016
NASEEB: See Steve's blog for lots and lots of info: http://www.mathworks.com/search/site_search.html?q=color+space&c[]=blogs
I use rgb2lab() to convert to CIE LAB color space whenever I need relative, quick and dirty, kind of color space conversion. Never use JPG images for image analysis. It's no wonder the values are different. JPG will destroy the image to various degrees. Use PNG instead.
All of those are "book" formulas. They will not give you the "true" LAB like you'd get from a spectrophotometer. Most of the time I use calibrated digital color imaging because I need the "true" LAB values out, not some arbitrary ones. But that's a much higher level of sophistication that you probably want to do.
For a color toolbox by one of the worlds leading color researchers, you can get Professor Westland's toolbox here: http://www.mathworks.com/matlabcentral/fileexchange/40640-computational-colour-science-using-matlab-2e He literally wrote the book on color analysis with MATLAB. http://www.mathworks.com/matlabcentral/fileexchange/28790-colorspace-transformations
0 comentarios
Ver también
Categorías
Más información sobre Modify Image Colors en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!