|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
8 j9 X" ?+ J8 U \. X: z. y8 W
6 E- y5 o4 z4 i1 d5 q; B+ v
matlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2
2 Z' z2 n) k* h7 w, i
: J1 H9 n7 \# S/ ^conv2 Two dimensional convolution.
7 ^0 Y; d+ P2 `+ I7 n- p! c
' O! ^& O* d* C0 P M0 M C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.
2 _2 D2 v. A6 i! T# L+ q" o If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then
7 O+ ]4 i3 S3 l mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).
" j( ]$ o1 V1 ^2 g0 ?0 R* g
8 l; d3 u9 N" K C = conv2(H1, H2, A) first convolves each column of A with the vector
l$ f4 S. I& e/ R# u! v( d H1 and then convolves each row of the result with the vector H2. If$ I2 G$ Q1 r1 H s) }
n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then
/ x7 {* z6 `, M% o7 G+ l$ x6 k0 g mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]).% i# c% s0 J6 d6 |( U
conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to
# H; @2 y( i& w! p round-off.
" v7 i( J2 p3 @ h* B0 V6 h / ?2 K5 g3 ^3 P R' t
C = conv2(..., SHAPE) returns a subsection of the 2-D
+ M; \2 d& v- g; e0 g convolution with size specified by SHAPE:4 }1 w$ V, }/ c
'full' - (default) returns the full 2-D convolution,
: A2 P5 C& k1 r 'same' - returns the central part of the convolution. b; `+ l: H2 }7 i
that is the same size as A.
/ {% g& G: {2 k 'valid' - returns only those parts of the convolution' |0 g$ H* R* I, [% ]2 f) d. A
that are computed without the zero-padded edges.
: z$ T. Z1 p t" S size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).
; w! s( i* }3 D8 I% O |9 V, z* U7 |! b: o) N# V8 |( h
" ?' L: E! A% w5 ], `! Z+ k8 p
关于full, same以及valid三种参数的区别,如下面的实例所示:8 j1 b7 V) g4 V+ o2 Z# V( M: z- M- [
3 W- d" G1 ]; O o
full
5 ~% h& D( {+ {& E0 P+ G0 _. H- ?* G- q# n& ^- y$ C0 G9 o. B; d y
, \* T, _! [: h3 x' m6 S; n3 Q$ y* K
9 @' U, w; G1 z$ Y6 [
6 [# l/ u7 [' W$ ^* w$ x- n) gsame
* D; m- \; R8 ]. `$ ]& f3 W( l. t: Z, p; w( M6 G/ m
$ y6 ^( \7 H, a h" `1 t8 g& ?+ `) S
2 c% L! K9 x2 I
/ l( U+ T: V) E2 X, w9 svalid
" c- K& I2 u# t1 f) K
1 x0 g+ i, v' {: \2 h" c
/ c0 u$ R. F+ q& O3 E
1 Z# h% C) f, v/ u( T
) d( K( C3 _* _5 r( H/ p. j |
|