|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
& W. d% T8 K$ E; ^; |# |; M J+ W- B1 `+ R' r6 ?
matlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2" c5 ^4 N5 j% {! J; m$ L; U/ }
M1 n2 z& D( e5 u- o: Uconv2 Two dimensional convolution.
. a/ D, J+ L; }4 D R2 w2 z9 n8 G9 g# L5 e4 x
C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.) n3 b" }* |1 `2 }
If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then
; \: E3 M8 B* ~8 ^& F# o* X mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).% F( n& v1 H" j ?5 A0 ?6 n
9 i+ S: R0 H* z( L C = conv2(H1, H2, A) first convolves each column of A with the vector' Z R; P0 ^" \1 C1 O# |" |8 o2 s
H1 and then convolves each row of the result with the vector H2. If
: \2 |6 [; K' E+ O& E1 S, u n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then X+ `7 ]& g1 X4 }7 J# Y) ^
mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]). c) P# k) O6 r4 U( W
conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to6 G" b% n4 L0 A }( w3 F
round-off. Q- M& R2 f1 \, A1 T2 r' A, p
0 i( h) y* E8 Q( B5 {% p
C = conv2(..., SHAPE) returns a subsection of the 2-D
' v( t, ?& [0 g! p7 s7 j, }# T convolution with size specified by SHAPE:
6 [/ J( Q( o$ C$ T& _, x- Q 'full' - (default) returns the full 2-D convolution,
8 m9 ]) E3 j& q+ {7 e2 o 'same' - returns the central part of the convolution! _3 r3 `" c# y% J l. q
that is the same size as A.
* {1 l8 V! @% E 'valid' - returns only those parts of the convolution
8 d. V/ f# {# }! T d2 u$ S that are computed without the zero-padded edges.
% ]& ]) j5 T: K9 ?4 _& Z6 {* ] size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).
% I. K8 o" Z- h0 v4 d$ a# Y, K
6 Z: ~7 t3 ^( E* s% R$ _# [
. l* |. q6 f- v. l4 f关于full, same以及valid三种参数的区别,如下面的实例所示:) ]8 ?7 K J `! T$ x
- c$ X6 \( K d( e4 efull
8 K; e; f1 |3 x! C9 T0 Z( N' A8 w* B
: M5 L, ]2 c& k
7 l+ {! s# T, K& x2 L+ f v
5 W! a) x" u! E3 z6 o+ _" A1 I: s) ]4 W7 p
same
$ B" k: t0 i$ ^8 }, R( M
( q S/ }* L5 l. X) ^
' P4 c u0 K6 P, c6 z. H3 X- O6 ~: h; ^0 l0 C7 ~7 G; @
7 o9 M! M' H; j, B" Hvalid8 S" n' ^; i+ R+ v! s8 C
/ C" ` |& e2 h% Q
2 I/ n7 s: I' P( e2 L# l
# ]" y1 v4 C# P" ?. h! S( G# `
) R( C4 Y" f. p |
|