|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
9 m7 d+ o' F% T, n: w q: X+ w( x3 Y9 S# x% M9 j' [
matlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2
: d" d& [- k3 R2 W
5 S2 H8 d) e, j% E% K) v/ s# \conv2 Two dimensional convolution.! D" Z+ y0 _2 C& d9 W7 k
Q2 P+ R$ a' A* A C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.' E; x1 G& I {0 @
If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then
' N2 v( B6 E+ h' ~ mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).8 B; g4 \. Y+ V9 Y y
- z) S) \ D( }4 P3 F: p0 ^* @7 O% G
C = conv2(H1, H2, A) first convolves each column of A with the vector
0 w* C( f9 ~' O! K' W. d H1 and then convolves each row of the result with the vector H2. If2 {; j( c9 K9 ]- l6 ?1 u: {
n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then
4 e. F C' {. C+ d. S" W. F9 r( e mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]).
$ B" \% y- q# v% b0 M ` conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to
3 z5 \. c7 h0 m- q0 v+ o# W round-off.
8 g4 N8 ]* T. v* o3 P& m& f
) W! ], u# p5 P6 D" X9 S( ] C = conv2(..., SHAPE) returns a subsection of the 2-D4 X7 u9 F, q) |, t5 a( k
convolution with size specified by SHAPE:
7 N1 N4 L$ f: q, i- ]" w 'full' - (default) returns the full 2-D convolution,9 ^5 C; I) ~1 r* u
'same' - returns the central part of the convolution0 K( J6 F2 o1 e$ [, _% Z7 J
that is the same size as A.8 y' `. {+ V* |4 e/ C
'valid' - returns only those parts of the convolution a. ]5 _# h' X4 y; `' p6 f+ h
that are computed without the zero-padded edges.% m1 j5 [+ i m9 R" F
size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).2 S# Q2 x! }/ o- ~
1 b1 U% m ^/ ?% @# `. ?; N5 I0 d8 v Y( C* Y/ U) O, L9 }
关于full, same以及valid三种参数的区别,如下面的实例所示:
, r7 m5 N' E( [' ~% h5 O& A) h$ V, k& F7 o* e" N7 s
full
6 W( ?' n! a" J* x! d1 b0 A# R" v; f
; j g6 i3 s: \$ r; p. k# r
# g6 }) T- c9 [. E' X5 x
$ H' {4 @% Y5 c1 F
same
$ B$ v/ w' W4 w% N' z. w" U z k5 W2 u' m: W5 f& z
: u! G) F) }4 Y, {1 c0 L
$ h$ h, ~5 V! v
. ~% A8 K: d2 W% `$ p
valid3 ~% P8 I" v# }, d- S7 b% U
4 L+ r6 e- C e% m. T% ?! P
9 l0 ^8 L- B6 C! s' r
8 `6 H7 c) B( N( e/ \; N$ _6 @7 O% k2 ?) \% O4 J
|
|