首先什么是卷积?
WIKI https://en.wikipedia.org/wiki/Convolution
公式如果忘了话可以看看这个http://open.163.com/movie/2006/1/C/M/M6TUO44DQ_M6TUPUBCM.html
上公式
f 中心遍历过h , 卷积就完成了
C++: void filter2D( InputArray src, OutputArray dst, int ddepth, InputArray kernel, Point anchor=Point(-1,-1),
double delta=0, int borderType=BORDER_DEFAULT )
ddepth –
desired depth of the destination image; if it is negative, it will be the same as src.depth() ; the following com
– src.depth() = CV_8U , ddepth = -1/ CV_16S / CV_32F / CV_64F
– src.depth() = CV_16U / CV_16S , ddepth = -1/ CV_32F / CV_64F
– src.depth() = CV_32F , ddepth = -1/ CV_32F / CV_64F
kernel – convolution kernel (or rather a correlation kernel), a single-channel floating point
matrix; if you want to apply different kernels to different channels, split the image into
separate color planes using split() and process them individually.
anchor – anchor of the kernel that indicates the relative position of a filtered point within the
kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.
delta – optional value added to the filtered pixels before storing them in dst .
borderType – pixel extrapolation method (see borderInterpolate() for details).
– src.depth() = CV_64F , ddepth = -1/ CV_64F
when ddepth=-1 , the output image will have the same depth as the source.
参考
1.http://www.cse.psu.edu/~rtc12/CSE486/ lecture 3
2.opencv cookbook 2nd edition 52页,170页
3.http://blog.csdn.net/zouxy09/article/details/49080029 这个讲的非常好 直观详细