clear;
close all;
clc;
img = imread('C:\Users\US\Desktop\CompVision\images\lenna.jpg');
img =
imresize(img,[256 256]);
img1 = rgb2lab(img);
img2 = lab2rgb(img1);
img3 = rgb2hsv(img);
img4 = rgb2xyz(img);
img5 =
rgb2ycbcr(img);
img6 = rgb2ntsc(img);
% lab color
space decomposition
[r, c, ch] =
size(img1);
img_l =img1(:,:,1);
img_a =img1(:,:,2);
img_b =img1(:,:,3);
% rgb color
space decomposition
[r1, c1, ch1] =
size(img2);
img_r = img2(:,:,1);
img_g = img2(:,:,2);
img_bb = img2(:,:,3);
% hsv color
space decomposition
[r2, c2, ch2] =
size(img3);
img_h = img3(:,:,1);
img_s = img3(:,:,2);
img_v = img3(:,:,3);
% xyz color
space decomposition
[r3, c3, ch3] =
size(img4);
img_x = img4(:,:,1);
img_y = img4(:,:,2);
img_z = img4(:,:,3);
% ycbcr color
space decomposition
[r4, c4, ch4] =
size(img5);
img_yy = img5(:,:,1);
img_cb = img5(:,:,2);
img_cr= img5(:,:,3);
% ntsc color
space decomposition
[r5, c5, ch5] =
size(img6);
img_nt = img6(:,:,1);
img_ss = img6(:,:,2);
img_c = img6(:,:,3);
img_cat1 =
cat(3,img_l, img_s, img_v);
subplot(441),imshow(img_cat1),
title('lsv');
img_cat2 =
cat(3,img_h, img_a, img_v);
subplot(442),imshow(img_cat2),
title('Channel: hav');
img_cat3 =
cat(3,img_x, img_y, img_nt);
subplot(443),imshow(img_cat3),
title('Channel: xynt');
img_cat4 =
cat(3,img_cr, img_yy, img_cb);
subplot(444),imshow(img_cat4),
title('Channel: crycb');
img_cat5 =
cat(3,img_r, img_g, img_z);
subplot(445),imshow(img_cat5),
title('Channel: rgz');
img_cat6 =
cat(3,img_r, img_g, img_x);
subplot(446),imshow(img_cat6),
title('Channel: rgx');
img_cat7 =
cat(3,img_nt, img_g, img_x);
subplot(447),imshow(img_cat7),
title('Channel: ntgx');
img_cat8 =
cat(3,img_nt, img_g, img_b);
subplot(448),imshow(img_cat8),
title('Channel: ntgb');
img_cat9 = cat(3,img_bb,
img_g, img_r);
subplot(449),imshow(img_cat9),
title('Channel: bgr');
img_cat10 =
cat(3,img_g, img_bb, img_r);
subplot(4,4,10),imshow(img_cat10),
title('Channel: gbr');
img_cat11 =
cat(3,img_bb, img_l, img_r);
subplot(4,4,11),imshow(img_cat11),
title('Channel: blr');
img_cat12 =
cat(3,img_yy, img_r, img_g);
subplot(4,4,12),imshow(img_cat12),
title('Channel: yrg');
img_cat13 =
cat(3,img_s, img_g, img_r);
subplot(4,4,13),imshow(img_cat13),
title('Channel: sgr');
img_cat14 =
cat(3,img_z, img_y, img_x);
subplot(4,4,14),imshow(img_cat14),
title('Channel: zyx');
img_cat15 =
cat(3,img_nt, img_yy, img_l);
subplot(4,4,15),imshow(img_cat15),
title('Channel: ntyr');
img_cat16 =
cat(3,img_v, img_bb, img_y);
subplot(4,4,16),imshow(img_cat16),
title('Channel: vby');
0 Comments