halcon粘连字符分割_<Halcon>分割粘连区域

read_image (Image, 'F:/培训/Halcon培训/2.jpg')

rgb1_to_gray (Image, GrayImage)

*平滑图片去噪

mean_image (GrayImage, ImageMean, 3, 3)

get_image_size (ImageMean, Width, Height)

*截取中心ROI区域

gen_circle (ROI_0, 480, 490, 450)

reduce_domain (ImageMean, ROI_0, ImageReduced)

threshold (ImageReduced, Regions, 96, 234)

connection (Regions, ConnectedRegions)

select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 200, 99999)

*计算输入区域(或其补码)的每个点到区域边界的距离

*参数Foreground决定是为区域内的所有点计算距离(Foreground= 'true')

*区域外的所有点计算距离(Foreground= 'false')

distance_transform (SelectedRegions, DistanceImage, 'euclidean', 'true', Width, Height)

invert_image (DistanceImage, ImageInvert)

*图像比例增强 按最大比例增强对比度

scale_image_max (ImageInvert, ImageScaleMax)

*分水岭算法

watersheds_threshold (ImageScaleMax, Basins, 15)

gen_contour_region_xld (Basins, Contours, 'border')

*取出两个区域中重叠的部分

intersection (Basins, SelectedRegions, RegionIntersection)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值