imgproc 模块. 图像处理Laplace算子

Posted vince-wu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了 imgproc 模块. 图像处理Laplace算子相关的知识,希望对你有一定的参考价值。

主要步骤:

(1)高斯平滑降噪

GaussianBlur(src, src, Size(3, 3), 0, 0, BORDER_DEFAULT);

(2)转换为灰度图

cvtColor(src, src_gray, CV_RGB2GRAY);

(3)使用拉普拉斯算子并将图像转换为 CV_8U

    Laplacian(src_gray, dst, ddepth, kernel_size, scale, delta, BORDER_DEFAULT);
    convertScaleAbs(dst, abs_dst);

函数接受了以下参数:

  • src_gray: 输入图像。
  • dst: 输出图像
  • ddepth: 输出图像的深度。 因为输入图像的深度是 CV_8U ,这里我们必须定义 ddepth = CV_16S 以避免外溢。
  • kernel_size: 内部调用的 Sobel算子的内核大小,此例中设置为3。
  • scaledelta 和 BORDER_DEFAULT: 使用默认值。

以上是关于 imgproc 模块. 图像处理Laplace算子的主要内容,如果未能解决你的问题,请参考以下文章