File size: 1,036 Bytes
d4035c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
function featurevectors=constructhf(inputvectors, map)
%construct rotation invariant features from uniform LBP histogram
%inputvectors: NxD array, N histograms of D bins each
%map: mapping struct from getmaphf
%
%EXAMPLE:    
%I=imread('rice.png');
%I2=imrotate(I,90);
%mapping=getmaplbphf(8);
%h=lbp(I,1,8,mapping,'h');
%h=h/sum(h);
%histograms(1,:)=h;
%h=lbp(I2,1,8,mapping,'h');
%h=h/sum(h);
%histograms(2,:)=h;
%lbp_hf_features=constructhf(histograms,mapping);
%
%The two rows of lbp_hf_features now contain LBP 
%histogram Fourier feature vectors of rice.png and 
%its rotated version (with LBP radius 1 and 8 sampling 
%points)


    n=map.samples;
    FVLEN=(n-1)*(floor(n/2)+1)+3;
    featurevectors=zeros(size(inputvectors,1),FVLEN);
    
    k=1;
    for j=1:length(map.orbits)
        b=inputvectors(:,map.orbits{j}+1);
        if(size(b,2) > 1)
            b=fft(b')';
            b=abs(b);
            b=b(:,1:(floor(size(b,2)/2)+1));
        end
        featurevectors(:,k:k+size(b,2)-1)=b;
        k=k+size(b,2);
    end