-
Notifications
You must be signed in to change notification settings - Fork 0
/
LGBP.m
24 lines (19 loc) · 951 Bytes
/
LGBP.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
%local Gabor binary patterns(LGBP) combines Gabor magnitudes (or phases)
%with local binary patterns(LBP)operator.
function lgbp = LGBP(EO) %EO_Mag or EO_Pha
[rows cols] = size(EO);
lgbp = zeros(rows,cols);
padEOcell = padarray(EO,[1 1]);
for i = 2:rows+1
for j = 2:cols+1
lgbp(i-1,j-1) = (padEOcell(i-1,j-1) >= padEOcell(i,j)) +...
(padEOcell(i-1,j) >= padEOcell(i,j)) * 2 +...
(padEOcell(i-1,j+1) >= padEOcell(i,j)) * 4 +...
(padEOcell(i, j+1) >= padEOcell(i,j)) * 8 +...
(padEOcell(i+1,j+1) >= padEOcell(i,j)) * 16 +...
(padEOcell(i+1,j) >= padEOcell(i,j)) * 32 +...
(padEOcell(i+1,j-1) >= padEOcell(i,j)) * 64 +...
(padEOcell(i, j-1) >= padEOcell(i,j)) * 128;
end
end
end