function t = thresh(im,val)
%
% thresh: thresholds image at val
% On input:
%     im: 2D image
%     val: hreshold value
% On output:
%     t: thresholded image
% Call:
%     t = thresh(im,val)
%

[m,n] = size(im);

im2 = im > val*ones(m,n);
t = im.*im2;
  