【OpenCV基础】第十四课:自定义线性滤波

算子,robert算子,sobel算子,拉普拉斯算子,filter2D

380 Views | 848 Words

Posted by x-jeff on October 17, 2020

本文为原创文章,未经本人允许,禁止转载。转载请注明出处。

1.常见算子

有关卷积和滤波的基本概念解释:【OpenCV基础】第九课:图像模糊

卷积计算在图像处理中常见的三种用途:

  1. 检测边缘。
  2. 图像模糊。
  3. 图像锐化。

卷积核也常被称为“算子”。

假设有原图如下:

👉Robert算子:

[+1001]

[0+110]

👉Sobel算子

[101202101]

[121000121]

👉拉普拉斯算子:

[010141010]

2.API

1
2
3
4
5
6
7
8
9
void filter2D( 
	InputArray src, //输入图像
	OutputArray dst, //输出图像
	int ddepth, //位图深度
	InputArray kernel, //卷积核/算子
	Point anchor = Point(-1,-1), //锚点
	double delta = 0, //计算出来的像素值+delta
	int borderType = BORDER_DEFAULT //边缘填补方式
	);

其中kernel是自定义的算子。

3.代码地址

  1. 自定义线性滤波

0 comments
Anonymous
Markdown is supported

Be the first person to leave a comment!