共线圆检查

dev_update_off ()
dev_close_window ()
dev_open_window (0, 0, 978, 324, 'black', WindowHandle)
dev_set_part (0, 0, 647, 1955)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_set_color ('yellow')

*检测图中有多少个圈
*dev_set_line_width (3)
read_image (Image, 'C:/Users/Administrator/Desktop/20190727090119176.png')
*因为是随手用画板制的图,需要用到滤波器过滤线条
gauss_filter (Image, ImageGauss, 9)
threshold_sub_pix (ImageGauss, Border, 200)
*根据一种模型拆解轮廓线
segment_contours_xld (Border, ContoursSplit, 'lines', 1, 1, 1)
*使用共线链接,缝合这些满足条件的轮廓线
union_cotangential_contours_xld (ContoursSplit, UnionContours, 4, 30, rad(45), 25, 10, 2, 'attr_forget')
*筛选掉没有缝合到的短的轮廓线
select_contours_xld (UnionContours, SelectedContours, 'contour_length', 100, 99999, -0.5, 0.5)
count_obj (SelectedContours, Num_All)
Num:=Num_All/2
dev_clear_window ()
dev_display (Image)
set_display_font (WindowHandle, 30, 'mono', 'true', 'false')
write_string (WindowHandle, '检测出'+Num+'个圈圈')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值