function immin=minfilt(imw,filtersize);

% immin=MINFILT(imw,filtersize);
%
% 		Minimum filters the image file IMW
%
%		filtersize: size of quadratic pixel neighborhood
%
%		e.g.: immin=minfilt(imw,3);
%
%
% University of Rhode Island
% Dept. of Electrical Engineering
% Roger Meier, May '99


if filtersize < 2
	disp('filter size too small')
	break
end

immin=ordfilt2(imw,1,ones(filtersize,filtersize));
