线特征

im=EinRDR;
im=EinRDR/max(EinRDR(:));
BW=im2bw(im);
[mag,phase]=imgaborfilt(im,40,90);
[Dx,Dy,Dxx,Dxy,Dyy] = Hessian2D(mag,5);
 
[eigenvalue1, eigenvalue2, eigenvectorx, eigenvectory]=eig2image(Dxx, Dxy, Dyy);  //特征值
temp1=max(eigenvalue1, eigenvalue2);
temp2=min(eigenvalue1, eigenvalue2);
a=zeros(256,256);
for i=1:256
    for j=1:256
        if temp1(i,j)-temp2(i,j)>temp2(i,j) & BW(i,j)==1//线特征
            a(i,j)=im(i,j);
        end
    end
end

subplot 221,imshow(im,[])
subplot 222,imshow(mag,[])
subplot 223,imshow(phase,[])
subplot 224,imshow(a,[])

m00 = hu (0,0,a);
m10 = hu (1,0,a);
m01 = hu (0,1,a);
m11 = hu (1,1,a);
m02 = hu (0,2,a);
m20 = hu (2,0,a);
xc=m10/m00;
yc=m01/m00;
a=m20/m00-xc^2;
b=m11/m00-xc*yc;
c=m02/m00-yc^2;
theta=90-atan2(2*b,a-c)*90/pi
if theta>180
    theta=180-theta;
end
d=theta-InRandomdegs9

猜你喜欢

转载自blog.csdn.net/qq_41244435/article/details/86541539
今日推荐