%{
Thresholding
%}
k=imread(\'white_bg.jpg\');
x=rgb2gray(k);
copy=x;
imhist(x);
[m,n]=size(x);
for i=1:m
for j=1:n
if x(i,j)>=240
x(i,j)=0;
else
x(i,j)=255;
end
end
end
y=medfilt2(x);
subplot(2,2,1),imshow(k),title(\'original image\');
subplot(2,2,2),imshow(copy),title(\'Gray image\');
subplot(2,2,3),imshow(uint8(x)),title(\'Output image\');
subplot(2,2,4),imshow(uint8(y)),title(\'Filtered Output image\');