我正在尝试提取该功能,但是当我运行脚本时会出现此错误(使用LBPFeature输出参数太多时出错)

时间:2017-03-31 22:42:33

标签: matlab image-processing neural-network

%% Extract and display Local binary pattern Features for single face 

person = 5;

[Featureex, visualization]= LBPFeature(read(training(person),1));

figure;

subplot(2,1,1);imshow(read(training(person),1));title('Input Face');

subplot(2,1,2);plot(visualization);title('LBP Feature');

这是提取功能的功能:

function [LBP]= LBPFeature(I2)


I3=I2;

m=size(I2,1);

n=size(I2,2);

for i=2:m-1

    for j=2:n-1

        c=I2(i,j);

        I3(i-1,j-1)=I2(i-1,j-1)>c;

        I3(i-1,j)=I2(i-1,j)>c;

        I3(i-1,j+1)=I2(i-1,j+1)>c; 

        I3(i,j+1)=I2(i,j+1)>c;

        I3(i+1,j+1)=I2(i+1,j+1)>c; 

        I3(i+1,j)=I2(i+1,j)>c; 

        I3(i+1,j-1)=I2(i+1,j-1)>c; 

        I3(i,j-1)=I2(i,j-1)>c;

        LBP (i,j) =I3(i-1,j-1)*2^7+I3(i-1,j)*2^6+I3(i-1,j+1)*2^5+ ...

            I3(i,j+1)*2^4+I3(i+1,j+1)*2^3+I3(i+1,j)*2^2+ ...

            I3(i+1,j-1)*2^1+I3(i,j-1)*2^0;
    end
end

0 个答案:

没有答案