Tuesday, November 17, 2009

To perform Negation of a monochrome / 16 / 24 bit bitmap / JPEG / TIFF / GIF / Color image

This code is in MATLAB



CODE

%To create negative image
clf;
clf;
clear all;
close all;
i=imread('camera.bmp');
subplot(1,2,1);
imshow(i);
title('original image');
i=double(i);
[r c]=size(i);
for x=1:c
for y=1:r
i(y,x)=255-i(y,x);
end
end
i=uint8(i);
subplot(1,2,2)
imshow(i);
title('Negative image');

No comments:

Post a Comment