60 520 Presentation Image Filters Student Xiaoliu Chen

  • Slides: 46
Download presentation
60 -520 Presentation Image Filters Student: Xiaoliu Chen Instructor: Dr. I. Ahmad School of

60 -520 Presentation Image Filters Student: Xiaoliu Chen Instructor: Dr. I. Ahmad School of Computer Science University of Windsor November 2003 Image Filters

Outline n Introduction n Spatial Filtering – Smoothing – Sharpening n Frequency-Domain Filtering –

Outline n Introduction n Spatial Filtering – Smoothing – Sharpening n Frequency-Domain Filtering – Low pass – High pass n Summary Image Filters 2

Introduction n Filtering is the process of replacing a pixel with a value based

Introduction n Filtering is the process of replacing a pixel with a value based on some operations or functions. n The operations/functions used on the original image are called filters. – or masks, kernels, templates, windows… Image Filters 3

Introduction n In digital image processing, filters are usually used to – suppress the

Introduction n In digital image processing, filters are usually used to – suppress the high frequencies in an image • i. e. , smoothing the image – suppress the low frequencies in an image • i. e. , enhancing or detecting edges in the image Image Filters 4

Introduction n Image filters fall into two categories: – Spatial domain • Filters are

Introduction n Image filters fall into two categories: – Spatial domain • Filters are based on direct manipulation of pixels on an image plane. – Frequency domain • Filters are based on modifying the Fourier transform (FT) of an image. Image Filters 5

