Halcon视觉毛刺检测-@龙熙视觉
结果如上
Halcon代码部分
*关闭程序计数器,变量更新,图像更新窗口
dev_update_window (‘off’)
*一次性读取3张图像
read_image (Fins, ‘fin’ + [1:3])
*获取图像宽高
get_image_size (Fins, Width, Height)
*关闭窗口
dev_close_window ()
*打开窗口
dev_open_window (0, 0, Width[0], Height[0], ‘black’, WindowID)
*设置字体信息
set_display_font (WindowID, 14, ‘mono’, ‘true’, ‘false’)
for I := 1 to 3 by 1
*选择图像集合里的指定索引的图像
select_obj (Fins, Fin, I)
*显示图像
dev_display (Fin)
*图像二值化,获取背景为亮的区域
binary_threshold (Fin, Background, ‘max_separability’, ‘light’, UsedThreshold)
*设置输出对象颜色