1D and 2D signal processing Convolution 1D and 2D signal processing
Convolution Theorem Let F and H be the Fourier transforms of f and h For big filters, can be faster to convert to fourier domain, then multiply, then convert back Let F and H be the Fourier transforms of f and h Convolution in the spatial (image) domain is equivalent to multiplication in the frequency (Fourier) domain
Symmetric theorem: Convolution in the frequency domain is equivalent to multiplication in the spatial domain
2-D Convolution thm f(x,y) h(x,y) g(x,y) * |F(sx,sy)| |H(sx,sy)| |G(sx,sy)|
Consider the delta function
Time-shift delta
Sample the input (it’s a convolution!)
What is the spectrum?
Fourier Coefficients
CTFT
Euler’s identity
Sine-cos Rep
Harmonic Analysis
Convolution=time-shift&multi
Convolution Thm multiplication in the time domain = convolution in the frequency domain
Sample
Spectrum reproduced spectrum to be reproduced at intervals
Summary
Example of 1D convoln
2D Convolution
2D Convolution
Region of Support The region of support is defined as that area of the .kernel which is non-zero linear convolution:=signal has infinite extent but kernel has finite support If function has finite region of support we have compact support
Real images have finite region of support But we treat them as periodic and infinite! We repeat kernels so that they have the same period as the images. We call this cyclic convolution.
Convolution in 2D
Avoid the Mod op
What is wrong with avoiding the mod op? How do I find the center of the kernel?
Cyclic Convolution
Implementing Convolution for(int y = 0; y < height; y++) { for(int x = 0; x < width; x++) { sum = 0.0; for(int v = -vc; v <= vc; v++) for(int u = -uc; u <= uc; u++) sum += f[cx(x-u) ][cy(y-v)] * k[ u+uc][v+vc]; if (sum < 0) sum = 0; if (sum > 255) sum = 255; h[x][y] = (short)sum; }
What happens to the image if you ignore the wrap?
Cyclic Convolution keeps the edges
Can you think of a better way to implement convolution? Keep the edges! Don’t use the mod operation. How about growing the image by the size of the kernel*2?
Convolution is slow, how can I speed it up? JAI! FFT!? Other ideas?
But JAI… Eats my edges! Devised j2d Border Implement that using MDI!
For HW Integrate the BorderFrame in j2d.border into the MDI interface so that you can apply the BorderPanel to the input image. Use the RunSpinnerSlider to dynamic alter the parameters. Update the image dynamically Apply the change with an apply button.