function O=threshold(I,threshold)
% function to threshold an image
%O=threshold(I,threshold)

% size of image
[height,width]=size(I);


for y=1:height
    for x=1:width
        if I(y,x)>threshold,
            O(y,x)=I(y,x);
        else
            O(y,x)=0;
        end
    end
end