概述
原理不讲了,matlab实现 ,网上没找到好用的,这个最后做了归一化。
%function table_3 = ulbp(I)
clear
clc
img=imread('b.jpg');
I = rgb2gray(img);
picture=I;
x=size(picture,1);
y=size(picture,2);
lbp_n=uint8(zeros(x,y));
table=[];
tab=[];
temp=1;
for i=1:256
if(getHoptimes(i)<3)
table(i)=temp;
temp=temp+1;
end
end
k1=1;
for i=2:1:x-1
for j=2:1:y-1
neighbor=uint8(zeros(1,8));
neighbor(1,1)=picture(i-1,j-1);
neighbor(1,4)=picture(i-1,j);
neighbor(1,6)=picture(i-1,j+1);
neighbor(1,7)=picture(i,j+1);
neighbor(1,8)=picture(i+1,j+1);
neighbor(1,5)=picture(i+1,j);
neighbor(1,3)=picture(i+1,j-1);
neighbor(1,2)=picture(i,j-1);
center=picture(i,j);
temp1=uint8(0);
for k=1:1:8
temp1 =temp1+ (neighbor(1,k) >= center)* 2^(k-1);
end
if(temp1==255)
lbp_n(i-1,j-1)=table(256);
else
lbp_n(i-1,j-1)=table(temp1+1);
end
end
end
table_1(59)=[0];
table_3(59)=[0];
h=1;
for i=1:x
for j=1:y
if lbp_n(i,j)==0
table_1(59)=table_1(59)+1;
else
table_1(lbp_n(i,j))=table_1(lbp_n(i,j))+1;
end
end
end
table_3=table_1/sum(table_1);
%end
sum=1;
for i=1:x
for j=1:y
if lbp_n(i,j)==58
sum=sum+1;
end
end
end
最后
以上就是感性钢笔为你收集整理的uniform Pattern LBP特征matlab实现的全部内容,希望文章能够帮你解决uniform Pattern LBP特征matlab实现所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复