-
Notifications
You must be signed in to change notification settings - Fork 4
/
getNGTDMfeatures.m
59 lines (52 loc) · 1.42 KB
/
getNGTDMfeatures.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
56
57
58
59
function features = getNGTDMfeatures(NGTDM,countValid)
% AUTHOR(S):
% - Lijun Lu <[email protected]>
% - Martin Vallieres <[email protected]>
% -------------------------------------------------------------------------
% HISTORY:
% - Creation: January 2013
% - Revision: May 2015
% - Revision: Oct 2017
% PRELIMINARY
nTot = sum(countValid);
countValid = countValid./nTot;
NL = length(NGTDM);
Ng = sum(countValid~=0);
pValid = find(countValid>0);
nValid = length(pValid);
% COMPUTATION OF TEXTURES
% 1. Coarseness
features.Coarseness = (((countValid')*NGTDM) + eps)^(-1);
% 2. Contrast
val = 0;
for i = 1:NL
for j = 1:NL
val = val + countValid(i)*countValid(j)*(i-j)^2;
end
end
features.Contrast = val*sum(NGTDM)/(Ng*(Ng-1)*nTot);
% 3. Busyness
denom = 0;
for i = 1:nValid
for j = 1:nValid
denom = denom + abs(pValid(i)*countValid(pValid(i))-pValid(j)*countValid(pValid(j)));
end
end
features.Busyness = ((countValid')*NGTDM)/denom;
% 4. Complexity
val = 0;
for i = 1:nValid
for j = 1:nValid
val = val + (abs(pValid(i)-pValid(j))/(nTot*(countValid(pValid(i)) + countValid(pValid(j)))))*(countValid(pValid(i))*NGTDM(i) + countValid(pValid(j))*NGTDM(j));
end
end
features.Complexity = val;
% 5. Strength
val = 0;
for i = 1:nValid
for j = 1:nValid
val = val + (countValid(pValid(i))+countValid(pValid(j)))*(pValid(i)-pValid(j))^2;
end
end
features.Strength = val/(eps+sum(NGTDM));
end