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

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

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

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

卷积定义



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


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() 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

    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中的卷积及例子


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



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值