MATLAB:将RGB图像转换为Lab Color Space的算法

时间:2011-05-16 04:21:13

标签: matlab

如何在Matlab中将RGB图像转换为Lab Color Space?

1 个答案:

答案 0 :(得分:15)

http://wildinformatics.blogspot.com/2010/10/rgb-to-lab-color-transformation-in.html

%load rgb image
src = 'C:\rainbow.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');