annotate _FullBNT/KPMtools/nonmaxsup.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 % NONMAXSUP - Non-maximal Suppression
matthiasm@8 2 %
matthiasm@8 3 % Usage: cim = nonmaxsup(im, radius)
matthiasm@8 4 %
matthiasm@8 5 % Arguments:
matthiasm@8 6 % im - image to be processed.
matthiasm@8 7 % radius - radius of region considered in non-maximal
matthiasm@8 8 % suppression (optional). Typical values to use might
matthiasm@8 9 % be 1-3. Default is 1.
matthiasm@8 10 %
matthiasm@8 11 % Returns:
matthiasm@8 12 % cim - image with pixels that are not maximal within a
matthiasm@8 13 % square neighborhood zeroed out.
matthiasm@8 14
matthiasm@8 15 % Copyright (C) 2002 Mark A. Paskin
matthiasm@8 16 %
matthiasm@8 17 % This program is free software; you can redistribute it and/or modify
matthiasm@8 18 % it under the terms of the GNU General Public License as published by
matthiasm@8 19 % the Free Software Foundation; either version 2 of the License, or
matthiasm@8 20 % (at your option) any later version.
matthiasm@8 21 %
matthiasm@8 22 % This program is distributed in the hope that it will be useful, but
matthiasm@8 23 % WITHOUT ANY WARRANTY; without even the implied warranty of
matthiasm@8 24 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
matthiasm@8 25 % General Public License for more details.
matthiasm@8 26 %
matthiasm@8 27 % You should have received a copy of the GNU General Public License
matthiasm@8 28 % along with this program; if not, write to the Free Software
matthiasm@8 29 % Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
matthiasm@8 30 % USA.
matthiasm@8 31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
matthiasm@8 32
matthiasm@8 33 function cim = nonmaxsup(m, radius)
matthiasm@8 34 if (nargin == 1) radius = 1; end
matthiasm@8 35 % Extract local maxima by performing a grey scale morphological
matthiasm@8 36 % dilation and then finding points in the corner strength image that
matthiasm@8 37 % match the dilated image and are also greater than the threshold.
matthiasm@8 38 sze = 2 * radius + 1; % Size of mask.
matthiasm@8 39 mx = ordfilt2(m, sze^2, ones(sze)); % Grey-scale dilate.
matthiasm@8 40 cim = sparse(m .* (m == mx));
matthiasm@8 41
matthiasm@8 42