hi,im trying toget the images of L,a,b of CIELab but when i make thetransformation from srgbtolab iget the images ingrayscale,L must be gray-scale color but A shouldbe redness to greenness and b yellowness to blueness. what code i canuse to get this?
1 view (last 30 days)
Show older comments
If i imread a picture ex,
%load rgb image
src = 'patio.jpg';
rgbI = imread(src);
%convert to lab
labTransformation = makecform('srgb2lab');
labI = applycform(rgbI,labTransformation);
%seperate l,a,b
l = labI(:,:,1);
a = labI(:,:,2);
b = labI(:,:,3);
figure, imshow(l) , title('l');
figure, imshow(a) , title('a');
figure, imshow(b) , title('b');
i get the a and b images in grayscale but i would like to get them, A from redness to greenness and b from yellowness to blueness, all this in terms of color. is it that possible? please help me with the code and dont know what else to do to achieve this.
0 Comments
Answers (1)
Image Analyst
on 31 Oct 2015
Yes it's possible. In fact you did it. You're done. a represents the redness/greenness and b represents the yellowness/blueness. You can display them however you want - in gray scale or in some custom colormap, but it's not necessary. In fact it could be somewhat deceptive, like if you displayed high a values in red then you might think those pixels should be red but they might be yellow or they might be purple. Both red and purple have high a values, it's not just red that has a high a value. Plus the color depends on the L value as you'll see from the attached demo (thanks to Jeff Mather of the Image Processing Team at the Mathworks).
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!