|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
: w5 A; S* V6 W8 i% l7 |3 t
7 U- r9 Y0 l3 [3 dmatlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2- `/ l5 p* l: t |& d( E* x: t
r7 l+ S& _8 j% R9 J$ q; A2 D$ A- Y* b
conv2 Two dimensional convolution.
5 p E. I, M* x; a1 N% W
8 G! m ~ J/ `- \, n8 z/ T1 H! K* L% U C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.
5 f; k) v- _" ]0 t+ T& j" k7 _ If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then+ j" Q/ C, @( {# R" |9 {
mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).
! D* r3 r5 o# x( W7 J! K3 _( N 6 p; k0 B) A I# ~
C = conv2(H1, H2, A) first convolves each column of A with the vector- B5 S$ i- _: B* t8 S4 U# P% t& n9 ~& L3 e
H1 and then convolves each row of the result with the vector H2. If8 b/ C1 E9 r8 i8 }; C/ `
n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then
0 ]2 ~% t- v$ ^3 ^: X" |3 h mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]).
8 P2 U8 d+ U7 j3 Q9 ~, R conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to0 i! z3 } k2 N6 N8 J6 c6 j
round-off.$ O" S7 {* Z$ M# V) v+ F f: u
6 C. _) O4 P! M% V0 f* I" ^) Z
C = conv2(..., SHAPE) returns a subsection of the 2-D
. C2 C+ f. {6 f5 I& p# j convolution with size specified by SHAPE:4 q, j# P U$ B& p& }9 d# @) h, ]" X+ s
'full' - (default) returns the full 2-D convolution, n: {3 B$ h! K4 f: Q7 o
'same' - returns the central part of the convolution5 I8 t2 Q# J3 R! w$ I, [
that is the same size as A.3 l/ V2 `' a3 l G$ m* z
'valid' - returns only those parts of the convolution8 p5 }" S& C# E$ {* _5 w
that are computed without the zero-padded edges.
, @% V) m& x: u size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).. b4 p) I5 [; S+ q1 S
3 N( w9 A2 U3 x% G! U) _6 W- S( \( d
关于full, same以及valid三种参数的区别,如下面的实例所示:9 v9 I0 z R( _! U* ]
7 u5 S, ~" h5 _+ E9 Y& I+ c$ rfull# N& I. r& J/ G7 Q5 S1 T
5 [: b+ U) y4 |7 F2 v
) J- A8 i! }3 F3 s# V; r
2 l" O. r& H! `: {, E: i
, h5 M4 s7 a! c7 }; F$ D
same
! Y; `6 q2 F+ W/ y* R9 J: t9 B& q
4 k! E7 P# f$ R: k; A" I
3 P+ k' T; K0 q: p
- C! |3 O: m7 f; h( Z/ X( q, F: Uvalid
2 A# F' l# ~7 S5 ^: ?& _
: m% @9 D! U9 F& v* Y( A4 ]
0 L1 ?) I8 |* g% p
3 p! R6 P' a. r1 @ h8 k6 |. g5 w6 t6 Z- {% Z3 |
|
|