电路宽度测量halcon例子

一个halcon处理的例子

处理要求:

根据客户给的宽度,计算出电路宽度太窄的为NG

原图:

在这里插入图片描述

处理程序:

read_image (Image, '1.png')
rgb1_to_gray(Image, GrayImage)
threshold(GrayImage, Region, 130, 255)
connection (Region, ConnectedRegions)
select_shape(ConnectedRegions, SelectedRegions, 'area', 'and', 10000, 99999)
opening_circle(SelectedRegions, RegionOpening, 2.5)
get_image_size (GrayImage, Width, Height)
distance_transform (RegionOpening, DistanceImage, 'city-block', 'true', Width, Height)
threshold (DistanceImage, Regions, 6, 127)
fill_up(Regions, RegionFillUp)
erosion_circle (RegionFillUp, RegionErosion, 2.5)
skeleton (RegionErosion, Skeleton)
junctions_skeleton (Skeleton, EndPoints, JuncPoints)
dilation_circle (EndPoints, RegionDilation, 10.5)
dilation_circle (JuncPoints, RegionDilation1, 5.5)
difference (Skeleton, RegionDilation, RegionDifference)
difference (RegionDifference, RegionDilation1, RegionDifference1)
gen_contours_skeleton_xld (RegionDifference1, Contours, 1, 'filter')
union_adjacent_contours_xld (Contours, UnionContours, 50, 5, 'attr_keep')
smooth_contours_xld (UnionContours, SmoothedContours, 23)
select_shape_xld(SmoothedContours, SelectedXLD, 'contlength', 'and', 500, 99999)
dev_display (GrayImage)
dev_display (SelectedXLD)

处理结果:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值