SlideShare a Scribd company logo
SPATIAL FILTERING
ANUJ ARORA
B-TECH 2nd YEAR
ELCTRICAL ENGG.
SPATIAL FILTERING
(CONT’D)• Spatial filtering is defined by:
(1) An operation that is performed on the pixels inside the
Neighborhood
(2)First we need to create a N*N matrix called a
mask,kernel,filter(neighborhood).
(3)The number inside the mask will help us control the
kind of operation we are doing.
(4)Different number allow us to blur,sharpen,find edges.
output image
SPATIAL FILTERING
NEIGHBORHOOD
• Typically, the neighborhood is rectangular and its size
is much smaller than that of f(x,y)
- e.g., 3x3 or 5x5
SPATIAL FILTERING -
OPERATION
1 1
1 1
( , ) ( , ) ( , )
s t
g x y w s t f x s y t
Assume the origin of the
mask is the center of the
mask.
/ 2 / 2
/ 2 / 2
( , ) ( , ) ( , )
K K
s K t K
g x y w s t f x s y t
for a K x K mask:
for a 3 x 3 mask:
• A filtered image is generated as the center of the
mask moves to every pixel in the input image.
output image
STRANGE THINGS HAPPEN
AT THE EDGES!
Origin x
y Image f (x, y)
e
e
e
e
At the edges of an image we are missing
pixels to form a neighbourhood
e e
e
HANDLING PIXELS CLOSE
TO BOUNDARIES
pad with zeroes
or
0 0 0 ……………………….0
000……………………….0
LINEAR VS NON-LINEAR
SPATIAL FILTERING METHODS
• A filtering method is linear when the output is a
weighted sum of the input pixels.
• In this slide we only discuss about liner filtering.
• Methods that do not satisfy the above property are
called non-linear.
• e.g.
LINEAR SPATIAL FILTERING
METHODS
• Two main linear spatial filtering methods:
• Correlation
• Convolution
CORRELATION
• TO perform correlation ,we move w(x,y) in all possible
locations so that at least one of its pixels overlaps a
pixel in the in the original image f(x,y).
/ 2 / 2
/ 2 / 2
( , ) ( , ) ( , ) ( , ) ( , )
K K
s K t K
g x y w x y f x y w s t f x s y t
CONVOLUTION
• Similar to correlation except that the mask is first flipped
both horizontally and vertically.
Note: if w(x,y) is symmetric, that is w(x,y)=w(-x,-y), then
convolution is equivalent to correlation!
/ 2 / 2
/ 2 / 2
( , ) ( , ) ( , ) ( , ) ( , )
K K
s K t K
g x y w x y f x y w s t f x s y t
CORRELATION AND
CONVOLUTION
Correlation:
Convolution:
HOW DO WE CHOOSE THE
ELEMENTS OF A MASK?
• Typically, by sampling certain functions.
Gaussian
1st derivative
of Gaussian
2nd derivative
of Gaussian
FILTERS
• Smoothing (i.e., low-pass filters)
• Reduce noise and eliminate small details.
• The elements of the mask must be positive.
• Sum of mask elements is 1 (after normalization)
Gaussian
FILTERS
• Sharpening (i.e., high-pass filters)
• Highlight fine detail or enhance detail that has been
blurred.
• The elements of the mask contain both positive and
negative weights.
• Sum of the mask weights is 0 (after normalization)
1st derivative
of Gaussian
2nd derivative
of Gaussian
SMOOTHING FILTERS: AVERAGING
(LOW-PASS FILTERING)
SMOOTHING FILTERS:
AVERAGING
• Mask size determines the degree of smoothing and
loss of detail.
3x3 5x5 7x7
15x15 25x25
original
SMOOTHING FILTERS:
AVERAGING (CONT’D)
15 x 15 averaging image thresholding
Example: extract, largest, brightest objects
SMOOTHING FILTERS:
GAUSSIAN
• The weights are samples of the Gaussian function
mask size is
a function of σ :
σ = 1.4
SMOOTHING FILTERS:
GAUSSIAN (CONT’D)
• σ controls the amount of smoothing
• As σ increases, more samples must be obtained to represent
the Gaussian function accurately.
σ = 3
SMOOTHING FILTERS:
GAUSSIAN (CONT’D)
AVERAGING VS GAUSSIAN
SMOOTHING
Averaging
Gaussian
SHARPENING FILTERS
(HIGH PASS FILTERING)
• Useful for emphasizing transitions in image intensity
(e.g., edges).
SHARPENING FILTERS
(CONT’D)
• Note that the response of high-pass filtering might be
negative.
• Values must be re-mapped to [0, 255]
sharpened imagesoriginal image
SHARPENING FILTERS:
UNSHARP MASKING
• Obtain a sharp image by subtracting a lowpass filtered
(i.e., smoothed) image from the original image:
- =
SHARPENING FILTERS:
HIGH BOOST
• Image sharpening emphasizes edges .
• High boost filter: amplify input image, then subtract a
lowpass image.
• A is the number of image we taken for boosting.
(A-1) + =
SHARPENING FILTERS: UNSHARP
MASKING (CONT’D)
• If A=1, we get a high pass filter
• If A>1, part of the original image is added back to the
high pass filtered image.
SHARPENING FILTERS:
DERIVATIVES
• Taking the derivative of an image results in sharpening
the image.
• The derivative of an image can be computed using the
gradient.
SHARPENING FILTERS:
DERIVATIVES (CONT’D)
• The gradient is a vector which has magnitude and
direction:
| | | |
f f
x y
or
(approximation)
SHARPENING FILTERS:
DERIVATIVES (CONT’D)
• Magnitude: provides information about edge strength.
• Direction: perpendicular to the direction of the edge.
SHARPENING FILTERS: GRADIENT
COMPUTATION
• Approximate gradient using finite differences:
sensitive to horizontal edges
sensitive to vertical edges
Δx
SHARPENING FILTERS: GRADIENT
COMPUTATION (CONT’D)
• We can implement and using masks:
• Example: approximate gradient at z5
SHARPENING FILTERS: GRADIENT
COMPUTATION (CONT’D)
• A different approximation of the gradient:
•We can implement and using the following masks:
SHARPENING FILTERS: GRADIENT
COMPUTATION (CONT’D)
• Example: approximate gradient at z5
EXAMPLE
f
y
f
x
SHARPENING FILTERS:
LAPLACIAN
The Laplacian (2nd derivative) is defined as:
(dot product)
Approximate
derivatives:
Spatial filtering using image processing
Spatial filtering using image processing
Spatial filtering using image processing
Spatial filtering using image processing
Spatial filtering using image processing
Spatial filtering using image processing

