Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
EECS490: Digital Image Processing
Lecture #10
• Wraparound and padding
• Image Correlation
• Image Processing in the frequency domain
• A simple frequency domain filter
• Frequency domain filters
– High-pass, low-pass
– Apodization
• Zero-phase filtering
• Frequency domain filters
– ideal, Butterworth, Gaussian
– Ringing
EECS490: Digital Image Processing
Wraparound and Padding
f x( ) h x( ) =1
Mf m( )
m=0
h x m( )
DFT makes f & h periodic
If f and g are 400 points f★ggoes out to 800 points
Mirror h to get h(-m)
Now shift h(-m) to get h(x-m)
Wraparound comes from overlap of the periodic functions
© 2002 R. C. Gonzalez & R. E. Woods
We must pad h with 399 points ofzero to get the correct result withthis periodic function
This was nothere before
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Wraparound and Padding
We also haveto padimages but intwo-dimensionsto get thecorrectconvolutionresults
EECS490: Digital Image Processing
No blurring at edges — no padding
© 2002 R. C. Gonzalez & R. E. Woods
Wraparound and Padding
1
16
1 2 1
2 4 2
1 2 1
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Wraparound and PaddingPadding with zeros
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Wraparound and Padding
EECS490: Digital Image Processing
Image Correlation
Original images
Padded images
Correlation output
f x, y( )*h x, y( ) =1
MNf * m,n( )h x + m, y + n( )
n=0
N 1
m=0
M 1
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
Image Processing in theFrequency Domain
© 2002 R. C. Gonzalez & R. E. Woods
a. Pad original image to PxQb. Multiply padded image by (-1)x+y
d. Fourier transform F(u,v)e. Construct real, symmetric filter H(u,v) of size PxQf. Compute F(u,v)H(u,v)g. Compute Re[F-1 {F(u,v)H(u,v)}] and multiply by (-1)x+y
h. Crop to remove padding in result
EECS490: Digital Image Processing
Fourier Transform
© 2002 R. C. Gonzalez & R. E. Woods
Due to the shortextrusion
EECS490: Digital Image Processing
Simple Frequency Domain Filter
What if we simplymultiply F(0,0) byzero?
This is the minimalhigh-pass filter
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
Simple Frequency DomainFiltering
Multiplying F(0,0) by zeromakes the average imagevalue zero— these arenegative image values whichcannot be displayed, but getcropped to zero!
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Gaussian Filters
Frequency domain filters
Corresponding spatialdomain filters
Low-pass filters High-pass filters
This is a Difference ofGaussians, called a DoG
EECS490: Digital Image Processing
Gaussian Filters
Low-pass filter
High-pass filters
Blurs image Enhances detail;lowers contrast
Addition of apreserves DC term
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
Frequency Domain Filters
© 2002 R. C. Gonzalez & R. E. Woods
1. Original frequencydomain filter H(f)
2. Spatial domainfilter h(x)= F-1{H(f)}
3. Padded spatialdomain filter hp(x)
4. Fourier transform ofpassed spatial domain filterhp(x)
Discontinuitiescaused by padding
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Phase Filters
Results of multiplying ONLY thephase of an image by a constant
MOST image processing filters operate ONLY on themagnitude and are called zero-phase-shift filters
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Frequency Domain FilteringExample
a. Original imageb. Padded imagec. Multiply by (-1)x+y
d. Fourier transform F(u,v)e. Centered Gaussian LPFH(u,v)f. Compute F(u,v)H(u,v)g. Compute F-1 {F(u,v)H(u,v)}and multiply by (-1)x+y
h. Crop to remove padding
Padded imagesoften show darkedges
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Fourier Transform of an Image
600x600 pixels F(u,v)
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Sobel spatial/frequency domainfilters
Frequency domain Sobel
Spatial domain Sobel,3x3
Frequency domainfiltering whereh(x,y) was paddedto 602x602 andcentered prior tomultiplying byF(u,v) in thefrequency domain
Spatial domainfiltering
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Ideal Low-pass Filter
Do is picked based upon the fraction of image power to be removed
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Test Pattern
Magnitude transformof padded test image
u =1
M xIf M=688 and, say, there are 688 pixels/incheach pixel in the Fourier transformscorresponds to u=1/inch
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Filtering with Ideal LPF
Filtering the paddedtest image with anILPF in the frequencydomain
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Computing the inverse Fourier transform of theILPF shows ringing in the spatial domain whichis clearly shown in Figure 4.42
Ringing
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Butterworth LPF
H u,v( ) =1
1+D u,v( )D0
2n
For n=1 there is no ringing. Theringing will increase as n increases.
EECS490: Digital Image Processing
Filtering with Butterworth filter,n=2
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
Spatial Butterworth filters
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
Gaussian LPF
H u,v( ) = eD2 u ,v( )
2D02
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
Low-pass Filters
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
Filtering with Gaussian LPF
© 2002 R. C. Gonzalez & R. E. Woods
EECS490: Digital Image Processing
Filtering for OCR
No filtering. Brokencharacters are difficult torecognize.
Filtered with a GLPF withD0=80. Characters are fullerand filled in.
© 2002 R. C. Gonzalez & R. E. Woods