1 Star 2 Fork 0

itwuhai / 基于MATLAB指纹识别系统

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LL_angle2.m 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
itwuhai 提交于 2022-09-26 19:08 . 程序终稿
function [thetaz]=LL_angle2(img,x,y)
rc=0;thetaz=0;
while thetaz==0
if rc~=0
img=imrotate(img,rc);
end
[imgN,imgM]=size(img);
image=zeros(imgN,imgM);
R=width(x,y,img);
r=10*R;
for i=1:imgN %行
for j=1:imgM %列
if sqrt((j-x)^2+(i-y)^2)<r
image(i,j)=~img(i,j);
end
end
end
BW=bwmorph(image,'thin',Inf);
[H,theta,rho]= hough(BW);
P = houghpeaks(H,7,'threshold',ceil(0.4*max(H(:))));%检测投票结果
lines = houghlines(BW,theta,rho,P,'FillGap',5,'MinLength',7);%检测直线
for k = 1:length(lines)
len = norm(lines(k).point1 - lines(k).point2);%直线的长度
a(k)=len;
[~,t]=sort(a);
end
N=min(3,length(lines));thetax=zeros(1,N);
for i=1:N
thetax(i)=lines(t(length(t)-(i-1))).theta;
end
figure;subplot(121);imshow(BW);
subplot(122);imshow(BW);
hold on;
for i=1:N
xy{i}= [lines(t(length(t)-(i-1))).point1; lines(t(length(t)-(i-1))).point2];
plot(xy{i}(:,1),xy{i}(:,2),'LineWidth',2,'Color','blue')
end
temp=median(thetax);
n0=0;
for i=1:N
if(abs(thetax(i)-temp)<=15)
xtx(i)=thetax(i);
n0=n0+1;
else
xtx(i)=0;
end
end
if n0==N
thetaz=sum(xtx)/n0+rc;
if thetaz<-60
thetaz=thetaz+180;
end
else
thetaz=0;
end
rc=rc+10;
end
end
1
https://gitee.com/itwuhai/fingerprint-identification.git
git@gitee.com:itwuhai/fingerprint-identification.git
itwuhai
fingerprint-identification
基于MATLAB指纹识别系统
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891