%DIP Class Demo
%Shreekanth Mandayam, Rowan University
%
% Digital Image Quantization


dog=imread('sherlock.jpg');
%Converting to intensity image
dog=mat2gray(rgb2gray(dog));
[M, N] = size(dog);

[dog256,map]=gray2ind(dog, 256);
figure; imshow(dog256,map);
title([int2str(M) ' x ' int2str(N)  ' Sherlock image, 256 Graylevels']);

pause;
[dog128,map]=gray2ind(dog, 128);
figure; imshow(dog128,map);
title([int2str(M) ' x ' int2str(N)  ' Sherlock image, 128 Graylevels']);

pause;
[dog64,map]=gray2ind(dog, 64);
figure; imshow(dog64,map);
title([int2str(M) ' x ' int2str(N)  ' Sherlock image, 64 Graylevels']);

pause;
[dog32,map]=gray2ind(dog, 32);
figure; imshow(dog32,map);
title([int2str(M) ' x ' int2str(N)  ' Sherlock image, 32 Graylevels']);

pause;
[dog16,map]=gray2ind(dog, 16);
figure; imshow(dog16,map);
title([int2str(M) ' x ' int2str(N)  ' Sherlock image, 16 Graylevels']);

pause;
[dog8,map]=gray2ind(dog, 8);
figure; imshow(dog8,map);
title([int2str(M) ' x ' int2str(N)  ' Sherlock image, 8 Graylevels']);

pause;
[dog4,map]=gray2ind(dog, 4);
figure; imshow(dog4,map);
title([int2str(M) ' x ' int2str(N)  ' Sherlock image, 4 Graylevels']);

pause;
[dog2,map]=gray2ind(dog, 2);
figure; imshow(dog2,map);
title([int2str(M) ' x ' int2str(N)  ' Sherlock image, 2 Graylevels']);


