Tuesday, November 17, 2009

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

Note:-Write this code in Matlab

CODE

% thresholding
clf;
clc;
clear all;
close all;
i=imread('camera.bmp');
subplot(1,2,1);
imshow(i);
title('original image');
r1=100;
[r c]=size(i);
for x=1:c
for y=1:r
if (i(y,x) i(y,x)=0;
else
i(y,x)=255;
end
end
end

subplot(1,2,2)
imshow(i);
title('thresholding image');

No comments:

Post a Comment