2011-05-16 339 views
-5

如何在Matlab中将RGB图像转换为Lab颜色空间?MATLAB:将RGB图像转换为Lab颜色空间的算法

+6

你想与薯条? – 2011-05-16 04:22:52

+3

除了这个字面上我们要求你为你做的工作,它[内置于MATLAB](http://www.mathworks.com/help/toolbox/images/f8-20792.html)*和* 3rd第二方解决方案可作为[第一个谷歌搜索结果](http://robotics.stanford.edu/~ruzon/software/rgblab.html)。 – 2011-05-16 04:26:10

+0

你可以看看这里 - http://stackoverflow.com/questions/6013139/matlab-algorithm-to-convert-rgb-image-to-lab-color-space/6013156#6013156,你也有它内置在MATLAB中或在文件交换中。 – Royi 2017-02-27 06:52:13

回答

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'); 
+0

请注意,他实际上转换为L * a * b *,而不是Lab。 – 2012-06-20 16:58:25