|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
. z" N- X( Y3 C% x1 r( ~' g2 a* k( l& _8 [2 C; C7 a; p( O6 H, h/ T' N
matlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2+ C. r0 z8 e |6 w
$ S5 d# c- R2 ]% H
conv2 Two dimensional convolution.
5 a4 u# K' `; F2 J" g* l& e4 g
2 }' b6 M+ h/ K; e C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.
, p2 |# z- h8 S* w If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then1 Y w+ m4 F, g8 ~
mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).
' V. T$ c4 I. k9 K$ G1 x
* z9 d* T( }# W: v2 `: h C = conv2(H1, H2, A) first convolves each column of A with the vector
" T* m( [; x0 e7 ]. k, q s7 Z* c H1 and then convolves each row of the result with the vector H2. If
+ G/ @9 r; y+ {, k; w. Z! Q( q n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then
+ M, |$ O& v$ u: O# Z0 A0 g# ? mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]).
& l: `* d# T4 l6 A& g8 K conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to& j. Y$ Y: Q5 l- }
round-off.- N4 ]1 B9 C& ]! N
0 q' y- z: r( u7 Z5 N$ \" r$ G
C = conv2(..., SHAPE) returns a subsection of the 2-D4 C. v3 g/ ]4 g1 H3 v, h+ Y \
convolution with size specified by SHAPE:; j6 u% l4 \0 v- z: J; A
'full' - (default) returns the full 2-D convolution,
: v( I0 n" N# J8 R/ h& ` 'same' - returns the central part of the convolution5 B* P3 B7 a' A: G9 F5 j
that is the same size as A.
' o! c& J+ T. f+ ` 'valid' - returns only those parts of the convolution
: j; ~* e1 x. g" X3 m! A: J$ _" q/ ? that are computed without the zero-padded edges.
! X L) ]7 E' `; ~4 @ size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).
! T) J, Y1 O0 J- Q5 x- T
5 R+ p/ g& y! a- ]2 |; x
/ v+ ]& K, [ u# r7 u) ]关于full, same以及valid三种参数的区别,如下面的实例所示:; m$ a! _2 p6 K; l
( o" ?9 h3 U5 j& @) c. u5 w: N
full* N3 t8 w( C, m2 @* ?6 D
/ g r! N# J7 |
' s* d- o' N& r! r6 j
! [% o2 L* v9 P4 K0 E" ?1 d
6 o8 _7 B e; |8 b* [3 ksame
8 r5 y3 m6 ?- Q+ s9 G+ }4 |- {$ R- r6 P% r
& F$ S" \* _3 {4 p7 c
2 @8 m9 O0 ]8 X+ Y! l* x w% o6 N5 N9 p9 a" q
valid U; K1 t& S1 v4 }1 w n) R0 ]
" M' y# K9 y" e' ~, j
2 D6 U6 c* k" ?% m# l' l- S
$ K) K# `4 y9 N: U1 `' n6 p$ U' @
& i3 Q* D6 D4 j# F
|
|