0% found this document useful (0 votes)
25 views51 pages

Unit 2

The document discusses various types of image filtering techniques used for modifying or enhancing digital images. It describes spatial domain filters like linear filters and order statistics filters. It also explains frequency domain filters and different types of low pass filters like ideal low pass filter and Butterworth filter used for image smoothing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views51 pages

Unit 2

The document discusses various types of image filtering techniques used for modifying or enhancing digital images. It describes spatial domain filters like linear filters and order statistics filters. It also explains frequency domain filters and different types of low pass filters like ideal low pass filter and Butterworth filter used for image smoothing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

DIGITAL IMAGE PROCESSING

IMAGE FILTERING

1
INTRODUCTION TO DIP

2
FILTERING

 Filtering is a technique used for modifying or enhancing an


image like highlight certain features or remove other features.

 Image filtering include smoothing, sharpening, and edge


enhancement

 Term ‘convolution ‘ means applying filters to an image .

 It may be applied in either

spatial domain

frequency domain.
3
SPATIAL DOMAIN FILTERS

4
MECHANISM OF SPATIAL FILTERING
This process shows
moving filter mask
point to point

Filter at each point


(x , y) are calculated
by predefined
relationship 5
LINEAR SPATIAL FILTERING
 For Linear spatial filtering,
 Result = sum of product of filter coefficient and the
corresponding image pixels

 For above figure Response R is


R = w(−1,−1)f(x-1, y -1) + w(-1,0)f(x-1, y)
+  . . + w(0,0)f(x, y) +  . + w(1,1)f(x+1, y + 1 )
 w(0,0) -indicates mask is centered at x , y

R=result or response of linear filtering 6


LINEAR SPATIAL FILTERING
 Linear filter of an image f of size M×N with a filter mask size
of m × n is given by the expression

a b
g (x, y) =   w ( s,t ) f ( x + s, y +t )
s=−a t =−b

7
LINEAR SPATIAL FILTERING
 For a mask of size=m × n

 Assume that

 m=2a+1

 n=2b+1

 Where a and b are nonnegative integers

 Then m and n are odd.

8
CONVOLUTION

 The process of linear filtering is same as convolution.

 So linear spatial filtering is referred to as “convolving a mask


with an image.”

9
 When interest lies on the response, R, of an m x n mask at
any point (x , y), and not on the mechanics of implementing
mask convolution

 It is a simplified notation

R = w1 z1 + w 2 z 2 + . . . + w m n z m n


mn
= wi zi
i=1

10
w1 w2 W3

w4 w5 w6

w7 w8 w9

For above 3 x 3 general Mask ,response at any point (x, y)


in the image is given by
9
R = w1 z1 + w 2 z 2 + ... + w9 z 9 = w z i i
i =1

11
SMOOTHING SPATIAL FILTERS
 Smoothing filters are used for blurring and for noise reduction
 Blurring is used in preprocessing steps, such as removal of
small details from an image prior to (large) object extraction,
and bridging of small gaps in lines or curves.

 Noise reduction can be accomplished by blurring with a linear


filter and also by non-linear filtering.

12
 Smoothing spatial filter is done in two ways

Linear filters

 operation performed on a pixel

Order statistics filter(non linear)

 based on ranking on pixel

13
SMOOTHING LINEAR FILTERS
 linear spatial filter is simply the average of the pixels
contained in the neighborhood of the filter mask.

 These filters sometimes are called averaging filter


 By replacing the value of every pixel in an image by the
average of the gray levels in the neighborhood defined by the
filter mask

 This process results in an image with reduced “sharp”


transitions in gray levels
14
 Two mask

 averaging filter

 weighted average

15
AVERAGING FILTER
 A major use of averaging filters is in the reduction of
“Irrelevant” detail in an image

 A spatial averaging filter in which all coefficients are equal is


sometimes called a box filter.

 Also known as low pass filter.

 m x n mask would have a normalizing constant equal to

1/ m n.

16
AVERAGING FILTER

1 1 1

1

1 1 1

9 1 1 1

R =
1
9
  z 1,
i=1
17
AVERAGING FILTER

18
WEIGHTED AVERAGING FILTER

 Pixels are multiplied by different coefficients , the pixel at the


center of the mask is multiplied by a higher value than any
other, thus giving this pixel more importance in the
calculation of the average.

 The other pixels are inversely weighted as a function of their


distance from the center of the mask

19
WEIGHTED AVERAGE
1 2 1

1
 2 4 2

16 1 2 1

20
 The general implementation for filtering an M x N image with
a weighted averaging filter of size

 m x n (m and n odd) is given by the expression

a b

  w( s , t) f ( x + s, y + 1)
g ( x, y) = s = − at = − b
a b

  w(s, t)
s = − at = − b

21
EXAMPLE OF WEIGHTED AVERAGING
FILTER

22
ORDER STATISTICS FILTERS

 Order-statistics filters are nonlinear spatial filters whose


