M. Wu: ENEE631 Digital Image Processing (Spring'09) Fourier Transform and Spatial Filtering Spring ’09 Instructor: Min Wu Electrical and Computer Engineering.

Slides:



Advertisements
Similar presentations
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 4 – Digital Image Representation Klara Nahrstedt Spring 2009.
Advertisements

Spatial Filtering (Chapter 3)
Image Processing Lecture 4
Chapter 3 Image Enhancement in the Spatial Domain.
Image Processing Frequency Filtering Instructor: Juyong Zhang
Image Processing A brief introduction (by Edgar Alejandro Guerrero Arroyo)
CS 4487/9587 Algorithms for Image Analysis
Digital Image Processing
Digital Image Processing In The Name Of God Digital Image Processing Lecture3: Image enhancement M. Ghelich Oghli By: M. Ghelich Oghli
Lecture 4 Linear Filters and Convolution
6/9/2015Digital Image Processing1. 2 Example Histogram.
Image Filtering CS485/685 Computer Vision Prof. George Bebis.
Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain.
Image Enhancement in the Frequency Domain Part I Image Enhancement in the Frequency Domain Part I Dr. Samir H. Abdul-Jauwad Electrical Engineering Department.
Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering
Image Enhancement.
About this Course Subject: Textbook Reference book Course website
ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission Linear 2-D Image Filtering 1-D discrete convolution 2-D discrete convolution 2-D.
Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 4 Image Enhancement in the Frequency Domain Chapter.
Most slides from Steve Seitz
EE313 Linear Systems and Signals Fall 2010 Initial conversion of content to PowerPoint by Dr. Wade C. Schwartzkopf Prof. Brian L. Evans Dept. of Electrical.
Digital Signals and Systems
M. Wu: ENEE631 Digital Image Processing (Spring'09) Edge Detection and Basics on 2-D Random Signal Spring ’09 Instructor: Min Wu Electrical and Computer.
EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
CS 376b Introduction to Computer Vision 02 / 26 / 2008 Instructor: Michael Eckmann.
Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5: ;
Chapter 2 Discrete-Time Signals and Systems
Computer Vision – Enhancement(Part II) Hanyang University Jong-Il Park.
Spatial Filtering: Basics
Image Processing © 2002 R. C. Gonzalez & R. E. Woods Lecture 4 Image Enhancement in the Frequency Domain Lecture 4 Image Enhancement.
ENG4BF3 Medical Image Processing Image Enhancement in Frequency Domain.
ENEE631 Digital Image Processing (Spring'04) Image Restoration Spring ’04 Instructor: Min Wu ECE Department, Univ. of Maryland, College Park  
1 Lecture 1: February 20, 2007 Topic: 1. Discrete-Time Signals and Systems.
Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005 Digital Image Processing Chapter 4: Image Enhancement in the.
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Chapter 3 Intensity Transformations.
Image Subtraction Mask mode radiography h(x,y) is the mask.
COMP322/S2000/L171 Robot Vision System Major Phases in Robot Vision Systems: A. Data (image) acquisition –Illumination, i.e. lighting consideration –Lenses,
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities Prof. Charlene Tsai.
EEE 503 Digital Signal Processing Lecture #2 : EEE 503 Digital Signal Processing Lecture #2 : Discrete-Time Signals & Systems Dr. Panuthat Boonpramuk Department.
ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,
ENEE631 Digital Image Processing (Spring'04) Signal Processing: From 1-D to 2-D (m-D) Spring ’04 Instructor: Min Wu ECE Department, Univ. of Maryland,
ENEE631 Digital Image Processing (Spring'04) Basics on 2-D Random Signal Spring ’04 Instructor: Min Wu ECE Department, Univ. of Maryland, College Park.
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP7 Spatial Filters Miguel Tavares Coimbra.
1 Methods in Image Analysis – Lecture 3 Fourier CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2004 George Stetten, M.D., Ph.D.
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities May 2, 2005 Prof. Charlene Tsai.
CS Spring 2010 CS 414 – Multimedia Systems Design Lecture 4 – Audio and Digital Image Representation Klara Nahrstedt Spring 2010.
Machine Vision Edge Detection Techniques ENT 273 Lecture 6 Hema C.R.
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Digital Image Processing CSC331
ENEE631 Digital Image Processing (Spring'04) Fourier Transform and Spatial Filtering Spring ’04 Instructor: Min Wu ECE Department, Univ. of Maryland, College.
Computer Vision – 2D Signal & System Hanyang University Jong-Il Park.
Spatial Filtering (Chapter 3) CS474/674 - Prof. Bebis.
Image Enhancement in the Spatial Domain.
Miguel Tavares Coimbra
Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University.
Review of DSP.
REMOTE SENSING Digital Image Processing Radiometric Enhancement Geometric Enhancement Reference: Chapters 4 and 5, Remote Sensing Digital Image Analysis.
CE Digital Signal Processing Fall Discrete-time Fourier Transform
Digital Image Processing CSC331
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities Prof. Charlene Tsai.
ELE 488 Fall 2006 Image Processing and Transmission
Digital Image Processing
Signal Processing: From 1-D to 2-D (m-D)
Computer Vision Lecture 16: Texture II
Lecture 3 (2.5.07) Image Enhancement in Spatial Domain
Tania Stathaki 811b LTI Discrete-Time Systems in Transform Domain Ideal Filters Zero Phase Transfer Functions Linear Phase Transfer.
Chapter 9 Advanced Topics in DSP
Review of DSP.
Presentation transcript:

M. Wu: ENEE631 Digital Image Processing (Spring'09) Fourier Transform and Spatial Filtering Spring ’09 Instructor: Min Wu Electrical and Computer Engineering Department University of Maryland, College Park   bb.eng.umd.edu (select ENEE631 S’09)   ENEE631 Spring’09 Lecture 5 (2/9/2009)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [2] Overview Last Time: –Dithering and Halftoning –2-D signals and systems Today –2-D Linear Shift-Invariant (LSI) Systems –2-D Fourier Transform –Image Enhancement via Spatial Filtering UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [3] Separability x[n 1,n 2 ] is called a separable signal if it can be expressed as x[n 1,n 2 ] = f[n 2 ]  g[n 1 ] –In matrix notation of the image X, an separable image can be represented by the outer product of two column vectors: X = f  g T –E.g. the impulse signal is separable:  [n 1,n 2 ] =  [n 1 ]   [n 2 ] Separable signals form a special class of multi-dimensional signals –Consider indices range: 0  n 1  N 1  1, 0  n 2  N 2  1 –A general 2-D signal x[n 1,n 2 ] has N 1  N 2 degrees of freedom –A separable signal has only N 1 + N 2  1 degrees of freedom UMCP ENEE631 Slides (created by M.Wu © 2004) = *

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [4] Review and Clarify (1): Separability x[n 1,n 2 ] is called a separable signal if it can be expressed as x[n 1,n 2 ] = f[n 2 ]  g[n 1 ] –In matrix notation of the image X, an separable image can be represented by the outer product of two column vectors: X = f  g T –E.g. the impulse signal is separable:  [n 1,n 2 ] =  [n 1 ]   [n 2 ] Separable signals form a special class of multi-dimensional signals –Consider indices range: 0  n 1  N 1  1, 0  n 2  N 2  1 –A general 2-D signal x[n 1,n 2 ] has N 1  N 2 degrees of freedom –A separable signal has only N 1 + N 2  1 degrees of freedom UMCP ENEE631 Slides (created by M.Wu © 2004) = *

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [5] Periodicity of 2-D Discrete Signal x[n 1,n 2 ] is (rectangular) periodic with a (positive integer- valued) period T 1 -by- T 2 at rectangular repetition grid if x[n 1,n 2 ] = x[n 1 +T 1, n 2 ] = x[n 1, n 2 +T 2 ] for  integers (n 1, n 2 ) –Interpreting the conditions: periodic tiling of column and row strips => tiling a basic rectangular shaped cell over a rectangular grid Example: cos[  n 1 /2 +  n 2 ] is periodic with a period 4-by-2 –Is cos[ n1 + n2 ] periodic? –Periodicity of continuous vs discrete signal: sampled version of two- variable sinusoids are generally not periodic, unless periods are integers. How about tiling of a non-rectangular cell or at a non- rectangular grid? => More general periodicity UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [6] (2) Periodicity of 2-D Discrete Signal x[n 1,n 2 ] is (rectangular) periodic with a (positive integer- valued) period T 1 -by- T 2 at rectangular repetition grid if x[n 1,n 2 ] = x[n 1 +T 1, n 2 ] = x[n 1, n 2 +T 2 ] for  integers (n 1, n 2 ) –Interpreting the conditions: periodic tiling of column and row strips => tiling a basic rectangular shaped cell over a rectangular grid Example: cos[  n 1 /2 +  n 2 ] is periodic with a period 4-by-2 –Is cos[ n1 + n2 ] periodic? –Periodicity of continuous vs discrete signal: sampled version of two- variable sinusoids are generally not periodic, unless periods are integers. How about tiling of a non-rectangular cell or at a non- rectangular grid? => More general periodicity UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [7] More General 2-D Periodicity x[n 1,n 2 ] is general periodic with two integer period vectors N 1 -by- N 2 if for  integers (n 1, n 2 ) we have x[n 1,n 2 ] = x[n 1 +N 11, n 2 +N 21 ] i.e. x[ n + N 1 ] = x[n 1 +N 12, n 2 +N 22 ] i.e. x[ n + N 2 ] –Periodic tiling of a cell enclosed by N 1 and N 2. –Linearly independent period vectors: det(N 1, N 2 )  0 –Rectangular periodicity occurs when matrix [N 1 N 2 ] is diagonal. Will revisit such non-rectangular tiling in “lattice sampling” and texture analysis UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [8] Review: Characterizing 2-D System A 2-D system often refers to a system that maps a 2-D input signals to a 2-D output signal –Such as system can be represented by y[n 1,n 2 ] = H ( x[n 1,n 2 ] ) Linear system H( ) : for all a, b, x1[ ], x2[ ] H (a  x 1 [n 1,n 2 ] + b  x 2 [n 1,n 2 ]) = a  H (x 1 [n 1,n 2 ]) + b  H (x 2 [n 1,n 2 ]) Impulse responses: h(m,n; m’,n’) = H (  [m-m’, n-n’] ) is the output at location (m,n) in response to a unit impulse at (m’,n’) => Point Spread Function (PSF): impulse response for system with positive inputs & outputs (such as intensity of light in imaging system) A linear sys can be characterized by its impulse responses UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [9] Shift Invariance Shift invariance: If H (x[m, n]) = y[m,n], then H ( x[m - m 0, n - n 0 ] ) = y[m - m 0, n - n 0 ] Impulse response for Linear Shift-Invariant (LSI) System –A function of the two displacement index variable only: h(m,n; m’,n’) = h[ m-m’, n-n’] i.e. the shape of the impulse response does not change as the input impulse move in the (m,n) plane I/O relation for a LSI system: –Equal to the convolution of the input with an impulse response UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [10] Shift Invariance Shift invariance: If H (x[m, n]) = y[m,n], then H ( x[m - m 0, n - n 0 ] ) = y[m - m 0, n - n 0 ] Impulse response for Linear Shift-Invariant (LSI) System –A function of the two displacement index variable only: h(m,n; m’,n’) = h[ m-m’, n-n’] i.e. the shape of the impulse response does not change as the input impulse move in the (m,n) plane I/O relation for a LSI system: –Equal to the convolution of the input with an impulse response UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [11] 2-D Convolution 1.Rotate the impulse response array h( ,  ) around the original by 180 degree 2.Shift by (m, n) and overlay on the input array x(m’,n’) 3.Sum up the element-wise product of the above two arrays 4.The result is the output value at location (m, n) From Jain’s book Example 2.1 UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [12] 2-D Fourier Transforms UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [13] Review of 1-D Fourier Transform UMCP ENEE624 Slides (created by M.Wu © 2003)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [14] 2-D Fourier Transform for a 2-D continuous function u Horizontal and vertical spatial frequencies (unit: cycles per degree of viewing angle) –Separability: u separable 2-D complex exponentials allow 2-D transform to be realized by a succession of 1-D transforms along each spatial coordinate –Many other properties can be extended from 1-D FT u convolution in one domain  multiplication in another domain u inner product preservation (Parseval energy conservation theorem) UMCP ENEE408G Slides (created by M.Wu © 2002) F(  x, y)F(  x,  y ) F(  x, y)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [15] 2-D Fourier Transform for a 2-D continuous function u Horizontal and vertical spatial frequencies (unit: cycles per degree of viewing angle) –Separability: u separable 2-D complex exponentials allow 2-D transform to be realized by a succession of 1-D transforms along each spatial coordinate –Many other properties can be extended from 1-D FT u convolution in one domain  multiplication in another domain u inner product preservation (Parseval energy conservation theorem) UMCP ENEE408G Slides (created by M.Wu © 2002) F(  x, y)F(  x,  y ) F(  x, y)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [16] Freq. Response & Eigen Functions for LSI System Eigen function of a system –Defined as an input function that is reproduced at the output with a possible change only by a multiplicative factor (i.e. amplitude and phase) –Eigen function for 1-D LTI system is exp[j2  x  x ] Fundamental property of a Linear Shift Invariant System –Eigen functions are 2-D complex exponentials exp[j2  (x  x + y  y )] Frequency response H(  x,  y ) for a 2-D continuous LSI system is the Fourier Transform of its impulse response u represents the (complex) amplitude of the system response for an complex exponential input at spatial frequency (  x,  y ) exp[j2  (x  x + y  y )] H(  x,  y ) exp[j2  (x  x + y  y )] H UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [17] Freq. Response & Eigen Functions for LSI System Eigen function of a system –Defined as an input function that is reproduced at the output with a possible change only by a multiplicative factor (i.e. amplitude and phase) –Eigen function for 1-D LTI system is exp[j2  x  x ] Fundamental property of a Linear Shift Invariant System –Eigen functions are 2-D complex exponentials exp[j2  (x  x + y  y )] Frequency response H(  x,  y ) for a 2-D continuous LSI system is the Fourier Transform of its impulse response u represents the (complex) amplitude of the system response for an complex exponential input at spatial frequency (  x,  y ) exp[j2  (x  x + y  y )] H(  x,  y ) exp[j2  (x  x + y  y )] H UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [18] 2-D Discrete Space Fourier Transform For Discrete/Sampled 2-D Functions Note: (1) X(  1,  2 ) is periodic with period 2  by 2  (2) exp{j(m  1 + n  2 )} are eigen functions of 2-D discrete LSI system UMCP ENEE408G Slides (created by M.Wu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [19] 2-D Discrete Space Fourier Transform For Discrete/Sampled 2-D Functions Note: (1) X(  1,  2 ) is periodic with period 2  by 2  (2) exp{j(m  1 + n  2 )} are eigen functions of 2-D discrete LSI system UMCP ENEE408G Slides (created by M.Wu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [20] 2-D DFT (on Discrete Periodic 2-D Function) –W N = exp{- j2  / N} complex conjugate of primitive N th root of unity –Separability: realize 2-D DFT by succession of 1-D DFTs u Allow for leveraging 1-D fast transform algorithms for 2-D –Circular convolution in one domain ~ multiplication in another domain u convolving w/ periodic signal => circular convolution –Overall normalizing factor of the transform pair = 1 / (MN) UMCP ENEE408G Slides (created by M.Wu © 2002, 2007)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [21] 2-D DFT Property Tables are from Gonzalez-Woods 2/e online slides; book pp

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [22]

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [23]

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [24] Image examples are from Gonzalez-Woods 2/e online slides. 2-D sinc function plots from B. Liu Princeton EE488 F’06. UMCP ENEE408G Slides (created by M.Wu © 2002) Slide from B. Liu – EE488 F’06 Princeton Examples of 2-D DFT

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [25] 2-D Box Function and its FT Image examples are from Gonzalez-Woods 3/e online slides. F[ u, v ] = ATZ [sin(  uT) / (  uT)] [sin(  vZ) / (  vZ)]

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [26] Frequency Domain View of Linear Spatial Filtering Image examples are from Gonzalez-Woods 2/e online slides Fig.4.4 & 4.7. UMCP ENEE408G Slides (created by M.Wu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [27] Optical and Modulation Transfer Function Optical Transfer Function (OTF) for a LSI imaging system –Defined as its normalized frequency response Modulation Transfer Function (MTF) –Defined as the magnitude of the OTF UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [28] MTF of Human Visual System Direct MTF measurement of Human Visual System (HVS) –Use sinusoidal grating of varying contrast and spatial frequency u The contrast is specified by ratio of maximum to minimum intensity u Observation of this grating shows the visibility thresholds at various spatial frequencies Typical MTF has band-pass shape –Suggest HVS is most sensitive to mid-freq. and least to high freq. –Some variations with viewer & viewing angle From Jain’s book Figure 3.7 UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [29] Image Enhancement via Spatial Filtering UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [30] Spatial Operations with Spatial Mask Spatial mask is 2-D finite impulse response (FIR) filter –Usually has small support 2x2, 3x3, 5x5, 7x7 –Convolve this filter with image u g(m,n) =  f(m-x, n-y) h(x,y) =  f(x,y) h(m-x, n-y) … mirror w.r.t. origin, then shift & sum up –In frequency domain: multiplying DFT(image) with DFT(filter) UMCP ENEE631 Slides (created by M.Wu © 2004) Note: spatial mask is often specified as the already mirrored version of the equivalent FIR filter. Image examples are from Gonzalez-Woods 2/e online slides.

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [31] Spatial Averaging Masks For softening, noise smoothing, LPF before subsampling(anti-aliasing), etc. –“isotropic” (i.e. circularly symmetric / rotation invariant) filters: with response independent of directions 1/ / /9 01/8 1/ /8 0 0 UMCP ENEE408G/631 Slides (created by M.Wu & R.Liu © 2002/2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [32] Frequency Response of Averaging Mask Recall: averaging mask is a FIR filter with a square support => take FT to get its frequency response: it is a low pass filter Image examples are from Gonzalez-Woods 2/e online slides. UMCP ENEE408G Slides (created by M.Wu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [33] Suppressing Noise via Spatial Averaging Image with i.i.d. noise y(m,n) = x(m,n) + N(m,n) Averaged version v(m,n) = (1/N w )  x(m-i, n-j) + (1/N w )  N(m-i, n-j) Noise variance reduced by a factor of N w –N w ~ # of pixels in the averaging window SNR improved by a factor of N w if x(m,n) is constant in local window Window size is limited to avoid blurring UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [34] Directional Smoothing Problems with simple spatial averaging mask –Edges get blurred Improvement –Restrict smoothing to along edge direction –Avoid filtering across edges Directional smoothing –Compute spatial average along several directions –Take the result from the direction giving the smallest changes before & after filtering Other solutions –Use more explicit edge detection and adapt filtering accordingly  WW UMCP ENEE631 Slides (created by M.Wu © 2001)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [35] Coping with Salt-and-Pepper Noise ( From Matlab Image Toolbox Guide Fig & ) UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [36] Median Filtering Salt-and-Pepper noise –Isolated white/black pixels spread randomly over the image –Spatial averaging filter may incur blurred output Median filtering –Take median over a small window as output ~ nonlinear u Median{ x(m) + y(m) }  Median{x(m)} + Median{y(m)} –Odd window size is commonly used u 3x3, 5x5, 7x7 u 5-pixel “ + ”-shaped window –Even-sized window ~ take the average of two middle values as output Generalize: apply order statistic operations UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [37] Image Sharpening Use LPF to generate HPF –Subtract a low pass filtered result from the original signal –HPF extracts edges and transitions Enhance edges I 0  I LP  I HP = I 0 – I LP  I 1 = I 0 + a*I HP UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [38] Example of Image Sharpening –v(m,n) = u(m,n) + a * g(m,n) –Often use Laplacian operator to obtain g(m,n) –Laplacian operator is a discrete form of 2 nd -order derivatives 0-¼ ¼ 0 0 UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [39] Example of Image Sharpening Original moon image is from Matlab Image Toolbox. UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [40] Other Variations of Image Sharpening High boost filter (Gonzalez-Woods 2/e pp132 & pp188) I 0  I LP  I HP = I 0 – I LP  I 1 = (b-1) I 0 + I HP –Equiv. to high pass filtering for b=1 –Amplify or suppress original image pixel values when b  2 Combine sharpening with histogram equalization Image example is from Gonzalez- Woods 2/e online slides. UMCP ENEE408G Slides (created by M.Wu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [41] Spatial LPF, HPF, & BPF HPF and BPF can be constructed from LPF Low-pass filter –Useful in noise smoothing and downsampling/upsampling High-pass filter –h HP (m,n) =  (m,n) – h LP (m,n) –Useful in edge extraction and image sharpening Band-pass filter –h BP (m,n) = h L2 (m,n) – h L1 (m,n) –Useful in edge enhancement –Also good for high-pass tasks in the presence of noise u avoid amplifying high-frequency noise UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [42] Frequency Domain View of LPF / HPF UMCP ENEE631 Slides (created by M.Wu © 2004) Image example is from Gonzalez-Woods 2/e online slides.

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [43] Summary of Today’s Lecture 2-D Fourier Transform Image enhancement via spatial filtering –Filtering with a small FIR filter –Averaging vs. Mean filtering Next time –Edge detection –2-D random signals Readings –Gonzalez’s book: Chapter 3.4–3.7; Chapter 4; –Additional ref: Woods’ Book 1.1, 1.2; 4.1, 4.2; 6.6 UMCP ENEE631 Slides (created by M.Wu © 2004; 2009)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [44] Extra: For Future Lectures UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [45] Gradient, 1 st -order Derivatives, and Edges Edge: pixel locations of abrupt luminance change For binary image –Take black pixels with immediate white neighbors as edge pixel u Detectable by XOR operations For continuous-tone image –Spatial luminance gradient vector of an edge pixel  edge u a vector consists of partial derivatives along two orthogonal directions u gradient gives the direction with highest rate of luminance changes –How to represent edge? u by intensity + direction => Edge map ~ edge intensity + directions –Detection Method-1: prepare edge examples (templates) of different intensities and directions, then find the best match –Detection Method-2: measure transitions along 2 orthogonal directions UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [46] Common Gradient Operators for Edge Detection –Move the operators across the image and take the inner products u Magnitude of gradient vector g(m,n) 2 = g x (m,n) 2 + g y (m,n) 2 u Direction of gradient vector tan –1 [ g y (m,n) / g x (m,n) ] –Gradient operator is HPF in nature ~ could amplify noise u Prewitt and Sobel operators compute horizontal and vertical differences of local sum to reduce the effect of noise Roberts H 1 (m,n) H 2 (m,n) PrewittSobel UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [47] Examples of Edge Detectors –Quantize edge intensity to 0/1: u set a threshold u white pixel denotes strong edge RobertsPrewittSobel UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [48] Examples of Edge Detectors –Quantize edge intensity to 0/1: u set a threshold u white pixel denotes strong edge RobertsPrewittSobel UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [49] Edge Detection: Summary Measure gradient vector –Along two orthogonal directions ~ usually horizontal and vertical u g x =  L /  x u g y =  L /  y –Magnitude of gradient vector u g(m,n) 2 = g x (m,n) 2 + g y (m,n) 2 u g(m,n) = |g x (m,n) | + |g y (m,n)| (preferred in hardware implement.) –Direction of gradient vector u tan –1 [ g y (m,n) / g x (m,n) ] Characterizing edges in an image –(binary) Edge map: specify “edge point” locations with g(m,n) > thresh. –Edge intensity map: specify gradient magnitude at each pixel –Edge direction map: specify directions UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [50]

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [51] 2-D Z-Transform The 2-D Z-transform is defined by –The space represented by the complex variable pair (z 1, z 2 ) is 4-D Unit surface –If ROC include unit surface Transfer function of discrete LSI system UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [52] Example of 2-D ZT and Region of Convergence See Lim’s book UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [53] Stability Recall for 1-D LTI system –Stability condition in bounded-input bounded-output sense (BIBO) is that the impulse response h[n] is absolutely summable u i.e. ROC of H(z) includes the unit circle –The ROC of H(z) for a causal and stable system should have all poles inside the unit circle 2-D Stable LSI system –Requires the 2-D impulse response is absolutely summable –i.e. ROC of H(z 1, z 2 ) must include the unit surface |z 1 |=1, |z 2 |=1 UMCP ENEE631 Slides (created by M.Wu © 2004)

M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec5 – 2D FT & Spatial Filtering [54] Stability Recall for 1-D LTI system –Stability condition in bounded-input bounded-output sense (BIBO) is that the impulse response h[n] is absolutely summable u i.e. ROC of H(z) includes the unit circle –The ROC of H(z) for a causal and stable system should have all poles inside the unit circle 2-D Stable LSI system –Requires the 2-D impulse response is absolutely summable –i.e. ROC of H(z 1, z 2 ) must include the unit surface |z 1 |=1, |z 2 |=1 UMCP ENEE631 Slides (created by M.Wu © 2004)