002-Halcon图像基本算子

threshold(Image, Region, 128, 255)得到区域灰度值在128到255的像素点集合

connection(Region, ConnectedRegions)将区域打散

select_shape(ConnectedRegions, SelectedRegions, 'area', 'and', 17000, 17500)根据面积选择区域

fill_up(SelectedRegions, RegionFillUp)填充选择的区域

reduce_domain(Image, RegionFillUp, ImageReduced)抠出选择的区域

threshold_sub_pix(ImageReduced, Border, 150)亚像素点:找出像素值为150的点并把其用线连接起来

select_contours_xld(Border, SelectedContours, 'contour_length',160, 170, -0.5, 0.5)根据线段长度选择区域

count_obj(SelectedContours, Number)计算选择的区域数量

gen_region_contour_xld(SelectedContours, Region2, 'filled')填充选择出来的亚像素点连接成线段围成的区域

代码演示:

read_image(Image, 'D:/images/flower.png')
get_image_size(Image, Width, Height)

dev_close_window()
dev_open_window(0, 0, Width, Height, 'black', WindowHandle)

dev_display(Image)

threshold(Image, Region, 128, 255)

connection(Region, ConnectedRegions)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值