
I = imread('rgb.jpg'); 
figure,imshow(I);
Ir = I(:, :, 1); 
Ig = I(:, :, 2);
Ib = I(:, :, 3);
Ir = double(Ir); Ig = double(Ig); Ib = double(Ib);

% CMY
I_cmy = imcomplement(I);
Ic = imcomplement(Ir);
Im = imcomplement(Ig);
Iy = imcomplement(Ib);
figure,imshow(I_cmy);
figure,imshow(Ic, []);
figure,imshow(Im, []);
figure,imshow(Iy, []);

% HSI
Ii = (Ir + Ig + Ib) / 3;
V1 = -Ir/(sqrt(6)) - Ig/(sqrt(6)) + 2*Ig/(sqrt(6));
V2 = Ir/(sqrt(6)) - Ig/(sqrt(6));
V1 = double(V1);
V2 = double(V2);

Ih = atan(V2 ./ V1);
Is = sqrt( V1.^2 + V2.^2 );

figure,imshow(Ih, []);
figure,imshow(Is, []);
figure,imshow(Ii, []);



