-
Notifications
You must be signed in to change notification settings - Fork 0
/
LBP.m
57 lines (41 loc) · 1.16 KB
/
LBP.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
% LBP code
for x = 1:u
for y = 1:v
%temp= imresize(gaborResult{x,y}, [256 256]);
gaborResult1=padarray(gaborResult{x,y},[1 1]);
[w,z] =size(gaborResult1);
img3=gaborResult1;
%[m,n] = size(temp);
for i=2:m+1
for j=2:n+1
% subimg1=imgpad((i-1:i+1),(j-1:j+1));
% figure;
% imshow(subimg1);
% subimg=subimg1;
for p=(i-1:i+1)
for q=(j-1:j+1)
if img3(p,q)>img3(i,j)
subimg(p-i+2,q-j+2)=1;
else
subimg(p-i+2,q-j+2)=0;
end
end
end
binval=subimg(1,1)*(2^0)+subimg(1,2)*(2^1)+subimg(1,3)*(2^2)+subimg(2,3)*(2^3)+subimg(3,3)*(2^4)+subimg(3,2)*(2^5)+subimg(3,1)*(2^6)+subimg(2,1)*(2^7);
lbpimg(i-1,j-1)=binval;
end
end
lbpimg=uint8(lbpimg);
lbpfinal33{x,y}=lbpimg;
end
end
%DISPLAY
figure('NumberTitle','Off','Name','LBP PATTERN');
for x = 1:u
for y = 1:v
subplot(u,v,(x-1)*v+y)
imshow(abs(lbpfinal33{x,y}),[]);
end
end
% figure;
% imhist(temp1);