使用opencv对图片进行边缘特征提取

本文介绍了使用OpenCV进行图像边缘特征提取的方法,包括Laplacian、Laplacian+高斯滤波、Sobel算子、Canny算子和Scharr滤波器。通过比较,发现Canny算子在消除噪声、边缘定位和抑制虚假响应方面表现最佳,而Scharr滤波器在精度上优于Sobel。最终,这些技术被整合到作者的图像处理小程序中。
摘要由CSDN通过智能技术生成

问题的描述




我们需要通过一些图像处理的手段,将a图中图像的轮廓提取出来,结果类似于b图。

解决思路

使用Laplacian

看到这个问题,我想到的第一办法就是拉普拉斯算子。ok,沿着这个思路,我通过opencv在windows平台上进行了一些测试。
Laplacian 算子的定义:

  • Laplace(f)=(2f)(x2)+(2f)(y2)

这里求导使用的方法是Sobel算子,关于Sobel算子请看2.3。
在opencv中Laplacian的函数原型

CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth,
                             int ksize = 1, double scale = 1, double delta = 0,
                             int borderType = BORDER_DEFAULT ); 

在opencv源代码中就已经说明了这个函数的使用,如下:

@param src Source image.
@param dst Destination image of the same size and the same number of channels as src .
@param ddepth Desired depth of the destination image.
@param ksize Aperture size used to compute the second-derivative filters. See getDerivKernels for details. The size must be positive and odd.
@param scale Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See getDerivKernels for details.
@param delta Optional delta value that is added to the results prior to storing them in dst .
@param borderType Pixel extrapolation method, see cv::BorderTypes

当ksize=3时,Laplacian()函数的孔径为

  • 010141010
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值