halcon边缘提取和缺陷检测常用方法;shape_trans算子的说明
一、边缘提取 1、设置ROI兴趣区域 2、快速二值化,并连接相邻区域。 这样做的目的是进一步减少目标区域,通过二值化将目标区域大概轮廓提取出来 3、提取最接近目标区域的轮廓 常用函数有boundary,gen_contour_region_xld boundary (获取一个区域的边界) Region (input_object) Regions for which the boundary is to be computed. 区域 RegionBorder (output_object) Resulting boundaries. 输出的边界 BoundaryType (input_control) Boundary type.边界类型 Default value: 'inner' List of values: 'inner', 'inner_filled', 'outer' linner 内边界。 inner_filled 内边界上的孔。 outer 外边界。 gen_contour_region_xld (生成区域的XLD轮廓) 4、根据自需求提取需要的初步轮廓 5、将初步提取的初步轮廓进行膨胀操作 6、将膨胀后的区域和原图进行减操作(在这步之前有可能需要对原图进行高斯滤波)。这样就能得到只有边缘的真实图像 7、用canny或其他算子(根据需要)提取亚像素轮廓