response is based on ordering (ranking) the pixels

 Example for this filter is median filter

23
MEDIAN FILTER
 Median filters used for noise-reduction with less blurring than
linear smoothing filters of similar size.

 Median filters are particularly effective in the presence of


impulse noise also called salt-and-pepper noise because of its
appearance as white and black dots superimposed on an
image.

24
EXAMPLE FOR MEDIAN FILTER

25
FREQUENCY DOMAIN FILTERS

26
SMOOTHING FREQUENCY DOMAIN FILTERS

 Smoothing is achieved by attenuating a specified range of


high frequency component

 The concept of filter in frequency domain is same as the


concept of a mask in convolution.

G(u , v)=H(u , v)F(u , v)

27
SMOOTHING FREQUENCY DOMAIN FILTERS

 After converting an image to frequency domain, some filters


are applied in filtering process to perform different kind of
processing on an image. The processing include blurring an
image, sharpening an image etc,.

 The three type of filters for these purposes are:

 Ideal low pass filter

 Butterworth low pass filter

 Gaussian low pass filter


28
IDEAL LOW PASS FILTER

 Low-pass filtering smooth a signal or image .


 ideal low pass filter (ILPF) is one whose transfer function
satisfies the relation

 For cutoff frequency

H(u , v)= 1 if D(u , v) < D 0

0 if D(u , v) > D 0

29
 D is a specified nonnegative quantity, and D(u, v) is the
distance from point (u, v) in the frequency domain and the
center of frequency rectangle


D (u , v ) = (u − M 2 ) 2 + (v − N 2)2 
1
2

30
VISUALIZATION

Filter displayed as an image

Perspective plot of an ILPL Filter radical cross section 31


Transfer function
 The low pass filters are radially symmetric about the origin
 The complete filter transfer function can then be generated by
rotating the cross section 360 about the origin

 For an ideal low pass filter cross section, the point of


transition between H(u, v) = 1 and H(u, v) = 0 is often called
the cutoff frequency

 The sharp cutoff frequencies of an ideal low pass filter cannot


be realized with electronic components , although they can
certainly be simulated in a computer.

32
33
APPLYING ILPF TO A IMAGE IN DIFFERENT
FREQUENCIES

34
BUTTERWORTH FILTER
 The transfer function of the Butterworth low pass (BLPF) of
order n and with cutoff frequency locus at a distance Do, from
the origin is defined by the relation.

1
H (u, v) =
1 + D(u, v) / D0 2 n
 BLPF transfer function does not have a sharp discontinuity
that establishes a clear cutoff between passed and filtered
frequencies
35
BUTTERWORTH LOW PASS FILTER

Filter displayed as an image

Perspective plot of an BLPF Filter radical cross section


Transfer function 36
APPLYING BLPF IN AN IMAGE IN
DIFFERENT FREQUENCIES

37
GAUSSIAN IMAGE FILTERING

 The form of these filters in two dimensions is given by


2 2
(u,v)/ 2 
H(u,v) = e − D

 D(u, v) is the distance from the origin of the Fourier


transform.

 σ is a measure of the spread of the Gaussian curve

38
GAUSSIAN LOW PASS FILTERS

Filter displayed as an image

Perspective plot of an GLPF Filter radical cross section 39


Transfer function
APPLYING GLPF IN AN IMAGE IN
DIFFERENT FREQUENCIES

40
SHARPENING FREQUENCY DOMAIN
FILTERS

 Image sharpening is done by using high pass filters


 It attenuates the low frequency components without disturbing
high frequency information

 The transformation of high pass function is


H h p (u, v ) = 1 − H l p (u, v )

 Hhp represents high pass function

H lp Represents low passfunction 41


 Sharpening frequency domain filters include

 Ideal low pass filter

 Butterworth low pass filter

 Gaussian low pass filter

42
 Sharpening technique is reverse operation of low pass filters
 When the low pass filters attenuates frequencies , the high
pass filter passes them

 When the high pass filters attenuates frequencies , the low


pass filter passes them

43
IDEAL HIGH PASS FILTER

 It is defined as

 H(u , v)= 1 if D(u , v) < D 0

0 if D(u , v) > D0

 Ideal high pass shows significant ringing artifacts

44
45
BUTTERWORTH HIGH PASS FILTER

 Transformation function of BHPF

1
H ( u, v ) = 1 −
1 +  D(u, v ) / D 0 
2n

 BHPF shows sharp edges with minor ringing artifacts

46
47
GAUSSIAN HIGH PASS FILTER

 Transformation function of GHPF

2 2
(u,v)/ 2 
H(u,v) = 1 − e − D

 Gaussian high pass filters shows high sharpness without


ringing artifacts.

48
49
PERSPECTIVE PLOT , IMAGE REPRESENTATION
AND CROSS SECTION OF IHPF,BHPF,GHPF

50
THANK YOU

51

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy