annotate toolboxes/FullBNT-1.0.7/KPMtools/nonmaxsup.m @ 0:cc4b1211e677 tip

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