【机器视觉】halcon视觉检测项目
【代码】halcon视觉检测项目。
·
1. 选择的素材
第二步:编写halcon代码
* This programm shows the extraction of surface scratches via
* local thresholding and morphological post-processing
*
dev_update_off ()
dev_close_window ()
*
* Step 1: Acquire image
*
* 读取图片
read_image(Image,'/data/home/hfg/photo/2023-01-10/8059523121337139678.jpg')
* 获取图片信息
get_image_size (Image, Width, Height)
* 打开窗口
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', 329231, 330000)

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)