% show6 - display RGB and HSV color components of an image % % Usage: % show6(im,figNo) % % % Arguments: % im - color image of interest % figNo - optional figure number % % Output: % nil % % Author: % Tzu Yen Wong % wongt AT csse DOT uwa DOT edu DOT au % Department of Computer Science & Software Engineering % The University of Western Australia % % Oct 2003 % June 2004 change email address to fight SPAM!!! %1234567890123456789012345678901234567890123456789012345678901234567890123456789 function show6(im,figNo) hsvim = rgb2hsv(im); if nargin ==1, figNo=figure; else figure(figNo); end subplot(3,3,1); imshow(im), title('Original'); subplot(3,3,3); imshow(hsvim), title('HSV image'); subplot(3,3,4); red=zeros(size(im)); red(:,:,1)=im(:,:,1); red = uint8(red); imshow(red), title('Red'); subplot(3,3,5); green=zeros(size(im)); green(:,:,2)=im(:,:,2); green = uint8(green); imshow(green), title('Green'); subplot(3,3,6); blue=zeros(size(im)); blue(:,:,3)=im(:,:,3); blue = uint8(blue); imshow(blue), title('Blue'); subplot(3,3,7); imshow(hsvim(:,:,1)), colormap(hsv) title('Hue'); subplot(3,3,8); sat(:,:,3) = hsvim(:,:,2); sat(:,:,2) = hsvim(:,:,2); sat(:,:,1) = hsvim(:,:,2); imshow(sat), title('Saturation'); subplot(3,3,9); val(:,:,3) = hsvim(:,:,3); val(:,:,2) = hsvim(:,:,3); val(:,:,1) = hsvim(:,:,3); imshow(val), title('Value'); warning off figure(figNo), set(gcf,'name','RGB & HSV components'); truesize pixval on warning on