Spatial Filters n The general processes can be denoted by the expression: – f(x,

Spatial Filters n The general processes can be denoted by the expression: – f(x, y) is the input image – g(x, y) is the processed image – T is an operator on f, defined over some neighborhood of (x, y) Image Filters 6

Spatial Filters n The principal approach in defining a neighborhood about a point (x,

Spatial Filters n The principal approach in defining a neighborhood about a point (x, y) – use a subimage area centered at (x, y) – shapes of the neighborhood • circle • square • rectangular Image Filters 7

Spatial Filters Example: 3× 3 neighborhood about a point (x, y) in an image

Spatial Filters Example: 3× 3 neighborhood about a point (x, y) in an image x (x, y) (x-1, y-1) (x-1, y) (x, y-1) (x+1, y-1) (x, y) (x+1, y) Image f(x, y) (x-1, y+1) (x+1, y+1) y Image Filters 8

x Mask w(-1, -1) w(0, -1) w(1, -1) w(-1, 0) w(0, 0) w(1, 0)

x Mask w(-1, -1) w(0, -1) w(1, -1) w(-1, 0) w(0, 0) w(1, 0) w(-1, 1) w(0, 1) w(1, 1) Image f(x, y) y f(x-1, y-1) f(x-1, y) f(x, y-1) f(x+1, y-1) f(x, y) Mask coefficients f(x+1, y) f(x-1, y+1) f(x+1, y+1) Image Filters Pixels under mask 9

Spatial Filters – linear filters n For linear spatial filtering, the result, R, at

Spatial Filters – linear filters n For linear spatial filtering, the result, R, at a point (x, y) is R=w(-1, -1)f(x-1, y-1) + w(0, -1)f(x, y-1) + …+ w(0, 0)f(x, y) +… + w(0, 1)f(x, y+1) + w(1, 1)f(x+1, y+1) Image Filters 10

Spatial Filters – convolution n In general, linear filtering of an image is given

Spatial Filters – convolution n In general, linear filtering of an image is given by the expression: – The image f is of size M×N – The filter mask is of size m×n m=2 a+1, n=2 b+1 Image Filters 11

Spatial Filters – smoothing n Smoothing filters are used for blurring and for noise

Spatial Filters – smoothing n Smoothing filters are used for blurring and for noise reduction. n Smoothing, linear spatial filter – average filters – reduce “sharp” transitions – side effect Image Filters 12

Spatial Filters – smoothing, linear n Mean filters – example: Gaussian noise Original 1

Spatial Filters – smoothing, linear n Mean filters – example: Gaussian noise Original 1 1 1 1 1 Image Filters 5× 5 3× 3 mean filter 13

Spatial Filters – smoothing, linear n Mean filters – example: Salt and pepper 1

Spatial Filters – smoothing, linear n Mean filters – example: Salt and pepper 1 1 1 1 1 Image Filters 5× 5 3× 3 mean filter 14

Spatial Filters – smoothing, linear n Weighted average filters – example: 1 2 4

Spatial Filters – smoothing, linear n Weighted average filters – example: 1 2 4 2 – general expression: 1 2 1 Image Filters 15

Spatial Filters – smoothing, nonlinear n Order-statistic filters – nonlinear spatial filters – order/rank

Spatial Filters – smoothing, nonlinear n Order-statistic filters – nonlinear spatial filters – order/rank the pixels contained in the image area encompassed by the filter Image Filters 16

Spatial Filters – smoothing, nonlinear n Median filters – replace a pixel value with

Spatial Filters – smoothing, nonlinear n Median filters – replace a pixel value with the median of its neighboring pixel values – example: 23 25 26 30 40 Neighborhood values: 15, 19, 20, 23, 24, 25, 26, 27, 50 22 24 26 27 35 Median value: 24 11 16 10 20 30 18 20 50 25 34 19 15 19 23 33 Image Filters 17

Spatial Filters – smoothing, nonlinear n Median filters – have excellent noise-reduction capabilities V.

Spatial Filters – smoothing, nonlinear n Median filters – have excellent noise-reduction capabilities V. S. Gaussian noise removed. Image Filters By 3× 3 median filter by 3× 3 mean filter 18

Spatial Filters – smoothing, nonlinear n Median filters – are particularly effective in salt

Spatial Filters – smoothing, nonlinear n Median filters – are particularly effective in salt & pepper V. S. Salt & pepper removed. Image Filters By 3× 3 median filter by 3× 3 mean filter 19

Spatial Filters – smoothing, nonlinear n Max filters – maximum of neighboring pixel values

Spatial Filters – smoothing, nonlinear n Max filters – maximum of neighboring pixel values – useful for finding the brightest points in an image n Min filters – minimum of neighboring pixel values – useful for finding the darkest points in an image Image Filters 20

Spatial Filters – sharpening n Principal objective – highlight fine detail in an image

Spatial Filters – sharpening n Principal objective – highlight fine detail in an image – enhance detail that has been blurred n Sharpening can be accomplished by spatial differentiation Image Filters 21

Spatial Filters – sharpening n For one dimensional function f(x) – first order derivative

Spatial Filters – sharpening n For one dimensional function f(x) – first order derivative – second order derivative Image Filters 22

Spatial Filters – sharpening – A sample (a) (b) 5 5 4 3 2

Spatial Filters – sharpening – A sample (a) (b) 5 5 4 3 2 1 0 0 0 6 0 0 1 3 1 0 0 7 7 (c) -1 -1 -1 0 0 6 -6 0 0 0 1 2 -2 -1 0 0 0 7 0 0 0 (d) -1 0 0 1 0 6 -12 (a) a scan line (c) first derivative 6 0 0 1 1 -4 1 1 0 0 7 -7 0 0 (b) image strip (d) second derivative Image Filters 23

Spatial Filters – sharpening n The Laplacian – second derivative of a two dimensional

Spatial Filters – sharpening n The Laplacian – second derivative of a two dimensional function f(x, y) = [f(x+1, y)+f(x-1, y)+f(x, y+1)+f(x, y-1)] -4 f(x, y) Image Filters 24

Spatial Filters – sharpening n The Laplacian – use a convolution mask to approximate

Spatial Filters – sharpening n The Laplacian – use a convolution mask to approximate 0 1 -4 1 0 1 1 -8 1 1 Image Filters -1 2 -4 2 -1 25

Spatial Filters – sharpening n The Laplacian – example: Image Filters 26

Spatial Filters – sharpening n The Laplacian – example: Image Filters 26

Spatial Filters – sharpening n The Laplacian – example: Image Filters 27

Spatial Filters – sharpening n The Laplacian – example: Image Filters 27

Frequency Filters – Fourier transform n Fourier transform (FT) – decompose an image into

Frequency Filters – Fourier transform n Fourier transform (FT) – decompose an image into its sine and cosine components – transform real space images into Fourier or frequency space images – In a frequency space image, each point represents a particular frequency contained in the real domain image. Image Filters 28

Frequency Filters – Fourier transform n Discrete n Inverse Fourier transform (DFT) DFT Image

Frequency Filters – Fourier transform n Discrete n Inverse Fourier transform (DFT) DFT Image Filters 29

Frequency Filters – Fourier transform – example: FT (log) Image Filters 30

Frequency Filters – Fourier transform – example: FT (log) Image Filters 30

Frequency Filters n Basic steps for filtering in the frequency domain Filter function DFT

Frequency Filters n Basic steps for filtering in the frequency domain Filter function DFT f(x, y) Input image F(u, v) Inverse DFT H(u, v)F(u, v) g(x, y) Processed image Image Filters 31

Frequency Filters n Frequencies in an image correspond to the rate of change in

Frequency Filters n Frequencies in an image correspond to the rate of change in pixel values – High frequencies • rapid changes of gray level values – Low frequencies • slow changes of gray level values Image Filters 32

Frequency Filters n Lowpass filters – attenuate high frequencies while “passing” low frequencies n

Frequency Filters n Lowpass filters – attenuate high frequencies while “passing” low frequencies n Highpass filters – attenuate low frequencies while “passing” high frequencies Image Filters 33

Frequency Filters – lowpass filters n Ideal lowpass filters (ILPF) Image Filters 34

Frequency Filters – lowpass filters n Ideal lowpass filters (ILPF) Image Filters 34

Frequency Filters – lowpass filters n Butterworth lowpass filters (BLPF) Image Filters 35

Frequency Filters – lowpass filters n Butterworth lowpass filters (BLPF) Image Filters 35

Frequency Filters – lowpass filters n Gaussian lowpass filters (GLPF) Image Filters 36

Frequency Filters – lowpass filters n Gaussian lowpass filters (GLPF) Image Filters 36

Frequency Filters – highpass filters n Highpass filters – Ideal higpass filters (IHPF) –

Frequency Filters – highpass filters n Highpass filters – Ideal higpass filters (IHPF) – Butterworth highpass filters (BHPF) – Gaussian highpass filters (GHPF) Image Filters 37

Image Filters 38

Image Filters 38

Frequency Filters – bandpass filters n Bandpass filters – attenuate very low frequencies and

Frequency Filters – bandpass filters n Bandpass filters – attenuate very low frequencies and very high frequencies – – enhance edges while reducing the noise at the same time Image Filters 39

Frequency Filters n Examples: (lowpass filters) Gaussian noise Original ILPF with BLPF ILPF cut-off

Frequency Filters n Examples: (lowpass filters) Gaussian noise Original ILPF with BLPF ILPF cut-off frequency of of 1/2 1/3 cut-off 1/3 Image Filters 40

Frequency Filters n Examples: (highpass filters) Image Filters 41

Frequency Filters n Examples: (highpass filters) Image Filters 41

Frequency Filters n Relationship and comparison with spatial filters – spatial filtering – frequency

Frequency Filters n Relationship and comparison with spatial filters – spatial filtering – frequency filtering – Image Filters 42

Frequency Filters n Comparison with spatial filters – more computational efficient – more intuitive

Frequency Filters n Comparison with spatial filters – more computational efficient – more intuitive Image Filters 43

Summary n Filtering is the operation of applying a transform on an image in

Summary n Filtering is the operation of applying a transform on an image in order to enhance it. n Filtering techniques can be subdivided into two types – Spatial domain filtering – Frequency domain filtering Image Filters 44

Summary n Filtering techniques are very useful in image analysis and processing – Noise

Summary n Filtering techniques are very useful in image analysis and processing – Noise removal – Edge detection Image Filters 45

Thank you The&end Questions ? Image Filters 46

Thank you The&end Questions ? Image Filters 46