clc;
clear all;
close all;
I = imread('cameraman.tif');
imhist(I);
T= input('Please Enter the Threshold Value ');
[m n] = size(I);
for j=1:m
    for k=1:n
        if I(j,k) >T
            Inew(j,k) = 1;
        else
            Inew(j,k) = 0;
        end
    end
end
figure,imshow(Inew);