...当完成图像分割后 如何对感兴趣区域进行特征提取 中间感兴趣_百度知 ...
发布网友
发布时间:2022-05-14 04:24
我来回答
共1个回答
热心网友
时间:2024-03-03 02:58
I=imread('1.jpg');
f=rgb2gray(I);
f1=im2bw(f,192/240);
BW1=double(f1);
BW=edge(BW1,'sobel',0.4);
r_max=90;
r_min=20;step_r=10;step_angle=pi/6;p=0.3;
% p:阈值,0,1之间的数
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% output
% hough_space:参数空间,h(a,b,r)表示圆心在(a,b)半径为r的圆上的点数
% hough_circl:二值图像,检测到的圆
% para:检测到的圆的圆心、半径
[m,n] = size(BW);
size_r = round((r_max-r_min)/step_r)+1;
size_angle = round(2*pi/step_angle);
hough_space = zeros(m,n,size_r);
[rows,cols] = find(BW);
ecount = size(rows);
% Hough变换
% 将图像空间(x,y)对应到参数空间(a,b,r)
% a = x-r*cos(angle)
% b = y-r*sin(angle)
for i=1:ecount
for r=1:size_r
for k=1:size_angle
a = round(rows(i)-(r_min+(r-1)*step_r)*cos(k*step_angle));
b = round(cols(i)-(r_min+(r-1)*step_r)*sin(k*step_angle));
if(a>0&&a<=m&&b>0&&b<=n)
hough_space(a,b,r) = hough_space(a,b,r)+1;
end
end
end