sepFilter2D函数

来源:互联网 发布:手机qq变声软件 编辑:程序博客网 时间:2024/05/29 13:24

sepFilter2D函数

函数功能:
sepFilter2D() 用分解的核函数对图像做卷积。首先,图像的每一行与一维的核kernelX做卷积;然后,运算结果的每一列与一维的核kernelY做卷积

调用格式:

void sepFilter2D(InputArray src, OutputArray dst, int ddepth, InputArray kernelX, InputArray kernelY, Pointanchor=Point(-1,-1), double delta=0, int borderType=BORDER_DEFAULT )


参数详解:

InputArray src:输入图像

OutputArray dst:输出图像

 int ddepth:输出图像的深度

The following combination of src.depth() and ddepth are supported:
  • src.depth() = CV_8Uddepth = -1/CV_16S/CV_32F/CV_64F
  • src.depth() = CV_16U/CV_16Sddepth = -1/CV_32F/CV_64F
  • src.depth() = CV_32Fddepth = -1/CV_32F/CV_64F
  • src.depth() = CV_64Fddepth = -1/CV_64F

InputArray kernelX:x方向的卷积核

InputArray kernelY:y方向的卷积核

Pointanchor=Point(-1,-1):处理的像素是核中心的像素

double delta=0:表示像素是不是加增量

int borderType=BORDER_DEFAULT:图像边界的处理方式



opencv代码:

#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc/imgproc.hpp>#include <iostream>#include<stdlib.h>using namespace cv;using namespace std;int main(){Mat src, dst;src = imread("D:6.jpg");Mat kx = (Mat_<float>(1, 3) << 0,-1,0);Mat ky = (Mat_<float>(1, 3) << -1,0, -1);sepFilter2D(src, dst, src.depth(),kx,ky,Point(-1,-1),0,BORDER_DEFAULT );imshow("shiyan", dst);waitKey(0);return 0;}



0 0