More Related Content

What's hot (20)

PPTX
Digital Image restoration
Md Shabir Alam
 
PPT
Morphological Image Processing
kumari36
 
PPTX
Region based segmentation
Imran Hossain
 
PPT
Sharpening using frequency Domain Filter
arulraj121
 
PDF
4.intensity transformations
Yahya Alkhaldi
 
PPSX
Image Processing: Spatial filters
Dr. A. B. Shinde
 
PPTX
Chap6 image restoration
ShardaSalunkhe1
 
PPTX
Image Enhancement in Spatial Domain
DEEPASHRI HK
 
PDF
DIGITAL IMAGE PROCESSING - Visual perception - DAY 2
vijayanand Kandaswamy
 
PDF
Digital Image Processing: Image Restoration
Mostafa G. M. Mostafa
 
PPT
Image degradation and noise by Md.Naseem Ashraf
MD Naseem Ashraf
 
PPT
introduction to Digital Image Processing
nikesh gadare
 
PPT
image enhancement
Rajendra Prasad
 
PPT
Image trnsformations
John Williams
 
PPT
Spatial domain and filtering
University of Potsdam
 
PDF
Image Segmentation (Digital Image Processing)
VARUN KUMAR
 
PPTX
Spatial Filters (Digital Image Processing)
Kalyan Acharjya
 
PPTX
Basic image processing techniques
Heikham Anandkumar Singh
 
PPT
unit-3.ppt
meenalshanmuganathan
 
PPTX
Intensity Transformation and Spatial filtering
Shajun Nisha
 
Digital Image restoration
Md Shabir Alam
 
Morphological Image Processing
kumari36
 
Region based segmentation
Imran Hossain
 
Sharpening using frequency Domain Filter
arulraj121
 
4.intensity transformations
Yahya Alkhaldi
 
Image Processing: Spatial filters
Dr. A. B. Shinde
 
Chap6 image restoration
ShardaSalunkhe1
 
Image Enhancement in Spatial Domain
DEEPASHRI HK
 
DIGITAL IMAGE PROCESSING - Visual perception - DAY 2
vijayanand Kandaswamy
 
Digital Image Processing: Image Restoration
Mostafa G. M. Mostafa
 
Image degradation and noise by Md.Naseem Ashraf
MD Naseem Ashraf
 
introduction to Digital Image Processing
nikesh gadare
 
image enhancement
Rajendra Prasad
 
Image trnsformations
John Williams
 
Spatial domain and filtering
University of Potsdam
 
Image Segmentation (Digital Image Processing)
VARUN KUMAR
 
Spatial Filters (Digital Image Processing)
Kalyan Acharjya
 
Basic image processing techniques
Heikham Anandkumar Singh
 
Intensity Transformation and Spatial filtering
Shajun Nisha
 

Viewers also liked (7)

PPTX
Unit3 dip
Imran Khan
 
PPT
5 spatial filtering p1
Gichelle Amon
 
PPT
Image enhancement techniques
sakshij91
 
PPTX
Image enhancement
Ayaelshiwi
 
PPTX
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
Hemantha Kulathilake
 
PPTX
Image enhancement techniques
Saideep
 
PPT
Enhancement in spatial domain
Ashish Kumar
 
Unit3 dip
Imran Khan
 
5 spatial filtering p1
Gichelle Amon
 
Image enhancement techniques
sakshij91
 
Image enhancement
Ayaelshiwi
 
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
Hemantha Kulathilake
 
Image enhancement techniques
Saideep
 
