% RGBOpic
% usage: RGBOpic(pic)
% show picture and its RGB components
% pic is assume to be an image file where  X is the picture and map is the colormap


function Y = RGBOpic(pic);

% load picture
load(pic)

% define colormaps

R = zeros(size(map));
R(:,1)= map(:,1);
G = zeros(size(map));
G(:,2)=map(:,2);
B = zeros(size(map));
B(:,3)=map(:,3);

% show images

figure(1)
imshow(X,map);
figure(2)
imshow(X,R);
figure(3)
imshow(X,G);
figure(4)
imshow(X,B);

disp('press a key')
pause

