-
Notifications
You must be signed in to change notification settings - Fork 0
/
extractDaisyFeaturesNeighbours.m
55 lines (42 loc) · 1.25 KB
/
extractDaisyFeaturesNeighbours.m
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function features = extractDaisyFeaturesNeighbours(cell2,id,p2,dzy2,flag)
% returns feture vector from the cells neighbouring to id.
%if flag is true then neighbours are dwn else they are up.
% id ranges from 1:20
pts = [];
featureV = [];
iid = [id-1 id id+1];
if(flag)
iid(iid<1 | iid>10)=[]; % its not cornercell
else
iid(iid<11 | iid>20)=[];
end
for i=1:length(iid)
validpts = intersect(cell2(iid(i)).Location,p2,'rows');
if(size(validpts,1)==0)
continue;
end
featuresDaisy = extractDaisyFeatures(dzy2,validpts);
pts = [pts;featuresDaisy.location];
featureV = [featureV;featuresDaisy.vector];
end
if(flag)
iid = [id+9 id+10 id+11];
iid(iid<11 | iid>20)=[]; % its not cornercell
else
iid = [id-9 id-10 id-11];
iid(iid<1 | iid>10)=[]; % its not cornercell
end
for i=1:length(iid)
validpts = intersect(cell2(iid(i)).Location,p2,'rows');
if(size(validpts,1)==0)
continue;
end
featuresDaisy = extractDaisyFeatures(dzy2,validpts);
pts = [pts;featuresDaisy.location];
featureV = [featureV;featuresDaisy.vector];
end
% remove duplicates if any
[pts,ia,~] = unique(pts,'rows');
features.vector = featureV(ia,:);
features.location = pts;
end