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