SlideShare a Scribd company logo
SPATIAL DOMAIN FILTERING
NONLINEAR FILTERS
CS-467 Digital Image Processing
1
Nonlinear Filtering
• As well as any linear filter, a nonlinear filter is
defined by an operator
where is a signal to be processed, T
is a filtering operator and is a
resulting signal
• Linearity does not hold for a nonlinear filter
2
( ),g x y
( )ˆ ,f x y
( ) ( )( )ˆ , ,f x y T g x y=
( )( ) ( )( ) ( ), ( , ) , ( , )T af x y b x y aT f x y bT x yη η+≠+
Nonlinear Spatial Domain Filtering
• Nonlinear spatial filtering of an image of size
M x N with a filter of size m x n is defined by
the expression
where is a local m x n window around the
pixel g(x,y) in the image g to be processed,
and T is the nonlinear filtering operator
3
( ) ( )ˆ , xyf x y T S=
xyS
Variational Series –
Series of Order Statistics
• An arrangement of the values of a random
sample with distribution function F(x)
in ascending sequence
where
• The series is used to construct the empirical
distribution function , where
is the number of terms of the series which are
smaller than x.
4
1,..., nx x
(1) (2) ( )... nx x x≤ ≤ ≤
(1) ( )
1,..., 1,...,
min ; maxi n i
i n i n
x x x x
= =
= =
( ) /n xF x m n= xm
Variational Series –
Series of Order Statistics
• A rank (order statistics) of an element in a
variational series is its serial number in the
series
Rank 1 Rank 2 … Rank n
5
(1) (2) ( )... nx x x≤ ≤ ≤
Variational Series –
Series of Order Statistics
• Example1. Let us have the following sample
200, 101, 102, 125, 5, 10, 207, 180, 100
Its variational series is
5, 10, 100, 101, 102, 180, 200, 201, 207
• Example2. Let us have the following sample
200, 101, 102, 101, 207, 101, 100, 207, 5
Its variational series is
5, 100, 101, 101, 101, 102, 200, 207, 207
6
Median Filter – the Simplest Spatial
Domain Nonlinear Filter
• Median filter replaces an intensity value in
each pixel by a local median taken over a local
n x m processing window:
where is a local m x n window around the
pixel (x,y) in the image g (to be processed),
and MED is the median value taken over the
window
7
( ) ( )Mˆ ED, xyf x y S=
xyS
xyS
Median Filter – Implementation
• To implement the median filter with an n x m
processing window, it is necessary to build a
variational series from the elements of the
processing window around the pixel (x,y)
(to be processed)
• The central element of the vatiational series is
the median of the intensity values in the
window
8
xyS
xyS
Median Filter and Impulse Noise
• Median filter is highly efficient for impulse
noise filtering
• Median filter with 3x3 window can almost
completely remove impulse noise with the
corruption rate up to 30%
• Applied iteratively, it can remove even noise
with a higher corruption rate
9
Median Filter and Impulse Noise
• The ability of the median filter to remove
impulse noise is based on the following:
• Impulses have unusually high (or low)
intensity values compared to their neighbors
• This means that they are located in the left or
right ends of the variational series built from
the intensity values in a local window
around the pixel (x,y)
10
xyS
Median Filter and Impulse Noise
11
25 36 36
47 48
104 11
201
0 120
25 36 36 47 104 110 148 20 201
25 36 36
47 48
104 1
48
10 120
3x3 window, 201 is the
impulse
Variational Series
Median
The processing result
The impulse 201 was removed
Mean Filter and Impulse Noise
• Unlike the median filter, the mean filter is unable to remove
impulse noise. It only “washes” impulses
12
3x3 window, 201 is the
impulse
The processing result
The impulse 201 was just “washed”
25 36 36
47 48
104 11
201
0 120
25 36 36
47 48
104 1
81
10 120
Mean = 81
Disadvantages of Median Filtering
• Median filter removes impulse noise, but it
also smoothes (“washes”) all edges and
boundaries and may “erase” all details whose
size is about n/2 x m/2 ,where n x m is a
window size
• As a result, an image becomes “fuzzy”
• Median filter is not so efficient for additive
Gaussian noise removal, it yields to linear
filters
13
Detection of Impulse Noise
• To reduce a image smoothing by the median
filter, impulse detectors should be used
• A detector analyses local statistical (and
possibly other) characteristics in a local
window around each pixel using some criteria,
and marks those pixels that are corrupted by
noise
• Then only marked pixels shall be processed by
the median filter
14
Differential Rank Impulse Detector
• This detector is based on the following
reasonable assumptions
 Impulses are located either in the ends of the
variational series (salt-end-pepper and bipolar
noise) or close to these ends (random noise)
 The difference between the intensity values
