You are on page 1of 4

Grey level slicing with background:

Grey level slicing without background:


Clear all;
Clc;
r=imread('D:\ganuextcb\g5.tif');
z=double(r);
[row,col]=size(z);
for i=1:1:row
for j=1:1:col
if((z(i,j)>50))&&(z(i,j)<150)
z(i,j)=255;
else
z(i,j)=0;

end
end
end
subplot(2,1,1);
imshow(r);
title('original image');
subplot(2,1,2);
imshow(uint8(z));
title('image after slicing');
OUTPUT:

Image Negative
clear all;
a=imread('Cameraman.tif');
[row col]=size(a);
b=max(a);
l=max(b);
for i=1:row
for j=1:col
p(i,j)=l-a(i,j);
end
end
subplot(1,2,1);
imshow(a);
title('original image')
subplot(1,2,2);
imshow(uint8(p));
title('negative image')

OUTPUT:

You might also like