|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
! G1 F# P, m7 m y
( E, j. c: G! B' r# S: X. Y2 Hmatlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2. q9 ~8 g) s/ C0 r5 x7 D/ O
1 w+ V7 b2 R, o5 b. b5 G# V
conv2 Two dimensional convolution.* @7 T) V$ `5 S& t2 e
. J+ G& F. C+ ]$ d1 O0 C: D C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.
" u) b1 v/ ]& M! n If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then4 x; g$ @. K) D% a/ S
mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).
# V8 B) }( F1 _8 P6 p/ C6 x 6 Q, O' ]/ r5 d6 x9 }
C = conv2(H1, H2, A) first convolves each column of A with the vector
' _7 C7 ^& W0 B7 w! F9 V7 p A H1 and then convolves each row of the result with the vector H2. If- {* n+ T' R% Y! }' W9 V
n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then
1 p( e% e% {0 K9 n" P) _ mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]).
9 {7 @2 d/ t# V: ]$ a8 P conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to4 }- D5 X; ?0 k+ m
round-off.
8 t* v( p8 N/ d
6 X! N$ _) B9 f! w [$ k9 n C = conv2(..., SHAPE) returns a subsection of the 2-D
b5 U0 Q4 v$ e! ]/ z8 I6 W! f convolution with size specified by SHAPE:
8 l) f2 ~$ e8 ?5 V6 n1 R. N 'full' - (default) returns the full 2-D convolution,- Q6 L0 L8 p0 v/ b
'same' - returns the central part of the convolution
9 _/ `4 X _0 F% x" K* r# U% T! G that is the same size as A.
y7 V* d0 D2 O; B: w, P, r 'valid' - returns only those parts of the convolution; b1 W4 v) k: K- E/ F3 ]
that are computed without the zero-padded edges.
* T5 G- W9 H' Q% s size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).
& [0 H, F! H5 R2 J8 X8 o/ x2 I- } F7 m
7 P/ S8 V) {9 h6 B- I1 c关于full, same以及valid三种参数的区别,如下面的实例所示:* d' S [1 c8 _4 e0 p2 O" I, o
, B8 D( ^0 D2 c
full
; R9 Q& ]# j: u; S; t1 m- M$ r' m5 f, |( t4 W, Z# p; ? k
1 @" v9 p" S) _6 a4 Z$ l
( P3 `( k" ]% _5 P5 E
5 ^2 {4 \1 M6 A: D. H7 U2 msame
% _ I5 K0 d( y* N4 R0 s; m7 N8 | N0 _8 d) r/ t/ K
7 H: E2 Y. j" Q7 G* b% S2 B8 v1 q
/ s$ k u. Q& y/ m7 X$ v' Q, ~- v, ~: ~
valid; _9 D7 n8 f) _( c F
$ K/ r% b9 n3 _" y% X8 j+ I I' x E+ J% W; I
7 W4 {: ^# ]9 J6 R8 m- Q: @, H
0 G) }* M# k z/ m
|
|