%By leaper
RGB = imread('123.jpg');
imshow(RGB);
text(15,15,'Estimate radius of iris',...
'FontWeight','bold','Color','y');
I = rgb2gray(RGB);
threshold = graythresh(I);
BW = im2bw(I,threshold);
%imshow(BW)
dim = size(BW);
col = round(dim(2)/2)-95;
row = find(BW(:,col), 1);
connectivity = 4;
num_points = 300;
contour = bwtraceboundary(BW, [row, col], 'N', connectivity, num_points);
%imshow(RGB);
%hold on;
mask = bsxfun(@plus, ((1:552) - 249.5083).^2, (transpose(1:298) - 125.3709).^2) < (41)^2;
count=1;
for xs=1:552
for ys=1:298
if (mask(ys,xs)==1)
xnews(count)=xs;
ynews(count)=ys;
count=count+1;
end
end
end
mask1 = bsxfun(@plus, ((1:552) -2.475082563312659e+02).^2, (transpose(1:298) - 1.273709462474379e+02).^2) < (1.204731808283926e+02)^2;
count1=1;
for xs1=1:552
for ys1=1:298
if (mask1(ys1,xs1)==0)
xnews1(count1)=xs1;
ynews1(count1)=ys1;
count1=count1+1;
end
end
end
for q1=1:(count1-1)
I(ynews1(q1),xnews1(q1))=0;
end
for q=1:(count-1)
I(ynews(q),xnews(q))=0;
end
imshow(I)
% hold on;
BW1 = im2bw(I,0.3);
[B,L,N] = bwboundaries(BW1);
% for k=1:length(B)
% boundary = B{k};
% if(k > N)
% plot(boundary(:,2),� boundary(:,1),'b','LineWidth',4);
%
% end
% end
%plot(contour(:,2),contour(:,1),'g','LineWidth',6);
x = contour(:,2);
y = contour(:,1);
% solve for parameters a, b, and c in the least-squares sense by
% using the backslash operator
abc = [x y ones(length(x),1)] \ -(x.^2+y.^2);
a = abc(1); b = abc(2); c = abc(3);
% calculate the location of the center and the radius
xc = -a/2;
yc = -b/2;
radius = sqrt((xc^2+yc^2)-c)
% display the calculated center
%plot(xc,yc,'yx','LineWidth',2);
% plot the entire circle
theta = 0:0.01:2*pi;
% use parametric representation of the circle to obtain coordinates
% of points on the circle
Xfit = radius*cos(theta) + xc;
Yfit = radius*sin(theta) + yc;
%plot(Xfit, Yfit,'b','LineWidth',4);
% plot(Xfit, Yfit);
message = sprintf('Radius of iris is %2.3f pixels', radius);
text(15,15,message,'Color','y','FontWeight','bold');
没有合适的资源?快使用搜索试试~ 我知道了~
使用 houstransform 和小波变换的眼检测 检测的眼睛使用使用自适应处理技术的小波变换和 hough 检测算法.zip
共2个文件
m:1个
jpg:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 196 浏览量
2023-06-27
17:33:33
上传
评论
收藏 23KB ZIP 举报
温馨提示
使用 houstransform 和小波变换的眼检测 检测的眼睛使用使用自适应处理技术的小波变换和 hough 检测算法.zip
资源推荐
资源详情
资源评论
收起资源包目录
使用 houstransform 和小波变换的眼检测 检测的眼睛使用使用自适应处理技术的小波变换和 hough 检测算法.zip (2个子文件)
mcode
123.jpg 21KB
Untitled.m 2KB
共 2 条
- 1
资源评论
GZM888888
- 粉丝: 177
- 资源: 2945
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功