在图中找到圆并拟合圆,显示圆的直径

*读图

read_image (Image,'C:/Users/Administrator/Desktop/检测图/孔径.bmp')


get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width/3, Height/3, 'black', WindowHandle)
dev_display (Image)

*转灰度
rgb1_to_gray (Image, GrayImage)
threshold (GrayImage, Regions, 0, 7)
connection (Regions, ConnectedRegions)

*选择形状,这个需要自己选择,因为每个图的大小不一样,可以根据区域和圆度选择
select_shape (ConnectedRegions, SelectedRegions, ['area','circularity'], 'and', [1099.99,0.55345], [3200,0.9346])

*开运算/腐蚀
opening_circle (SelectedRegions, RegionOpening,0.5)
dilation_circle (RegionOpening, RegionDilation, 3.5)

*数数

count_obj (RegionDilation, Number)


for i := 1 to Number by 1

*拟合圆
 gen_contour_region_xld (RegionDilation, Contours1, 'border')
fit_circle_contour_xld (Contours1, 'algebraic&#

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值