% demonstration file for seminar 16/Nov/00 load clown x=ind2gray(X,map); imshow(x,64), title('original Image'); disp('press a key') pause [nr,nc]=size(x); imhist(x), title('Histogram of clown image'); disp('press a key') pause subplot(1,2,1), imshow(x), title('Original image'); subplot(1,2,2),histeq(x), title('Histogram equalized image'); disp('press a key') pause g_x=grayslice(x,10); subplot(1,1,1),imshow(g_x,jet(10)); title('Gray sliced image to 10 planes'); disp('press a key') pause colormap('gray'); noi_x=imnoise(x,'salt & pepper'); subplot(1,2,1), imshow(x), title('Original image'); subplot(1,2,2), imshow(noi_x),title('Image with salt & pepper noise'); av_x=0; for i=1:10 av_x=x+av_x; end disp('press a key') pause subplot(1,2,1), imshow(noi_x),title('Image with salt & pepper noise'); subplot(1,2,2), imshow(av_x), title('Image after averaging 10 times'); for i=1:50 av_x=x+av_x; end disp('press a key') pause subplot(1,2,1), imshow(noi_x),title('Image with salt & pepper noise'); subplot(1,2,2), imshow(av_x), title('Image after averaging 50 times'); disp('press a key') pause j=imadjust(x,[0.05 0.6],[0 1]); subplot(1,2,1), imshow(x,128), title('Original image'); subplot(1,2,2), imshow(j,128), title('Image after intensity stretching'); disp('press a key') pause clear all load clown x1=ind2gray(X,map); j1=imadjust(x1,[0 0.5],[],[]); subplot(2,2,1), imhist(x1,128); title('Histogram of image') subplot(2,2,2),imshow(x1,128),title('original image'); subplot(2,2,3),imhist(j1,128), title('Histogram of intensity stretched image') subplot(2,2,4), imshow(j1,128),title('Intensity stretched image');