【转】MATLAB conv2函数的理解

时间:2023-03-09 07:59:56
【转】MATLAB conv2函数的理解

另附:http://blog.csdn.net/anan1205/article/details/12313593

原文:http://blog.csdn.net/andrewseu/article/details/51783181

在图像处理的过程中,经常会看到矩阵卷积的概念,比如说用一个模板去和一张图片进行卷积,因此很有必要了解矩阵卷积到了做了什么,具体又是怎么计算的。 
在matlab中有conv2函数对矩阵进行卷积运算,其中有一个shape参数,取值具体有三种:

 -full  - (default) returns the full 2-D convolution,
-'same' - returns the central part of the convolution
that is the same size as A.
-'valid' - returns only those parts of the convolution
that are computed without the zero-padded edges.
size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).

用一幅图可以很好的理解这三个参数代码的具体含义: 
【转】MATLAB conv2函数的理解

矩阵卷积计算方法

【转】MATLAB conv2函数的理解 
【转】MATLAB conv2函数的理解 
举一个简单的例子, 
【转】MATLAB conv2函数的理解 
matlab 的计算结果如下: 
【转】MATLAB conv2函数的理解