Halcon中边缘检测对比:卷积图像算子&Sobel算子

您所在的位置:网站首页 卷积边缘处理 Halcon中边缘检测对比:卷积图像算子&Sobel算子

Halcon中边缘检测对比:卷积图像算子&Sobel算子

2024-06-11 22:33| 来源: 网络整理| 查看: 265

在Halcon软件中使用Sobel算子进行边缘检测时,查看相关算子,结合自己的理解。对于其中三种检测方式做出说明,不对的地方请大家指正。

* 检测原图 read_image (Image, 'printer_chip/printer_chip_01')

在这里插入图片描述

一、默认Sobel检测算子sobel_amp

* 在各个方向上都均匀的检测边缘信息 sobel_amp (Image, EdgeAmplitude, 'sum_abs', 3)

在这里插入图片描述 二、使用卷积函数中默认的sobel算子

* 从图中看出检出的边缘在左侧和上侧明显(只检出了图像由暗到亮的边缘) convol_image (Image, ImageResult, 'sobel', 'mirrored')

在这里插入图片描述 三、使用自己构造的sobel算子进行卷积检测 1)、构造X方向增大的Sobel检测算子

sobelXright := [3,3,1, \ -1,0,1, \ -2,0,2, \ -1,0,1 ] * 看kernel结构,我们可以推断出,将检测出图像中X方向由暗到亮的边缘 convol_image (Image, ImageResultxright, sobelXright, 'mirrored')

在这里插入图片描述

2)、构造Y方向增大的Sobel检测算子

sobelYdown := [3, 3, 1, \ -1,-2,-1, \ 0, 0, 0, \ 1, 2, 1 ] * 看kernel结构,我们可以推断出,将检测出图像中Y方向由暗到亮的边缘 convol_image (Image, ImageResultydown, sobelYdown, 'mirrored')

在这里插入图片描述 我们将上面两小步中得到的两幅图像相加,则可得到和标题二中接近的效果

add_image (ImageResultxright, ImageResultydown, ImageResultxy1, 0.5, 0)

在这里插入图片描述

3)、构造X减小增大的Sobel检测算子

sobelXleft := [3,3, 1, \ 1,0,-1, \ 2,0,-2, \ 1,0,-1 ] * 看kernel结构,我们可以推断出,将检测出图像中X方向由亮到暗的边缘 convol_image (Image, ImageResultxleft, sobelXleft, 'mirrored')

在这里插入图片描述

4)、构造Y方向减小的Sobel检测算子

sobelYup := [3, 3, 1, \ 1, 2, 1, \ 0, 0, 0, \ -1,-2,-1 ] * 看kernel结构,我们可以推断出,将检测出图像中Y方向由亮到暗的边缘 convol_image (Image, ImageResultyup, sobelYup, 'mirrored')

在这里插入图片描述 我们将上面两小步中得到的两幅图像相加,则可得到和标题二中相反的效果

add_image (ImageResultxleft, ImageResultyup, ImageResultxy2, 0.5, 0)

在这里插入图片描述 最后,我们将上面4个小步骤结合起来,可得到和标题一接近的检测效果

add_image (ImageResultxy1, ImageResultxy2, ImageResult1, 1, 0)

在这里插入图片描述



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3