%Some snippets of code
%read in image filename
%inimage = input('Enter image file name with extension (like jennifer.bmp): ',
's');
%open image file
inimage = imread('man.bmp');
%display on screen the image
figure(1), imshow(inimage); title('Original Image');
size(inimage)
[T,map] = gray2ind(inimage,256);
figure(2), imshow(T,map); title('Indexed Image');
size(T)
S = ind2rgb(T,map);
figure(3), imshow(S); title('RGB Image');
size(S)
%Note that the output of ind2rgb is a double format image of size 256 x 256
%x 3
U = rgb2ycbcr(S);
figure(4), imshow(U); title('YCBCR Image');
size(U)
%Here pick off the luminance part of the ycbcr iamge
%here it is a 256 x 256 matrix
Y = U(:,:,1);
figure(5), imshow(Y); title('Y part of Image');
size(Y)