Enhancement in spatial domain
Ashish Kumar
 
Ad

Similar to Spatial filtering using image processing (20)

PPT
Spatial filtering
Sanyam Agarwal
 
PPT
Spatial Filtering in intro image processingr
kumarankit06875
 
PPT
Spatial filtering
DeepikaT13
 
PPT
05_Spatial_Filtering.ppt
pawankamal3
 
PPTX
2. filtering basics
Atul Kumar Jha
 
PPTX
SPATIAL FILTERING. FOR UNDERGRADUATE .pptx
satushisammur
 
PDF
PPT s04-machine vision-s2
Binus Online Learning
 
PPTX
imge enhncement sptil filtering55555.pptx
projectsall
 
PPT
Spatial filtering
shabanam tamboli
 
PPT
Spatial domain filtering.ppt
ssuser4bbfb1
 
PPT
3 intensity transformations and spatial filtering slides
BHAGYAPRASADBUGGE
 
PPT
Digital Image Processing UNIT-2.ppt
durgakru
 
PPTX
03 cie552 image_filtering_spatial
Elsayed Hemayed
 
PPTX
COM2304: Intensity Transformation and Spatial Filtering – II Spatial Filterin...
Hemantha Kulathilake
 
PDF
CSE367 Lecture- image sinal processing lecture
FatmaNewagy1
 
PDF
Spatial Domain Filtering.pdf
swagatkarve
 
PPTX
3rd unit.pptx
ssuser0bf6a8
 
PPT
Image Processing Definition Digital Image
AhmedRAZA493682
 
PPT
Computer Vision - Image Filters
Yoss Cohen
 
PPT
Image processing spatialfiltering
John Williams
 
Spatial filtering
Sanyam Agarwal
 
Spatial Filtering in intro image processingr
kumarankit06875
 
Spatial filtering
DeepikaT13
 
05_Spatial_Filtering.ppt
pawankamal3
 
2. filtering basics
Atul Kumar Jha
 
SPATIAL FILTERING. FOR UNDERGRADUATE .pptx
satushisammur
 
PPT s04-machine vision-s2
Binus Online Learning
 
imge enhncement sptil filtering55555.pptx
projectsall
 
Spatial filtering
shabanam tamboli
 
Spatial domain filtering.ppt
ssuser4bbfb1
 
3 intensity transformations and spatial filtering slides
BHAGYAPRASADBUGGE
 
Digital Image Processing UNIT-2.ppt
durgakru
 
03 cie552 image_filtering_spatial
Elsayed Hemayed
 
COM2304: Intensity Transformation and Spatial Filtering – II Spatial Filterin...
Hemantha Kulathilake
 
CSE367 Lecture- image sinal processing lecture
FatmaNewagy1
 
Spatial Domain Filtering.pdf
swagatkarve
 
3rd unit.pptx
ssuser0bf6a8
 
Image Processing Definition Digital Image
AhmedRAZA493682
 
Computer Vision - Image Filters
Yoss Cohen
 
Image processing spatialfiltering
John Williams
 
Ad

More from Anuj Arora (10)

PPTX
Intellij
Anuj Arora
 
PPS
Unit Testing
Anuj Arora
 
PPTX
design of sampling filter
Anuj Arora
 
DOC
complete data structure
Anuj Arora
 
PPTX
Analysis of harmonic at different level on distribution system ,its effect a...
Anuj Arora
 
DOCX
Fpga based heart rate monitoring system using gsm
Anuj Arora
 
PPTX
wirless power transmission
Anuj Arora
 
DOCX
Case study on road accidents
Anuj Arora
 
DOCX
Second order differential equations and its current use
Anuj Arora
 
PPTX
indian forign trade since 2001
Anuj Arora
 
Intellij
Anuj Arora
 
Unit Testing
Anuj Arora
 
design of sampling filter
Anuj Arora
 
complete data structure
Anuj Arora
 
Analysis of harmonic at different level on distribution system ,its effect a...
Anuj Arora
 
Fpga based heart rate monitoring system using gsm
Anuj Arora
 
wirless power transmission
Anuj Arora
 
Case study on road accidents
Anuj Arora
 
Second order differential equations and its current use
Anuj Arora
 
indian forign trade since 2001
Anuj Arora
 

Recently uploaded (20)

PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PDF
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
PPT
inherently safer design for engineering.ppt
DhavalShah616893
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
site survey architecture student B.arch.
sri02032006
 
PPTX
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
PPTX
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PDF
PRIZ Academy - Change Flow Thinking Master Change with Confidence.pdf
PRIZ Guru
 
PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
NEUROMOROPHIC nu iajwojeieheueueueu.pptx
knkoodalingam39
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
inherently safer design for engineering.ppt
DhavalShah616893
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
Hashing Introduction , hash functions and techniques
sailajam21
 
site survey architecture student B.arch.
sri02032006
 
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PRIZ Academy - Change Flow Thinking Master Change with Confidence.pdf
PRIZ Guru
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
NEUROMOROPHIC nu iajwojeieheueueueu.pptx
knkoodalingam39
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 

Spatial filtering using image processing