matlab 外接圆,怎么求不规则图像的最小外接圆

您所在的位置:网站首页 matlab求不规则图形面积程序 matlab 外接圆,怎么求不规则图像的最小外接圆

matlab 外接圆,怎么求不规则图像的最小外接圆

2024-07-11 07:38| 来源: 网络整理| 查看: 265

I=imread('matlab2.png');

BW=im2bw(I);

BW=BW(20:270,20:218);

figure,imshow(BW),hold on

se=[0 1 0;1 1 1;0 1 0];

BW=imdilate(BW,se);

figure,imshow(BW),hold on

L=bwlabel(BW);

stats=regionprops(L,'BoundingBox');

temp=stats.BoundingBox;

rectangle('position',temp,'edgecolor','r');

BW=BW(floor(temp(2))-1:floor(temp(2)+temp(4))+1,floor(temp(1))-1:floor(temp(1)...

+temp(3))+1);

BW=edge(BW,'canny');

figure,imshow(BW),hold on

[y,x]=find(BW==1);

[m,index]=max(y);

y_max=m;

x_max=x(index);

text(x_max, y_max,'A','color','red')

distance_max=0;

for k=1:size(x)

distance=norm(([x(k),y(k)]-[x_max,y_max]),2);



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3