您的位置:首页 > 其它

图像卷积回顾与计算优化(待续)

2014-01-21 23:12 204 查看
卷积及其计算方法是《信号与系统》与《数字信号处理》课程的一个核心知识点,谈及应用,我倒是能用的过来,在图像中简单地说就是掩模相乘,不过上次师兄谈及一个卷积优化方法,我想了想居然只想到行列分开这个。现在只能重新复习一下知识点。

学图像的应该都知道,卷积运算在图像处理领域应用相当广泛,例如在图像滤波、增强、分析等处理时都要用到卷积运算,它实质上是一种矩阵运算,其特点是运算量大,并且数据复用率高。

下面首先来回顾一下一维卷积:

卷积定义





而在图像处理中,用得主要是离散二维卷积



OpenCV中的卷积函数

filter2D——对图像作卷积运算.

C++: void filter2D(InputArray src, OutputArray dst, int ddepth, InputArray kernel, Point anchor=Point(-1,-1), double delta=0, int borderType=BORDER_DEFAULT )

C: void cvFilter2D(const CvArr* src, CvArr* dst, const CvMat* kernel, CvPoint anchor=cvPoint(-1,-1) )

参数:

 src – 输入图像.
dst –与输入图像大小相同通道数相同的输出图像 .
ddepth –
desired depth of the destination image; if it is negative, it will be the same as src.depth();
the following combinations of src.depth() andddepth are
supported:
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
src.depth() = CV_64F, ddepth =
-1/CV_64F
when ddepth=-1, the output image will have the same depth as the source.

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 usingsplit() 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 (seeborderInterpolate() for
details)


Matlab中的卷积及例子

线性卷积与圆周卷积的区别

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: