Image Processing Frequency Filtering Instructor: Juyong Zhang

Slides:



Advertisements
Similar presentations
HILBERT TRANSFORM Fourier, Laplace, and z-transforms change from the time-domain representation of a signal to the frequency-domain representation of the.
Advertisements

Image Enhancement in the Frequency Domain (2)
Spatial Filtering (Chapter 3)
Frequency Domain Filtering (Chapter 4)
1 Image Processing Ch4: Filtering in frequency domain Prepared by: Tahani Khatib AOU.
Image Enhancement in the Frequency Domain Part III
© by Yu Hen Hu 1 ECE533 Digital Image Processing Image Enhancement in Frequency Domain.
Chap 4 Image Enhancement in the Frequency Domain.
Lecture 14 The frequency Domain (2) Dr. Masri Ayob.
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
Digital Image Processing
Chapter 4 Image Enhancement in the Frequency Domain.
CHAPTER 4 Image Enhancement in Frequency Domain
Image Enhancement in the Frequency Domain Part III Dr. Samir H. Abdul-Jauwad Electrical Engineering Department King Fahd University of Petroleum & Minerals.
Chap 4-2. Frequency domain processing Jen-Chang Liu, 2006.
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F(  ) is the spectrum of the function.
Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain.
Image Enhancement.
Chapter 4 Image Enhancement in the Frequency Domain.
Transforms: Basis to Basis Normal Basis Hadamard Basis Basis functions Method to find coefficients (“Transform”) Inverse Transform.
Basic Image Processing January 26, 30 and February 1.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 4 Image Enhancement in the Frequency Domain Chapter.
02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize.
Chapter 2. Image Analysis. Image Analysis Domains Frequency Domain Spatial Domain.
Presentation Image Filters
1 Chapter 8: Image Restoration 8.1 Introduction Image restoration concerns the removal or reduction of degradations that have occurred during the acquisition.
Medical Image Analysis Image Enhancement Figures come from the textbook: Medical Image Analysis, by Atam P. Dhawan, IEEE Press, 2003.
Digital Image Processing Chapter # 4 Image Enhancement in Frequency Domain Digital Image Processing Chapter # 4 Image Enhancement in Frequency Domain.
Image Processing © 2002 R. C. Gonzalez & R. E. Woods Lecture 4 Image Enhancement in the Frequency Domain Lecture 4 Image Enhancement.
CS654: Digital Image Analysis
Chapter 7: The Fourier Transform 7.1 Introduction
Filtering Robert Lin April 29, Outline Why filter? Filtering for Graphics Sampling and Reconstruction Convolution The Fourier Transform Overview.
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
Digital Image Processing CSC331 Image Enhancement 1.
ENG4BF3 Medical Image Processing Image Enhancement in Frequency Domain.
Computer Vision – Enhancement(Part III) Hanyang University Jong-Il Park.
Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 2
Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005 Digital Image Processing Chapter 4: Image Enhancement in the.
Image Subtraction Mask mode radiography h(x,y) is the mask.
Chapter 11 Filter Design 11.1 Introduction 11.2 Lowpass Filters
University of Ioannina - Department of Computer Science Filtering in the Frequency Domain (Application) Digital Image Processing Christophoros Nikou
Practical Image Processing1 Chap7 Image Transformation  Image and Transformed image Spatial  Transformed domain Transformation.
Sejong Univ. CH3. Area Processes Convolutions Blurring Sharpening Averaging vs. Median Filtering.
(c) 2002 University of Wisconsin, CS 559
Image Enhancement (Frequency Domain)
Computer Graphics & Image Processing Chapter # 4 Image Enhancement in Frequency Domain 2/26/20161.
G52IIP, School of Computer Science, University of Nottingham 1 Image Transforms Basic idea Input Image, I(x,y) (spatial domain) Mathematical Transformation.
Digital Image Processing Lecture 9: Filtering in Frequency Domain Prof. Charlene Tsai.
Frequency Domain Filtering. Frequency Domain Methods Spatial Domain Frequency Domain.
Fourier transform.
Amity School of Engineering & Technology 1 Amity School of Engineering & Technology DIGITAL IMAGE PROCESSING & PATTERN RECOGNITION Credit Units: 4 Mukesh.
Digital Image Processing Lecture 8: Image Enhancement in Frequency Domain II Naveed Ejaz.
Spatial Filtering (Chapter 3) CS474/674 - Prof. Bebis.
Digital Image Processing , 2008
Jean Baptiste Joseph Fourier
Image Subtraction Mask mode radiography h(x,y) is the mask.
Spatial & Frequency Domain
Gaussian Lowpass Filter
Image Enhancement in the
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F() is the spectrum of the function.
Digital Image Processing
ENG4BF3 Medical Image Processing
Outline Linear Shift-invariant system Linear filters
4. Image Enhancement in Frequency Domain
Digital Image Processing
Digital Image Processing
Basic Image Processing
Lecture 4 Image Enhancement in Frequency Domain
Presentation transcript:

Image Processing Frequency Filtering Instructor: Juyong Zhang

Convolution Property of the Fourier Transform The Fourier Transform of a convolution equals the product of the Fourier Transforms. Similarly, the Fourier Transform of a convolution is the product of the Fourier Transforms * = convolution · = multiplication 5/5/20152

Convolution via Fourier Transform Image & Mask Transforms Pixel-wise Product Inverse Transform 5/5/20153

1.Read the image from a file into a variable, say I. 2.Read in or create the convolution mask, h. 3.Compute the sum of the mask: s = sum(h(:)); 4.If s == 0, set s = 1; 5.Replace h with h = h/s; 6.Create: H = zeros(size(I)); 7.Copy h into the middle of H. 8.Shift H into position: H = ifftshift(H); 9.Take the 2D FT of I and H : FI=fft2(I); FH=fft2(H); 10.Pointwise multiply the FTs: FJ=FI.*FH; 11.Compute the inverse FT: J = real(ifft2(FJ)); How to Convolve via FT in Matlab For color images you may need to do each step for each band separately. The mask is usually 1-band 5/5/20154

Coordinate Origin of the FFT Center = (floor(R/2)+1, floor(C/2)+1) Center = (floor(R/2)+1, floor(C/2)+1) Even Odd Image OriginWeight Matrix OriginImage OriginWeight Matrix Origin After FFT shiftAfter IFFT shiftAfter FFT shiftAfter IFFT shift 5/5/20155

Matlab’s fftshift and ifftshift J = fftshift(I): I ( 1, 1 )  J (  R/2  + 1,  C/2  + 1 ) I = ifftshift(J): J (  R/2  + 1,  C/2  + 1 )  I ( 1, 1 ) where  x  = floor(x) = the largest integer smaller than x /5/20156

Blurring: Averaging / Lowpass Filtering Blurring results from: l Pixel averaging in the spatial domain: – Each pixel in the output is a weighted average of its neighbors. – Is a convolution whose weight matrix sums to 1. l Lowpass filtering in the frequency domain: – High frequencies are diminished or eliminated – Individual frequency components are multiplied by a nonincreasing function of  such as 1/  = 1/  (u 2 +v 2 ). The values of the output image are all non-negative. 5/5/20157

Sharpening: Differencing / Highpass Filtering Sharpening results from adding to the image, a copy of itself that has been: l Pixel-differenced in the spatial domain: – Each pixel in the output is a difference between itself and a weighted average of its neighbors. – Is a convolution whose weight matrix sums to 0. l Highpass filtered in the frequency domain: – High frequencies are enhanced or amplified. – Individual frequency components are multiplied by an increasing function of  such as  =  (u 2 +v 2 ), where  is a constant. The values of the output image positive & negative. 5/5/20158

Convolution Property of the Fourier Transform The Fourier Transform of a convolution equals the product of the Fourier Transforms. Similarly, the Fourier Transform of a convolution is the product of the Fourier Transforms * = convolution · = multiplication Recall: 5/5/20159

10 Ideal Lowpass Filter

Fourier Domain Rep. Spatial Representation Central Profile Image size: 512x512 FD filter radius: 16 Image size: 512x512 FD filter radius: 16 Multiply by this, or … … convolve by this 5/5/201511

Spatial Representation Central Profile Ideal Lowpass Filter Image size: 512x512 FD filter radius: 8 Image size: 512x512 FD filter radius: 8 Multiply by this, or … … convolve by this 5/5/ Fourier Domain Rep.

Power Spectrum and Phase of an Image Consider the image below: Original Image Power Spectrum Phase 5/5/201513

Ideal LPF in FD Original Image Power Spectrum Ideal Lowpass Filter Image size: 512x512 FD filter radius: 16 Image size: 512x512 FD filter radius: 16 5/5/201514

Filtered Power Spectrum Ideal Lowpass Filter Image size: 512x512 FD filter radius: 16 Image size: 512x512 FD filter radius: 16 5/5/ Filtered Image Original Image

5/5/ Ideal Highpass Filter

Fourier Domain Rep. Spatial Representation Central Profile Image size: 512x512 FD notch radius: 16 Image size: 512x512 FD notch radius: 16 Multiply by this, or … … convolve by this 5/5/201517

Ideal HPF in FD Original Image Power Spectrum Ideal Highpass Filter Image size: 512x512 FD notch radius: 16 Image size: 512x512 FD notch radius: 16 5/5/201518

Original Image Filtered Image* Filtered Power Spectrum Ideal Highpass Filter Image size: 512x512 FD notch radius: 16 Image size: 512x512 FD notch radius: 16 5/5/ *signed image: 0 mapped to 128

Filtered Image* Positive Pixels Negative Pixels Ideal Highpass Filter Image size: 512x512 FD notch radius: 16 Image size: 512x512 FD notch radius: 16 *signed image: 0 mapped to 128 5/5/201520

5/5/ Ideal Bandpass Filter

5/5/ A bandpass filter is created by (1)subtracting a FD radius  2 lowpass filtered image from a FD radius  1 lowpass filtered image, where  2 <  1, or (2)convolving the image with a mask that is the difference of the two lowpass masks. FD LP mask with radius  1 FD LP mask with radius  2 FD BP mask  1 -  2 - =

Ideal Bandpass Filter 5/5/ *signed image: 0 mapped to 128 image LPF radius  1 image LPF radius  2 image BPF radii  1,  2 *

Ideal Bandpass Filter original image* filter power spectrum filtered image 5/5/ *signed image: 0 mapped to 128

A Different Ideal Bandpass Filter original image filter power spectrum filtered image* 5/5/ *signed image: 0 mapped to 128

5/5/ The Optimal Filter

The Uncertainty Relation FT spacefrequency A small object in space has a large frequency extent and vice-versa. 5/5/ spacefrequency FT

The Uncertainty Relation Recall: a symmetric pair of impulses in the frequency domain becomes a sinusoid in the spatial domain. A symmetric pair of lines in the frequency domain becomes a sinusoidal line in the spatial domain. 5/5/ space frequency  small extent   large extent  IFT space frequency  large extent   small extent   large extent  IFT

Ideal Filters Do Not Produce Ideal Results A sharp cutoff in the frequency domain… …causes ringing in the spatial domain. IFT 5/5/201529

Ideal Filters Do Not Produce Ideal Results Ideal LPF Blurring the image above with an ideal lowpass filter… …distorts the results with ringing or ghosting. 5/5/201530

Optimal Filter: The Gaussian The Gaussian filter optimizes the uncertainty relation. It provides the sharpest cutoff with the least ringing. IFT 5/5/201531

One-Dimensional Gaussian 5/5/201532

Two-Dimensional Gaussian If  and  are different for r & c … …or if  and  are the same for r & c. r c R = 512, C = 512  = 257,  = 64 5/5/201533

Gaussian LPF With a gaussian lowpass filter, the image above … … is blurred without ringing or ghosting. Optimal Filter: The Gaussian 5/5/201534

Compare with an “Ideal” LPF Ideal LPF Blurring the image above with an ideal lowpass filter… …distorts the results with ringing or ghosting. 5/5/201535

5/5/ Gaussian Lowpass Filter

Fourier Domain Rep. Spatial Representation Central Profile Image size: 512x512 SD filter sigma = 8 Image size: 512x512 SD filter sigma = 8 Gaussian Lowpass Filter Multiply by this, or … … convolve by this 5/5/201537

Fourier Domain Rep. Spatial Representation Central Profile Image size: 512x512 SD filter sigma = 2 Image size: 512x512 SD filter sigma = 2 Multiply by this, or … … convolve by this 5/5/ Gaussian Lowpass Filter

Gaussian LPF in FD Original Image Power Spectrum Image size: 512x512 SD filter sigma = 8 Image size: 512x512 SD filter sigma = 8 5/5/ Gaussian Lowpass Filter

Filtered Image Original Image Filtered Power Spectrum Image size: 512x512 SD filter sigma = 8 Image size: 512x512 SD filter sigma = 8 5/5/ Gaussian Lowpass Filter

5/5/ Gaussian Highpass Filter

Fourier Domain Rep. Spatial Representation Central Profile Image size: 512x512 FD notch sigma = 8 Image size: 512x512 FD notch sigma = 8 Multiply by this, or … … convolve by this 5/5/201542

Gaussian HPF in FD Original Image Power Spectrum Gaussian Highpass Filter Image size: 512x512 FD notch sigma = 8 Image size: 512x512 FD notch sigma = 8 5/5/201543

Filtered Image* Filtered Power Spectrum Gaussian Highpass Filter Image size: 512x512 FD notch sigma = 8 Image size: 512x512 FD notch sigma = 8 *signed image: 0 mapped to 128 Original Image 5/5/201544

Negative Pixels Positive Pixels Gaussian Highpass Filter Image size: 512x512 FD notch sigma = 8 Image size: 512x512 FD notch sigma = 8 Filtered Image* 5/5/ *signed image: 0 mapped to 128

Another Gaussian Highpass Filter original image filter power spectrum filtered image * 5/5/ *signed image: 0 mapped to 128

5/5/ Gaussian Bandpass Filter

5/5/ A bandpass filter is created by (1)subtracting a FD radius  2 lowpass filtered image from a FD radius  1 lowpass filtered image, where  2 <  1, or (2)convolving the image with a mask that is the difference of the two lowpass masks. FD LP mask with radius  1 FD LP mask with radius  2 FD BP mask  1 -  2 - =

Ideal Bandpass Filter original image filter power spectrum filtered image* 5/5/ *signed image: 0 mapped to 128

Gaussian Bandpass Filter 5/5/ *signed image: 0 mapped to 128 image LPF radius  1 image LPF radius  2 image BPF radii  1,  2 *

Gaussian Bandpass Filter Fourier Domain Rep. Spatial Representation Central Profile Image size: 512x512 sigma = 2 - sigma = 8 Image size: 512x512 sigma = 2 - sigma = 8 5/5/201551

Gaussian BPF in FD Original Image Power Spectrum Gaussian Bandpass Filter Image size: 512x512 sigma = 2 - sigma = 8 Image size: 512x512 sigma = 2 - sigma = 8 5/5/201552

Original Image Filtered Image * Filtered Power Spectrum Gaussian Bandpass Filter Image size: 512x512 sigma = 2 - sigma = 8 Image size: 512x512 sigma = 2 - sigma = 8 5/5/ *signed image: 0 mapped to 128

Filtered Image* Negative Pixels Filtered Image Positive Pixels Gaussian Bandpass Filter Image size: 512x512 sigma = 2 - sigma = 8 Image size: 512x512 sigma = 2 - sigma = 8 5/5/ *signed image: 0 mapped to 128

5/5/ Ideal vs. Gaussian Filters

Original Image Ideal HPF * Ideal LPF Ideal Lowpass and Highpass Filters 5/5/ *signed image: 0 mapped to 128

Original Image Gaussian HPF* Gaussian LPF 5/5/ *signed image: 0 mapped to 128 Gaussian Lowpass and Highpass Filters

Original Image Gaussian BPF * Ideal BPF * 5/5/ *signed image: 0 mapped to 128 Ideal and Gaussian Bandpass Filters

Original Image Ideal BPF* Gaussian BPF* 5/5/ *signed image: 0 mapped to 128 Gaussian and Ideal Bandpass Filters

5/5/ Effects on Power Spectrum

Power Spectrum and Phase of an Image original image power spectrum phase 5/5/201561

Power Spectrum and Phase of a Blurred Image 5/5/ blurred image power spectrum phase

Power Spectrum and Phase of an Image original image power spectrum phase 5/5/201563

Power Spectrum and Phase of a Sharpened Image 5/5/ power spectrum phase sharpened image

5 May Thanks!