如何将RGB彩色图像或简单图像转换为CMY彩色图像和提取每个组件青色(C)品红色(M)和黄色(Y)? 我的方法: -
I=imread('Capture2.PNG');
I3 = I;
I2 =I;
I1 = I;
I1(:,:,2:3)=0;
RED = I1;
I2(:,:,1:2) = 0;
BLUE = I2;
I3(:,:,1:3)=0;
GREEN=I3;
tic;
figure;imshow(RED);
figure;imshow(BLUE);
figure;imshow(GREEN);
c = 1.0-RED;
m = 1.0-GREEN;
y = 1.0-BLUE;
figure;imshow(c);
figure;imshow(m);
figure;imshow(y);
答案 0 :(得分:4)
您可以使用makecform
创建色彩空间转换:
I=imread('Capture2.PNG');
cform = makecform('srgb2cmyk');
cmykI = applycform(I,cform);
BTW,在您的问题中,似乎I
的类型为uint8
,因此在范围[0..255]中,为了获得每个组件的补码,您需要从255中减去它们而不是1.0:
c = 255-RED;
m = 255-GREEN;
y = 255-BLUE;