LDN局部特征检测 (可以用于人脸检测 识别)

<span style="font-size:18px;">、</span>
<span style="font-size:18px;">
</span>
<span style="font-size:18px;">imshow(ldn(I))
</span>
<span style="font-size:18px;">
</span>
<span style="font-size:18px;">function result=ldn(image)
%k=3;

[wight,hight]=size(image);
temp=zeros(wight+2,hight+2);
% temp(2:129,2:129)=image;
temp(2:wight+1,2:hight+1)=image;
result=zeros(wight,hight);
Vk=0;
f=zeros(3,3);
sp=zeros(3,3,8);
M=zeros(1,8);
M_sort=zeros(1,8);
min_change=0;
image=double(image);
sp(:,:,1)=[-3,-3,5;-3,0,5;-3,-3,5];
sp(:,:,2)=[-3,5,5;-3,0,5;-3,-3,-3];
sp(:,:,3)=[5,5,5;-3,0,-3;-3,-3,-3];
sp(:,:,4)=[5,5,-3;5,0,-3;-3,-3,-3];
sp(:,:,5)=[5,-3,-3;5,0,-3;5,-3,-3];
sp(:,:,6)=[-3,-3,-3;5,0,-3;5,5,-3];
sp(:,:,7)=[-3,-3,-3;-3,0,-3;5,5,5];
sp(:,:,8)=[-3,-3,-3;-3,0,5;-3,5,5];

for i=2:wight+1
    for j=2:hight+1
        f=temp(i-1:i+1,j-1:j+1);

        M=[];
        for m=1:8
            cc=sp(:,:,m);
            M(1,m)=abs(sum((f(:)')*cc(:)));     
        end   
         [M_sort,indexss]=sort(M);    
         I1=indexss(8)-1;
         I2=indexss(1)-1;
         
         
         result(i-1,j-1)=I1*8+I2;
         
    end

end

result=uint8(result);</span>

你可能感兴趣的:(LDN局部特征检测 (可以用于人脸检测 识别))