halcon图像处理

read_image(Image, 'C:/Users/Public/Documents/MVTec/HALCON-20.11-Progress/examples/images/fabrik.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_shape(ConnectedRegions, SelectedRegions, 'area', 'and', 7000, 9000)
*填充
fill_up(SelectedRegions, RegionFillUp)
*减小区域,抠图,定位到指定地方(图像  区域  新图像)
reduce_domain(Image, RegionFillUp, ImageReduced)

threshold(ImageReduced, Region1, 128, 255)
*亚像素,Pix像素,理解为线内得像素点低于150
threshold_sub_pix(ImageReduced, Border, 150)
*XLD(eXtended Line Descriptions):换句话说XDL就是一个轮廓函数,它不是基于像素,
*人们通常称他为亚像素,只不过它比像素更精确,可以精确到像素内部的一种描述
select_contours_xld(Border, SelectedContours, 'contour_length', 42, 50, -0.5, 0.5)
*捕捉到的对象有多少个
count_obj(SelectedContours, Number)
*填充区域
gen_region_contour_xld(SelectedContours, Region2, 'filled')

reduce_domain(ImageReduced, Region2, ImageReduced1)

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小兴-

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值