SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
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
+
∈
∈
=
∑
∑

Mais conteúdo relacionado

Mais procurados

Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domain
Ashish Kumar
 
Digital image processing img smoothning
Digital image processing img smoothningDigital image processing img smoothning
Digital image processing img smoothning
Vinay Gupta
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation ppt
Gichelle Amon
 
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
Shajun Nisha
 

Mais procurados (20)

Digital Image Processing: Image Restoration
Digital Image Processing: Image RestorationDigital Image Processing: Image Restoration
Digital Image Processing: Image Restoration
 
Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image Segmentation
 
Image Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain FiltersImage Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain Filters
 
Hog
HogHog
Hog
 
Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domain
 
VJAI Paper Reading#3-KDD2019-ClusterGCN
VJAI Paper Reading#3-KDD2019-ClusterGCNVJAI Paper Reading#3-KDD2019-ClusterGCN
VJAI Paper Reading#3-KDD2019-ClusterGCN
 
Log Transformation in Image Processing with Example
Log Transformation in Image Processing with ExampleLog Transformation in Image Processing with Example
Log Transformation in Image Processing with Example
 
mean_filter
mean_filtermean_filter
mean_filter
 
Digital image processing img smoothning
Digital image processing img smoothningDigital image processing img smoothning
Digital image processing img smoothning
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation ppt
 
Computer Vision - Image Filters
Computer Vision - Image FiltersComputer Vision - Image Filters
Computer Vision - Image Filters
 
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
 
Adaptive filter
Adaptive filterAdaptive filter
Adaptive filter
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Image Segmentation (Digital Image Processing)
Image Segmentation (Digital Image Processing)Image Segmentation (Digital Image Processing)
Image Segmentation (Digital Image Processing)
 
Sharpening spatial filters
Sharpening spatial filtersSharpening spatial filters
Sharpening spatial filters
 
Region Splitting and Merging Technique For Image segmentation.
Region Splitting and Merging Technique For Image segmentation.Region Splitting and Merging Technique For Image segmentation.
Region Splitting and Merging Technique For Image segmentation.
 
Extraction of region of interest in an image
Extraction of region of interest in an imageExtraction of region of interest in an image
Extraction of region of interest in an image
 
Canny Edge Detection
Canny Edge DetectionCanny Edge Detection
Canny Edge Detection
 
Shape Features
 Shape Features  Shape Features
Shape Features
 

Destaque (6)

Smoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainSmoothing Filters in Spatial Domain
Smoothing Filters in Spatial Domain
 
"Stereotipi e maternità" - Paper della Prof.ssa Luisa Rosti - Università di ...
 "Stereotipi e maternità" - Paper della Prof.ssa Luisa Rosti - Università di ... "Stereotipi e maternità" - Paper della Prof.ssa Luisa Rosti - Università di ...
"Stereotipi e maternità" - Paper della Prof.ssa Luisa Rosti - Università di ...
 
Edge detection
Edge detectionEdge detection
Edge detection
 
filters for noise in image processing
filters for noise in image processingfilters for noise in image processing
filters for noise in image processing
 
Noise filtering
Noise filteringNoise filtering
Noise filtering
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
 

Semelhante a Lecture 6

Semelhante a Lecture 6 (20)

Lecture 4
Lecture 4Lecture 4
Lecture 4
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides
 
Image filtering in Digital image processing
Image filtering in Digital image processingImage filtering in Digital image processing
Image filtering in Digital image processing
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
 
unit-3.ppt
unit-3.pptunit-3.ppt
unit-3.ppt
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Spatial Domain Filtering.pdf
Spatial Domain Filtering.pdfSpatial Domain Filtering.pdf
Spatial Domain Filtering.pdf
 
Smoothing in Digital Image Processing
Smoothing in Digital Image ProcessingSmoothing in Digital Image Processing
Smoothing in Digital Image Processing
 
Dss
Dss Dss
Dss
 
IARE_DSP_PPT.pptx
IARE_DSP_PPT.pptxIARE_DSP_PPT.pptx
IARE_DSP_PPT.pptx
 
CSE367 Lecture- image sinal processing lecture
CSE367 Lecture- image sinal processing lectureCSE367 Lecture- image sinal processing lecture
CSE367 Lecture- image sinal processing lecture
 
Module 31
Module 31Module 31
Module 31
 
06 spatial filtering DIP
06 spatial filtering DIP06 spatial filtering DIP
06 spatial filtering DIP
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
 
SPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSINGSPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSING
 
quantization and sampling presentation ppt
quantization and sampling presentation pptquantization and sampling presentation ppt
quantization and sampling presentation ppt
 
IIR filter
IIR filterIIR filter
IIR filter
 
03raster 1
03raster 103raster 1
03raster 1
 
Image_filtering (1).pptx
Image_filtering (1).pptxImage_filtering (1).pptx
Image_filtering (1).pptx
 
Tdm fdm
Tdm fdmTdm fdm
Tdm fdm
 

Mais de Wael Sharba (20)

Project 8
Project 8Project 8
Project 8
 
Project 7
Project 7Project 7
Project 7
 
Project 6
Project 6Project 6
Project 6
 
Project 5
Project 5Project 5
Project 5
 
Project 4
Project 4Project 4
Project 4
 
Project 2
Project 2Project 2
Project 2
 
Project 1
Project 1Project 1
Project 1
 
Project 3
Project 3Project 3
Project 3
 
Project 9
Project 9Project 9
Project 9
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 13
Lecture 13Lecture 13
Lecture 13
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

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 + ∈ ∈ = ∑ ∑