of impulse and its neighbor located in the
variational series between this impulse and
the median should not exceed some
reasonable threshold value
15
Differential Rank Impulse Detector
• Let R(x) be the rank of an element x in the
variational series and var(k) be the intensity
value of the pixel whose rank is k
16
( ) ( )
( ) ( )
( , ) var ( , ) 1 , if ( , )
( , ) var ( , ) 1 , if ( , )
0 , otherwise,
xy
xy
S
xy
S
g x y R g x y R g x y R MED
d g x y R g x y R g x y R MED
  − − >      

  = − + <      



Differential Rank Impulse Detector
• Let r be the length (in ranks) of the interval in the
variational series where an impulse can be
located
• Let s be the maximal acceptable difference
between the intensity value of the pixel of
interest and its neighbor located in the variational
series between this impulse and the median
dxy= Var( )-Var( )≥ s dxy= Var( )-Var( ) ≥ s
17
r=2 r=2Impulses
Differential Criteria of an impulse
Differential Rank Impulse Detector
• Differential Rank Impulse Detector (DRID) works
as follows
• The pixel (x,y) is considered noisy if the following
condition holds:
the intensity value g(x,y) in the pixel of interest is
located in the r-interval from one of the ends of
the variational series, and the difference
between this value and its neighbor located in
the variational series closer to the median
exceeds s
18
( ) ( )( ) ( )( ( , ) ( ( , )) 1 xyR g x y R g x y mn dr r s≤ ∨ ≥ − + ∧ ≥
xyd
Filtering of Scratches
• Any scratch is a collection of impulses – there
are consecutive impulses extended in some
direction along some virtual curve
• To remove a scratch from an image, it is
necessary to process it locally and to use the
mask median filter
19
Filtering of Scratches
• In the mask median filter, a median is taken
not over all the pixels in a filtering window,
but only over those marked in the mask
• To remove a scratch, it is necessary to create a
“counterscratch” mask including there pixels
from the virtual perpendicular to the scratch
20
Filtering of Scratches
21
Scratch
Mask
Threshold Boolean Filtering (TBF)
• Threshold Boolean filtering (also often
referred to as stack filtering) is reduced to:
 Splitting an image with M+1 gray levels into
M binary planes (slices) by thresholding
 Separate processing of the binary planes
(slices) using a processing Boolean function
 Merging the processed binary planes into a
resulting image
22
Threshold Boolean Filtering (TBF)
• Let g be a scale image with (M+1) gray levels
• Let be a kth
binary plane
• Then a filtering operation is determined by
where F is the processing Boolean function, is a
kth binary plane of a local window around a pixel of
interest
23
( ) 1 , if ( , )
( , ) ; 1,...,
0 , otherwise
k f x y k
g x y k M
≥
= =

( ) ( )( )
1
ˆ ,
M
k
xy
k
Ff x j S
=
= ∑
( )k
ijS
Threshold Boolean Filter (TBF)
Image
M Binary slices
Threshold Boolean
Filter
Result
The idea behind the Threshold Boolean Filter is to process each binary
plane of an image separately, and after filtering all the binary planes are
combined together to form the resulting image. The following diagram
illustrates this idea:
( )
( )( ) 1, if ,
,
0, otherwise
1,2,..., the binary slice index
k g x y k
g x y
k M
 ≥
= 

= −
( )
1
ˆ ,
M
k
k
f x y
=
∑
Impulse Noise Filtering using TBF
),,,,,,,,( 987654321 xxxxxxxxxf
















∧∨∧∨
















∨∧∧=
≠
==
≠
==
)()(
5
1
5
5
1
5
11
k
i
k
ik
T
j
k
i
k
ik
T
j
xxxx
tj
j
tj
j
(...)),...,( 25155 fxxf x =
















∧∨∧∨
















∨∧∧∧
≠
==
≠
==
)()(
5
1
5
5
1
5
11
k
i
k
ik
P
j
k
i
k
ik
P
j
xxxx
sj
j
sj
j
The filter is defined by the following functions. For 3x3 window:
For 5x5 window
where X5 is the central element of the window, i.e. the pixel under
consideration,
T is the number of all possible elementary conjunctions of t variables out of
8 (the number of pixels in a 3x3 window),
P is the number of all possible elementary conjunctions of s variables out of
16 (5x5 window).
8
tT C=
16
pP C=
Impulse Noise Filtering using TBF
• TBF is highly efficient for filtering of random
impulse noise filtering with a low corruption
rate (≤5%). It may preserve image details with
a higher accuracy than other filters
• Disadvantages: strictly dependent on the
successful choice of the parameters and
computationally costly (compared to median
and rank-order ER filters, even used in
conjunction with noise detector)
26
Rank-Order (Order Statistic) Filters
• Rank-order filtering is based on the analysis of
the variational series followed by some
nonlinear averaging of a signal
• The median filter is a representative of the
rank-order filters family
• We will consider rank-order filters using their
classification done by Leonid Yaroslavsky
27
Rank-Order EV Filter
• Let be a value, which determines the
following interval (EV) around the intensity
value of the pixel of interest
• An EV interval contains those intensity values
whose difference from the intensity value in
the pixel of interest does not exceed
• A suboptimal value of the parameter is
- standard deviation measured over an image
28
vε
( ) ( ) ( ){ }, : ( , ) , ; ,v xyEV g i j g x y g i j g i j Sε= − ≤ ∈
vε σ=
( , )g x y
vε
Rank-Order EV Filter
• Rank-order EV filter is determined as follows
• The first option leads to more careful and
accurate reduction of additive noise
(compared to linear filters)
29
( )
( )( ) ( )
( )( ) ( )
MEAN , , ,
ˆ , or
MED , , ,
g i j g i j EV
f x y
g i j g i j EV
 ∈

= 
 ∈
Rank-Order EV Filter
• Rank-order EV filter preserves small details
and image boundaries with a higher accuracy
than linear filters. With a careful choice of
it is possible to avoid smoothing of n/2 x m/2
details
• Disadvantage is the dependence on the choice
of the parameter .
• This filter may show better results if EV has
been chosen adaptively for each window
30
vε
xyS
vε
Rank-Order ER Filter
• Let is a value, which determines the
following interval (ER) around the intensity
value of the pixel of interest
• An ER interval contains those intensity values
whose ranks differ from the rank of the
intensity value in the pixel of interest by not
more than
31
rε
( ) ( ) ( )( ) ( ){ }, : ( , ) , ; ,r xyER g i j R g x y R g i j g i j Sε= − ≤ ∈
rε
Rank-Order ER Filter
• Rank-order ER filter is determined as follows
• The second option leads to more careful removal of
random impulse noise with a low corruption rate (1-5%)
(the filter should be applied iteratively). It can also be used
to “close” impulse gaps (spots) – a window larger than a
spot should be used
• The second option is also better for speckle (multiplicative)
noise
32
( )
( )( ) ( )
( )( ) ( )
MEAN , , ,
ˆ , or
MED , , ,
g i j g i j ER
f x y
g i j g i j ER
 ∈

= 
 ∈
Rank-Order ER Filter
• Advantage of the rank-order ER filter is that it
preserves small details and image boundaries
with a higher accuracy than the median filter.
With a careful choice of , it is possible to
remove salt-and-pepper impulse noise iteratively
with more careful preservation of image details
• Disadvantage is the dependence on the choice of
the parameter ER.
• This filter may show better results if ER has been
chosen adaptively for each window
33
rε
xyS
Rank-Order KNV Filter
• Let k be a value, which determines the
following interval (KNV) around the intensity
value of the pixel of interest
• A KNV interval contains k closest pixels from
to the xyth pixel, in terms of the intensity
values closest to the intensity
34
( ) ( ) ( )( )
( )
, : ( , ) , ;
; ,
s
xy
g g i j R g x y R g i j
k
nm
KNV
s g i j S
 = − ≤ 
=  
≤ ∈  
( , )g x y
xyS
Rank-Order KNV Filter
• Rank-order KNV filter is determined as follows
• The first option leads to more careful
reduction of additive noise (compared to
linear filters)
35
( )
( )( ) ( )
( )( ) ( )
MEAN , , ,
ˆ , or
MED , , ,
g i j g i j KNV
f x y
g i j g i j KNV
 ∈

= 
 ∈
Rank-Order KNV Filter
• Advantage of the rank-order KNV filter is that it
preserves small details whose area is < k squared
pixels
• However, its ability to reduce noise is limited. It is
better to use this filter only when it is absolutely
necessary to preserve some small details
• Another disadvantage is its dependence on the
choice of the parameter k
• This filter may show better results if k has been
chosen adaptively for each window
36
xyS
Geometric Mean Filter
• Can preserve details a little bit better than the
arithmetic mean filter
37
( )
1
( , )
ˆ , ( , )
xy
mn
s t S
f x y S s t
∈
 
=  
 
 
∏
Harmonic Mean Filter
• Can be good for multiplicative (speckle) noise
removal
38
( )
( , )
ˆ ,
1
( , )xys t S
mn
f x y
g s t∈
=
∑
Contraharmonic Mean Filter
where Q is the order of the filter
• With positive Q eliminates pepper noise , while
with negative Q Eliminates salt noise
• With Q=0 reduces to the arithmetic mean filter,
and with Q=1 – to the harmonic mean filter
39
( )
1
( , )
( , )
( , )
ˆ ,
( , )
xy
xy
Q
s t S
Q
s t S
g s t
f x y
g s t
+
∈
∈
=
∑
∑

More Related Content

PPTX
Image enhancement
Ayaelshiwi
 
PPTX
Band pass filter
Madeha Arif
 
PPTX
Fundamentals steps in Digital Image processing
KarthicaMarasamy
 
PPTX
Digital image processing
ABIRAMI M
 
PDF
rf ic design previous question papers
balajirao mahendrakar
 
PPT
Wavelet transform in image compression
jeevithaelangovan
 
PPTX
Convolution&Correlation
VenkateshPrasadV1
 
PPT
Losses in optical fiber
Samruddha Parkar
 
Image enhancement
Ayaelshiwi
 
Band pass filter
Madeha Arif
 
Fundamentals steps in Digital Image processing
KarthicaMarasamy
 
Digital image processing
ABIRAMI M
 
rf ic design previous question papers
balajirao mahendrakar
 
Wavelet transform in image compression
jeevithaelangovan
 
Convolution&Correlation
VenkateshPrasadV1
 
Losses in optical fiber
Samruddha Parkar
 

What's hot (20)

PDF
Pixel Relationships Examples
Marwa Ahmeid
 
PPTX
Image Restoration (Order Statistics Filters)
Kalyan Acharjya
 
PPTX
Introduction to Adaptive filters
Firas Mohammed Ali Al-Raie
 
PPTX
Image Smoothing using Frequency Domain Filters
Suhaila Afzana
 
PDF
Region Splitting and Merging Technique For Image segmentation.
SomitSamanto1
 
PDF
Image sampling and quantization
BCET, Balasore
 
PPTX
Spatial Filters (Digital Image Processing)
Kalyan Acharjya
 
PPTX
Background subtraction
Raviraj singh shekhawat
 
PPTX
funnel shifter
shahsamkit73
 
PDF
Edge linking hough transform
aruna811496
 
PPTX
halfadder & halfsubtractor using 4:1 MUX
U Reshmi
 
PPTX
Arithmetic and Logic instructions in Embedded C
Vikas Dongre
 
PPT
Image enhancement
Dr INBAMALAR T M
 
PPTX
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
Hemantha Kulathilake
 
PPTX
Digital image processing img smoothning
Vinay Gupta
 
PPT
Spatial filtering
shabanam tamboli
 
PPT
Image segmentation
Md Shabir Alam
 
PPTX
Hilbart Transform
Md. Merajul Islam
 
PPTX
Smoothing in Digital Image Processing
Pallavi Agarwal
 
PPT
Chapter 5 Image Processing: Fourier Transformation
Varun Ojha
 
Pixel Relationships Examples
Marwa Ahmeid
 
Image Restoration (Order Statistics Filters)
Kalyan Acharjya
 
Introduction to Adaptive filters
Firas Mohammed Ali Al-Raie
 
Image Smoothing using Frequency Domain Filters
Suhaila Afzana
 
Region Splitting and Merging Technique For Image segmentation.
SomitSamanto1
 
Image sampling and quantization
BCET, Balasore
 
Spatial Filters (Digital Image Processing)
Kalyan Acharjya
 
Background subtraction
Raviraj singh shekhawat
 
funnel shifter
shahsamkit73
 
Edge linking hough transform
aruna811496
 
halfadder & halfsubtractor using 4:1 MUX
U Reshmi
 
Arithmetic and Logic instructions in Embedded C
Vikas Dongre
 
Image enhancement
Dr INBAMALAR T M
 
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
Hemantha Kulathilake
 
Digital image processing img smoothning
Vinay Gupta
 
Spatial filtering
shabanam tamboli
 
Image segmentation
Md Shabir Alam
 
Hilbart Transform
Md. Merajul Islam
 
Smoothing in Digital Image Processing
Pallavi Agarwal
 
Chapter 5 Image Processing: Fourier Transformation
Varun Ojha
 
Ad

Viewers also liked (6)

PPTX
Smoothing Filters in Spatial Domain
Madhu Bala
 
PDF
"Stereotipi e maternità" - Paper della Prof.ssa Luisa Rosti - Università di ...
MOBILDONNE
 
PPTX
Edge detection
Ishraq Al Fataftah
 
PDF
filters for noise in image processing
Sardar Alam
 
PPTX
Noise filtering
Alaa Ahmed
 
PPT
Spatial filtering
Sanyam Agarwal
 
Smoothing Filters in Spatial Domain
Madhu Bala
 
"Stereotipi e maternità" - Paper della Prof.ssa Luisa Rosti - Università di ...
MOBILDONNE
 
Edge detection
Ishraq Al Fataftah
 
filters for noise in image processing
Sardar Alam
 
Noise filtering
Alaa Ahmed
 
Spatial filtering
Sanyam Agarwal
 
Ad

Similar to Lecture 6 (20)

PDF
Reduced Ordering Based Approach to Impulsive Noise Suppression in Color Images
IDES Editor
 
PDF
restoration_recon_chap5_GW.pdf
SUBHASHREEBASU5
 
PPT
Image denoising
umarjamil10000
 
PDF
D122733
IJRES Journal
 
PDF
F0533134
IOSR Journals
 
PDF
L0440285459
IJERA Editor
 
PDF
Nonlinear Transformation Based Detection And Directional Mean Filter to Remo...
IJMER
 
PDF
Robustness of Median Filter For Suppression of Salt and Pepper Noise (SPN) an...
CSCJournals
 
PDF
Lecture 5
Wael Sharba
 
PPSX
Noise models presented by Nisha Menon K
Nisha Menon K
 
PDF
Image Noise Removal by Dual Threshold Median Filter for RVIN
IOSR Journals
 
PDF
M017218088
IOSR Journals
 
PPTX
Image Restoration And Reconstruction
Amnaakhaan
 
PDF
Image processing, Noise, Noise Removal filters
Kuppusamy P
 
PDF
PERFORMANCE ANALYSIS OF UNSYMMETRICAL TRIMMED MEDIAN AS DETECTOR ON IMAGE NOI...
ijistjournal
 
PDF
PERFORMANCE ANALYSIS OF UNSYMMETRICAL TRIMMED MEDIAN AS DETECTOR ON IMAGE NOI...
ijistjournal
 
PDF
Performance of Various Order Statistics Filters in Impulse and Mixed Noise Re...
sipij
 
PDF
Study and Analysis of Impulse Noise Reduction Filters
sipij
 
PDF
Iaetsd literature review on efficient detection and filtering of high
Iaetsd Iaetsd
 
PPTX
Digital Image restoration
Md Shabir Alam
 
Reduced Ordering Based Approach to Impulsive Noise Suppression in Color Images
IDES Editor
 
restoration_recon_chap5_GW.pdf
SUBHASHREEBASU5
 
Image denoising
umarjamil10000
 
D122733
IJRES Journal
 
F0533134
IOSR Journals
 
L0440285459
IJERA Editor
 
Nonlinear Transformation Based Detection And Directional Mean Filter to Remo...
IJMER
 
Robustness of Median Filter For Suppression of Salt and Pepper Noise (SPN) an...
CSCJournals
 
Lecture 5
Wael Sharba
 
Noise models presented by Nisha Menon K
Nisha Menon K
 
Image Noise Removal by Dual Threshold Median Filter for RVIN
IOSR Journals
 
M017218088
IOSR Journals
 
Image Restoration And Reconstruction
Amnaakhaan
 
Image processing, Noise, Noise Removal filters
Kuppusamy P
 
PERFORMANCE ANALYSIS OF UNSYMMETRICAL TRIMMED MEDIAN AS DETECTOR ON IMAGE NOI...
ijistjournal
 
PERFORMANCE ANALYSIS OF UNSYMMETRICAL TRIMMED MEDIAN AS DETECTOR ON IMAGE NOI...
ijistjournal
 
Performance of Various Order Statistics Filters in Impulse and Mixed Noise Re...
sipij
 
Study and Analysis of Impulse Noise Reduction Filters
sipij
 
Iaetsd literature review on efficient detection and filtering of high
Iaetsd Iaetsd
 
Digital Image restoration
Md Shabir Alam
 

More from Wael Sharba (20)

PDF
Project 8
Wael Sharba
 
PDF
Project 7
Wael Sharba
 
PDF
Project 6
Wael Sharba
 
PDF
Project 5
Wael Sharba
 
PDF
Project 4
Wael Sharba
 
PDF
Project 2
Wael Sharba
 
PDF
Project 1
Wael Sharba
 
PDF
Project 3
Wael Sharba
 
PDF
Project 9
Wael Sharba
 
PDF
Lecture 14
Wael Sharba
 
PDF
Lecture 13
Wael Sharba
 
PDF
Lecture 11
Wael Sharba
 
PDF
Lecture 12
Wael Sharba
 
PDF
Lecture 10
Wael Sharba
 
PDF
Lecture 9
Wael Sharba
 
PDF
Lecture 8
Wael Sharba
 
PDF
Lecture 7
Wael Sharba
 
PDF
Lecture 4
Wael Sharba
 
PDF
Lecture 3
Wael Sharba
 
PDF
Lecture 2
Wael Sharba
 
Project 8
Wael Sharba
 
Project 7
Wael Sharba
 
Project 6
Wael Sharba
 
Project 5
Wael Sharba
 
Project 4
Wael Sharba
 
Project 2
Wael Sharba
 
Project 1
Wael Sharba
 
Project 3
Wael Sharba
 
Project 9
Wael Sharba
 
Lecture 14
Wael Sharba
 
Lecture 13
Wael Sharba
 
Lecture 11
Wael Sharba
 
Lecture 12
Wael Sharba
 
Lecture 10
Wael Sharba
 
Lecture 9
Wael Sharba
 
Lecture 8
Wael Sharba
 
Lecture 7
Wael Sharba
 
Lecture 4
Wael Sharba
 
Lecture 3
Wael Sharba
 
Lecture 2
Wael Sharba
 

Recently uploaded (20)

PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 

Lecture 6

  • 1. SPATIAL DOMAIN FILTERING NONLINEAR FILTERS CS-467 Digital Image Processing 1
  • 2. Nonlinear Filtering • As well as any linear filter, a nonlinear filter is defined by an operator where is a signal to be processed, T is a filtering operator and is a resulting signal • Linearity does not hold for a nonlinear filter 2 ( ),g x y ( )ˆ ,f x y ( ) ( )( )ˆ , ,f x y T g x y= ( )( ) ( )( ) ( ), ( , ) , ( , )T af x y b x y aT f x y bT x yη η+≠+
  • 3. Nonlinear Spatial Domain Filtering • Nonlinear spatial filtering of an image of size M x N with a filter of size m x n is defined by the expression where is a local m x n window around the pixel g(x,y) in the image g to be processed, and T is the nonlinear filtering operator 3 ( ) ( )ˆ , xyf x y T S= xyS
  • 4. Variational Series – Series of Order Statistics • An arrangement of the values of a random sample with distribution function F(x) in ascending sequence where • The series is used to construct the empirical distribution function , where is the number of terms of the series which are smaller than x. 4 1,..., nx x (1) (2) ( )... nx x x≤ ≤ ≤ (1) ( ) 1,..., 1,..., min ; maxi n i i n i n x x x x = = = = ( ) /n xF x m n= xm
  • 5. Variational Series – Series of Order Statistics • A rank (order statistics) of an element in a variational series is its serial number in the series Rank 1 Rank 2 … Rank n 5 (1) (2) ( )... nx x x≤ ≤ ≤
  • 6. Variational Series – Series of Order Statistics • Example1. Let us have the following sample 200, 101, 102, 125, 5, 10, 207, 180, 100 Its variational series is 5, 10, 100, 101, 102, 180, 200, 201, 207 • Example2. Let us have the following sample 200, 101, 102, 101, 207, 101, 100, 207, 5 Its variational series is 5, 100, 101, 101, 101, 102, 200, 207, 207 6
  • 7. Median Filter – the Simplest Spatial Domain Nonlinear Filter • Median filter replaces an intensity value in each pixel by a local median taken over a local n x m processing window: where is a local m x n window around the pixel (x,y) in the image g (to be processed), and MED is the median value taken over the window 7 ( ) ( )Mˆ ED, xyf x y S= xyS xyS
  • 8. Median Filter – Implementation • To implement the median filter with an n x m processing window, it is necessary to build a variational series from the elements of the processing window around the pixel (x,y) (to be processed) • The central element of the vatiational series is the median of the intensity values in the window 8 xyS xyS
  • 9. Median Filter and Impulse Noise • Median filter is highly efficient for impulse noise filtering • Median filter with 3x3 window can almost completely remove impulse noise with the corruption rate up to 30% • Applied iteratively, it can remove even noise with a higher corruption rate 9
  • 10. Median Filter and Impulse Noise • The ability of the median filter to remove impulse noise is based on the following: • Impulses have unusually high (or low) intensity values compared to their neighbors • This means that they are located in the left or right ends of the variational series built from the intensity values in a local window around the pixel (x,y) 10 xyS
  • 11. Median Filter and Impulse Noise 11 25 36 36 47 48 104 11 201 0 120 25 36 36 47 104 110 148 20 201 25 36 36 47 48 104 1 48 10 120 3x3 window, 201 is the impulse Variational Series Median The processing result The impulse 201 was removed
  • 12. Mean Filter and Impulse Noise • Unlike the median filter, the mean filter is unable to remove impulse noise. It only “washes” impulses 12 3x3 window, 201 is the impulse The processing result The impulse 201 was just “washed” 25 36 36 47 48 104 11 201 0 120 25 36 36 47 48 104 1 81 10 120 Mean = 81
  • 13. Disadvantages of Median Filtering • Median filter removes impulse noise, but it also smoothes (“washes”) all edges and boundaries and may “erase” all details whose size is about n/2 x m/2 ,where n x m is a window size • As a result, an image becomes “fuzzy” • Median filter is not so efficient for additive Gaussian noise removal, it yields to linear filters 13
  • 14. Detection of Impulse Noise • To reduce a image smoothing by the median filter, impulse detectors should be used • A detector analyses local statistical (and possibly other) characteristics in a local window around each pixel using some criteria, and marks those pixels that are corrupted by noise • Then only marked pixels shall be processed by the median filter 14
  • 15. Differential Rank Impulse Detector • This detector is based on the following reasonable assumptions  Impulses are located either in the ends of the variational series (salt-end-pepper and bipolar noise) or close to these ends (random noise)  The difference between the intensity values of impulse and its neighbor located in the variational series between this impulse and the median should not exceed some reasonable threshold value 15
  • 16. Differential Rank Impulse Detector • Let R(x) be the rank of an element x in the variational series and var(k) be the intensity value of the pixel whose rank is k 16 ( ) ( ) ( ) ( ) ( , ) var ( , ) 1 , if ( , ) ( , ) var ( , ) 1 , if ( , ) 0 , otherwise, xy xy S xy S g x y R g x y R g x y R MED d g x y R g x y R g x y R MED   − − >          = − + <         
  • 17. Differential Rank Impulse Detector • Let r be the length (in ranks) of the interval in the variational series where an impulse can be located • Let s be the maximal acceptable difference between the intensity value of the pixel of interest and its neighbor located in the variational series between this impulse and the median dxy= Var( )-Var( )≥ s dxy= Var( )-Var( ) ≥ s 17 r=2 r=2Impulses Differential Criteria of an impulse
  • 18. Differential Rank Impulse Detector • Differential Rank Impulse Detector (DRID) works as follows • The pixel (x,y) is considered noisy if the following condition holds: the intensity value g(x,y) in the pixel of interest is located in the r-interval from one of the ends of the variational series, and the difference between this value and its neighbor located in the variational series closer to the median exceeds s 18 ( ) ( )( ) ( )( ( , ) ( ( , )) 1 xyR g x y R g x y mn dr r s≤ ∨ ≥ − + ∧ ≥ xyd
  • 19. Filtering of Scratches • Any scratch is a collection of impulses – there are consecutive impulses extended in some direction along some virtual curve • To remove a scratch from an image, it is necessary to process it locally and to use the mask median filter 19
  • 20. Filtering of Scratches • In the mask median filter, a median is taken not over all the pixels in a filtering window, but only over those marked in the mask • To remove a scratch, it is necessary to create a “counterscratch” mask including there pixels from the virtual perpendicular to the scratch 20
  • 22. Threshold Boolean Filtering (TBF) • Threshold Boolean filtering (also often referred to as stack filtering) is reduced to:  Splitting an image with M+1 gray levels into M binary planes (slices) by thresholding  Separate processing of the binary planes (slices) using a processing Boolean function  Merging the processed binary planes into a resulting image 22
  • 23. Threshold Boolean Filtering (TBF) • Let g be a scale image with (M+1) gray levels • Let be a kth binary plane • Then a filtering operation is determined by where F is the processing Boolean function, is a kth binary plane of a local window around a pixel of interest 23 ( ) 1 , if ( , ) ( , ) ; 1,..., 0 , otherwise k f x y k g x y k M ≥ = =  ( ) ( )( ) 1 ˆ , M k xy k Ff x j S = = ∑ ( )k ijS
  • 24. Threshold Boolean Filter (TBF) Image M Binary slices Threshold Boolean Filter Result The idea behind the Threshold Boolean Filter is to process each binary plane of an image separately, and after filtering all the binary planes are combined together to form the resulting image. The following diagram illustrates this idea: ( ) ( )( ) 1, if , , 0, otherwise 1,2,..., the binary slice index k g x y k g x y k M  ≥ =   = − ( ) 1 ˆ , M k k f x y = ∑
  • 25. Impulse Noise Filtering using TBF ),,,,,,,,( 987654321 xxxxxxxxxf                 ∧∨∧∨                 ∨∧∧= ≠ == ≠ == )()( 5 1 5 5 1 5 11 k i k ik T j k i k ik T j xxxx tj j tj j (...)),...,( 25155 fxxf x =                 ∧∨∧∨                 ∨∧∧∧ ≠ == ≠ == )()( 5 1 5 5 1 5 11 k i k ik P j k i k ik P j xxxx sj j sj j The filter is defined by the following functions. For 3x3 window: For 5x5 window where X5 is the central element of the window, i.e. the pixel under consideration, T is the number of all possible elementary conjunctions of t variables out of 8 (the number of pixels in a 3x3 window), P is the number of all possible elementary conjunctions of s variables out of 16 (5x5 window). 8 tT C= 16 pP C=
  • 26. Impulse Noise Filtering using TBF • TBF is highly efficient for filtering of random impulse noise filtering with a low corruption rate (≤5%). It may preserve image details with a higher accuracy than other filters • Disadvantages: strictly dependent on the successful choice of the parameters and computationally costly (compared to median and rank-order ER filters, even used in conjunction with noise detector) 26
  • 27. Rank-Order (Order Statistic) Filters • Rank-order filtering is based on the analysis of the variational series followed by some nonlinear averaging of a signal • The median filter is a representative of the rank-order filters family • We will consider rank-order filters using their classification done by Leonid Yaroslavsky 27
  • 28. Rank-Order EV Filter • Let be a value, which determines the following interval (EV) around the intensity value of the pixel of interest • An EV interval contains those intensity values whose difference from the intensity value in the pixel of interest does not exceed • A suboptimal value of the parameter is - standard deviation measured over an image 28 vε ( ) ( ) ( ){ }, : ( , ) , ; ,v xyEV g i j g x y g i j g i j Sε= − ≤ ∈ vε σ= ( , )g x y vε
  • 29. Rank-Order EV Filter • Rank-order EV filter is determined as follows • The first option leads to more careful and accurate reduction of additive noise (compared to linear filters) 29 ( ) ( )( ) ( ) ( )( ) ( ) MEAN , , , ˆ , or MED , , , g i j g i j EV f x y g i j g i j EV  ∈  =   ∈
  • 30. Rank-Order EV Filter • Rank-order EV filter preserves small details and image boundaries with a higher accuracy than linear filters. With a careful choice of it is possible to avoid smoothing of n/2 x m/2 details • Disadvantage is the dependence on the choice of the parameter . • This filter may show better results if EV has been chosen adaptively for each window 30 vε xyS vε
  • 31. Rank-Order ER Filter • Let is a value, which determines the following interval (ER) around the intensity value of the pixel of interest • An ER interval contains those intensity values whose ranks differ from the rank of the intensity value in the pixel of interest by not more than 31 rε ( ) ( ) ( )( ) ( ){ }, : ( , ) , ; ,r xyER g i j R g x y R g i j g i j Sε= − ≤ ∈ rε
  • 32. Rank-Order ER Filter • Rank-order ER filter is determined as follows • The second option leads to more careful removal of random impulse noise with a low corruption rate (1-5%) (the filter should be applied iteratively). It can also be used to “close” impulse gaps (spots) – a window larger than a spot should be used • The second option is also better for speckle (multiplicative) noise 32 ( ) ( )( ) ( ) ( )( ) ( ) MEAN , , , ˆ , or MED , , , g i j g i j ER f x y g i j g i j ER  ∈  =   ∈
  • 33. Rank-Order ER Filter • Advantage of the rank-order ER filter is that it preserves small details and image boundaries with a higher accuracy than the median filter. With a careful choice of , it is possible to remove salt-and-pepper impulse noise iteratively with more careful preservation of image details • Disadvantage is the dependence on the choice of the parameter ER. • This filter may show better results if ER has been chosen adaptively for each window 33 rε xyS
  • 34. Rank-Order KNV Filter • Let k be a value, which determines the following interval (KNV) around the intensity value of the pixel of interest • A KNV interval contains k closest pixels from to the xyth pixel, in terms of the intensity values closest to the intensity 34 ( ) ( ) ( )( ) ( ) , : ( , ) , ; ; , s xy g g i j R g x y R g i j k nm KNV s g i j S  = − ≤  =   ≤ ∈   ( , )g x y xyS
  • 35. Rank-Order KNV Filter • Rank-order KNV filter is determined as follows • The first option leads to more careful reduction of additive noise (compared to linear filters) 35 ( ) ( )( ) ( ) ( )( ) ( ) MEAN , , , ˆ , or MED , , , g i j g i j KNV f x y g i j g i j KNV  ∈  =   ∈
  • 36. Rank-Order KNV Filter • Advantage of the rank-order KNV filter is that it preserves small details whose area is < k squared pixels • However, its ability to reduce noise is limited. It is better to use this filter only when it is absolutely necessary to preserve some small details • Another disadvantage is its dependence on the choice of the parameter k • This filter may show better results if k has been chosen adaptively for each window 36 xyS
  • 37. Geometric Mean Filter • Can preserve details a little bit better than the arithmetic mean filter 37 ( ) 1 ( , ) ˆ , ( , ) xy mn s t S f x y S s t ∈   =       ∏
  • 38. Harmonic Mean Filter • Can be good for multiplicative (speckle) noise removal 38 ( ) ( , ) ˆ , 1 ( , )xys t S mn f x y g s t∈ = ∑
  • 39. Contraharmonic Mean Filter where Q is the order of the filter • With positive Q eliminates pepper noise , while with negative Q Eliminates salt noise • With Q=0 reduces to the arithmetic mean filter, and with Q=1 – to the harmonic mean filter 39 ( ) 1 ( , ) ( , ) ( , ) ˆ , ( , ) xy xy Q s t S Q s t S g s t f x y g s t + ∈ ∈ = ∑ ∑