Convolution is Commutative: g(n)*(n)=h(n)*(n) associative: x(o *gn)]*h(n)=xn *h n *g n)1 Distributive x n *ign)+h(n)=x(n)*g(n)+(n)*h(n) Application: edge finding In practice only accept convoluted values obtained when edge mask and image are fully overlapped Tutorial for CMSC5711: Edge vo. 1a 16
Convolution is • Commutative : g(n)*h(n)=h(n)*g(n) • associative: {x(n)*g(n)}*h(n)=x(n)*{h(n)*g(n)} • Distributive • x(n)*{g(n)+h(n)}=x(n)*g(n)+x(n)*h(n) • Application: edge finding • In practice : only accept convoluted values obtained when edge mask and image are fully overlapped. Tutorial for CMSC5711 : Edge v0.1a 16
http://en.wikipediaorg/wiki/convolution 1-D convolution examples Example 1 Area under f(o)(tt) 0.8 (f+g) 0.4 0.2 15 -0.5 05 1.5 &t · Example2 Area under f(rg(t-t f() g(t-t 0.5 〔+9)) -1.5 -05 0.5 1.5 2.5 c&tl: Edge vo. la 17
1-D convolution examples • Example 1 • Example 2 http://en.wikipedia.org/wiki/Convolution Tutorial for CMSC5711 : Edge v0.1a 17
Another demo Insight to Convolution You can AdjustI 1.0 0.1 0.01 0 0.33 0.06 3d8 0.24 0.17 20dB1.0 0.03 Pusher→ 0.03 Thoughts on Convolution Instructions Lecture 2 Example 1 Delay Example Audio Dots On/off Example 2 LPF Example Audio 0.03 Example 3 HPF Example Audi Example 4 BPFExample Audio JC OKE www.fourier-series.comcopyrighto2008BrentLocher Tutorial for CMSC5711: Edge vo. 1a 18
Another demo • http://www.fourier-series.com/fourierseries2/flash_programs/Convolution/index.html Tutorial for CMSC5711 : Edge v0.1a 18
Discrete convolution correlation is more intuitive so we use correlation of the flipped version of h to implement convolution h= find*h 253 convolution C(Omn)=∑∑h k)×I(j,k) -0k=-∞ Flipped h ∑∑hm(-m+,-n+k)×(,k) k: correlation Tutorial for CMSC5711: Edge vo. 1a 19
Discrete convolution: Correlation is more intuitive • so we use correlation of the flipped version of h to implement convolution[1] = =− = =− = =− = =− = − + − + = − − j j k k flip j j k k h m j n k I j k C m n h m j n k I j k ( , ) ( , ) ( , ) ( , ) ( , ) ( ) 1 4 1 1 1 , ,find * 2 5 3 1 1 I h I h = = − correlation convolution Flipped h Tutorial for CMSC5711 : Edge v0.1a 19
Matlab(octave) code for convolution =[141; 253] h=[11; conv 2 (,h) pause disp('It is the same as the following ) conv (h pause disp('It is the same as the following xcorr2 (, fliplr(fliud(h))) Tutorial for CMSC5711: Edge vo. 1a
Matlab (octave) code for convolution • I=[1 4 1; • 2 5 3] • h=[1 1 ; • 1 -1] • conv2(I,h) • pause • disp('It is the same as the following'); • conv2(h,I) • pause • disp('It is the same as the following'); • xcorr2(I,fliplr(flipud(h))) Tutorial for CMSC5711 : Edge v0.1a 20