matlab二维卷积,[转载]conv2 --matlab 二维卷积命令

本文详细介绍了MATLAB中的二维卷积函数conv2的使用方法,包括其语法、参数选项以及算法实现。conv2函数用于计算两个矩阵的二维卷积,可以用于图像滤波。它提供了全尺寸、相同大小和有效区域三种输出形状的选择。此外,还解释了卷积在实际操作中如何处理有限区间,并展示了与一维滤波的结合应用。
摘要由CSDN通过智能技术生成

conv2

Two-dimensional convolution

Syntax

C = conv2(A,B)

C = conv2(hcol,hrow,A)

C = conv2(...,'shape')

Description

C = conv2(A,B) computes the two-dimensional convolution of matrices

A and B. If one of these matrices describes a two-dimensional

finite impulse response (FIR) filter, the other matrix is filtered

in two dimensions.

The size of C in each dimension is equal to the sum of the

corresponding dimensions of the input matrices, minus one. That is,

if the size of A is [ma,na] and the size of B is [mb,nb], then the

size of C is [ma+mb-1,na+nb-1].

C = conv2(hcol,hrow,A) convolves A first with the vector hcol

along the rows and then with the vector hrow along the columns. If

hcol is a column vector and hrow is a row vector, this case is the

same as C = conv2(hcol*hrow,A).

C = conv2(...,'shape') returns a subsection of the

two-dimensional convolution, as specified by the shape

parameter:

fullReturns the full two-dimensional convolution

(default).sameReturns the central part of the convolution of the

same size as A.valid Returns only those parts of the convolution

that are computed without the zero-padded edges. Using this option,

C has size [ma-mb+1,na-nb+1] when all(size(A) >=

size(B)). Otherwise conv2 returns [].

Algorithm

conv2 uses a straightforward formal implementation of the

two-dimensional convolution equation in spatial form.

If and are functions of two

discrete variables, and , then the formula for

the two-dimensional convolution of and is

In practice however, conv2 computes the convolution for finite

intervals.

Note that matrix indices in MATLAB always start at 1 rather than

0. Therefore, matrix elements A(1,1), B(1,1), and C(1,1) correspond

to mathematical quantities a(0,0), b(0,0), and c(0,0).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值