|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
, a" X- |- u9 a% M/ Q3 c# r+ D, D5 E' ]
matlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2
; a# W/ G$ N: t% D6 ]: N7 B1 A7 [" e Z4 ?1 o# \/ f K8 W
conv2 Two dimensional convolution.4 x0 V% N" O- s& r& w' \
* W& _) w( y! H' ^ C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.2 D' e8 k3 j) u# K* [" d
If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then; d# S. V9 p, D2 w$ a
mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).
! a% S7 g6 ?, V' G5 N ' Q) `& \4 M- X: i9 H* n3 E: m3 z& X: t1 ~
C = conv2(H1, H2, A) first convolves each column of A with the vector
9 y R: ?6 h$ q( X( ?& K) \ H1 and then convolves each row of the result with the vector H2. If/ i: J0 \- Z# T4 E5 g+ o, E% q$ F
n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then
; O0 |+ D1 P: G8 r mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]).
2 D' _) r" z' j; P conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to
* u4 E f( N! {& W round-off.
, Y3 W. k8 t9 S0 [: ?8 @2 C * H1 {3 D' Q e0 L
C = conv2(..., SHAPE) returns a subsection of the 2-D
5 v$ d8 Q- r5 L% @2 J: f convolution with size specified by SHAPE:
4 s& v4 }$ o! y 'full' - (default) returns the full 2-D convolution,/ L) T9 Z- l/ L5 D1 ?
'same' - returns the central part of the convolution5 H+ Q! u+ C- J
that is the same size as A.) z# n& u, u) }- {. A
'valid' - returns only those parts of the convolution0 x, v$ Q! B& S. z! M, p
that are computed without the zero-padded edges.
* B. U6 c! K. e3 u" C- M size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).7 R2 w; u6 c d+ J3 Y
) Y8 E& B/ D* k- l
9 D# z0 J; B/ c2 S: {: O% C
关于full, same以及valid三种参数的区别,如下面的实例所示:
' l @: w" g! Q1 u# K/ X, [; i) f
full/ o T" `6 }1 |5 Z0 k
* K1 U7 z2 |0 k/ n* a6 i
7 R5 W% R8 o" D; w
4 q; ^4 z0 e' [/ W% q1 L
" v2 u( u8 C* X2 Msame
$ D5 {- ]0 y( W5 K/ }- c( h% z
- w9 k& S5 K0 v# t8 O% x3 [* Y
% x s8 b" l) j3 s. c! _& d2 }! e* k6 T
' s8 K7 C; N% nvalid3 d9 v. M- u6 t) Y6 H, B, _
# N3 W* V9 w1 a2 M2 {$ I7 v$ ?) I2 N7 D
% A) ~ }( b: g5 [7 w$ j
5 M" |+ @1 @2 P+ }) p/ ] K |
|