summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/ikkjin/getANMS.m
blob: a40d50c62d4d5c6e65e73812a565b96c5be40da3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function [interestPnts]=getANMS(x, y, v, r, dataDir)
MAX_LIMIT=100000;
C_ROBUST=1;
r_sq=r^2;
points=[x y v];
[n temp]=size(v);
[srtdV srtdVIdx]=sort(v,'descend');
srtdPnts=points(srtdVIdx,:);

interestPnts=zeros(0,3);

suppressR=ones(n,1)*MAX_LIMIT;
supId=find(suppressR>r_sq);

iter = 0;
while length(supId)>0

    interestPnts=[interestPnts; srtdPnts(supId(1),:)];
    srtdPnts=srtdPnts(supId(2:end),:);
    suppressR=suppressR(supId(2:end),:);
 
    suppressR=min(suppressR,...
        (C_ROBUST*interestPnts(end,3)>=srtdPnts(:,3)).*...
            ((srtdPnts(:,1)-interestPnts(end,1)).^2 + (srtdPnts(:,2)-interestPnts(end,2)).^2)...
        +(C_ROBUST*interestPnts(end,3)<srtdPnts(:,3))*...
            MAX_LIMIT);
     
    iter = iter + 1;
    supId=find(suppressR>r_sq);
end