from Digital Image Processing by Sandeep Kannur
It gives some better idea of various image enhansing techniques

rgb_hsi.m
rgb=imread('san.jpg');
rgb=double(rgb);
r=rgb(:,:,1);
g=rgb(:,:,2);
b=rgb(:,:,3);
num=0.5*((r-g)+(r-b));
den=sqrt((r-g).^2+(r-b).*(g-b));
den(den==0)=0.001;
th=acos(num./den);
H=th;
H(b>g)=2*pi-H(b>g);
H=H/(2*pi);   % to normalize
num=min(min(r,g),b);
den=r+g+b;
den(den==0)=0.001;
S=1-3.*num./den;
% H(S==0)=0;
I=(r+g+b)/3;
subplot(311);imshow(H,[]);title('Hue');
subplot(312);imshow(S,[]);title('Saturation');
subplot(313);imshow(I,[]);title('Intensity');

Contact us at files@mathworks.com