Matlab 矩阵卷积理解(转载)

转载自: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 的计算结果如下: 
这里写图片描述

原文地址:https://www.cnblogs.com/jason-wyf/p/6195560.html