SlideShare ist ein Scribd-Unternehmen logo
1 von 51
COMPUTER GRAPHICS & IMAGE PROCESSING
COM2304
Intensity Transformation and Spatial Filtering – II
Spatial Filtering and Smoothing
K.A.S.H.Kulathilake
B.Sc. (Hons) IT (SLIIT), MCS (UCSC), M.Phil (UOM), SEDA(UK)
Rajarata University of Sri Lanka
Faculty of Applied Sciences
Department of Physical Sciences
Learning Outcomes
COM2304 - Computer Graphics & Image
Processing
• At the end of this lecture, you should be
able to;
– describe the fundamentals of spatial filtering.
– generating spatial filter masks.
– identify smoothing via linear filters and non
linear filters.
– apply smoothing techniques for problem
solving.
Filters in Image Processing
• Filter can accept or reject certain frequency
components.
• In image processing filters are mainly used to
suppress either the high frequencies in the
image, i.e. smoothing the image, or the low
frequencies, i.e. enhancing/ sharpening or
detecting edges in the image.
• An image can be filtered either in the
frequency or in the spatial domain.
COM2304 - Computer Graphics & Image
Processing
Fundamentals of Frequency
Domain Filtering
• Frequency domain filtering involves ;
– transforming the image into the
frequency domain,
– multiplying it with the frequency
filter function and
– re-transforming the result into the
spatial domain.
• The filter function is shaped so as to
attenuate some frequencies and
enhance others.
• For example, a simple lowpass function
is 1 for frequencies smaller than the
cut-off frequency and 0 for all others.
COM2304 - Computer Graphics & Image
Processing
Fundamentals of Spatial Filtering
• Spatial filter contains two components;
– MASK/ CONVOLUTION MATRIX/ KERNEL: A neighborhood
(typically small rectangle:)
– FILTER FUNCTION: A predefined operation that is performed
on the image pixels encompassed by the neighborhood.
• Spatial filtering is the method of choice in situations when only
additive random noise is present.
• Filtering creates a new pixel value with coordinates equal to the
coordinates of the center of the neighborhood, and whose value
is the result of the filtering operation.
COM2304 - Computer Graphics & Image
Processing
Fundamentals of Spatial Filtering
(Cont….)
COM2304 - Computer Graphics & Image
Processing
Fundamentals of Spatial Filtering
(Cont….)
COM2304 - Computer Graphics & Image
Processing
If the operation
performed on the image
pixels is linear, then the
filter is called a linear
spatial filter, otherwise,
the filter is non-linear.
Fundamentals of Spatial Filtering
(Cont….)
• Spatial filtering of an image of size M×N with a filter of size
m×n is given by the expression;
• Where w is the mask and f is the image function, x and y
are varied so that each pixel in w visits every pixel in f.
• m = 2a+1 and n = 2b+1, where a and b are positive
integers.
• This concept is known as correlation.
COM2304 - Computer Graphics & Image
Processing
Fundamentals of Spatial Filtering
(Cont….)
• There are two closely related concepts that
must be understood clearly when performing
linear spatial filtering
– Correlation
• Correlation is the process of moving a filter mask over
the image and computing the sum of products at each
location exactly as explained previously.
– Convolution
• The mechanics of convolution are the same as
correlation except that the filter is first rotated by 180
degrees.
COM2304 - Computer Graphics & Image
Processing
Fundamentals of Spatial Filtering
(Cont….)
COM2304 - Computer Graphics & Image
Processing
If the filter mask is symmetric, correlation and convolution
yield the same result
Mask/Kernel/ Convolution Matrix
• In image processing, a kernel, convolution
matrix, or mask is a small matrix.
• It is useful for blurring, sharpening,
embossing, edge detection, and more.
• This is accomplished by means of convolution
between a kernel and an image.
COM2304 - Computer Graphics & Image
Processing
Mask/Kernel/ Convolution Matrix
(Cont…)
• Important Features of
Kernel
– Size: 3×3, 5×5, 9×9,
21×21
– Shape: rectangle, cross,
strip, circular, diamond
or user defined.
– Coefficients / Values:
set based on the
operation.
– Anchor point: mostly in
middle
COM2304 - Computer Graphics & Image
Processing
0 -1 0
-1 5 -1
0 -1 0
3×3 Kernel
Anchor
Values for
sharpening
operation
Mask/Kernel/ Convolution Matrix
(Cont…)
COM2304 - Computer Graphics & Image
Processing
0 -1 0
-1 5 -1
0 -1 0
Kernel
Mask/Kernel/ Convolution Matrix
(Cont…)
COM2304 - Computer Graphics & Image
Processing
http://setosa.io/ev/image-kernels/
https://en.wikipedia.org/wiki/Kernel_(image_processing)
Convolution
• Convolution is a simple mathematical
operation which is fundamental to many
common image processing operators.
• This can be used in image processing to
implement operators whose output pixel
values are simple linear combinations of
certain input pixel values.
COM2304 - Computer Graphics & Image
Processing
Convolution (Cont…)
COM2304 - Computer Graphics & Image
Processing
Each kernel position
corresponds to a single
output pixel, the value of
which is calculated by
multiplying together the
kernel value and the
underlying image pixel
value for each of the cells
in the kernel, and then
adding all these numbers
together.
The convolution is
performed by sliding the
kernel over the image,
generally starting at the
top left corner.
Convolution (Cont…)
COM2304 - Computer Graphics & Image
Processing
Generating Spatial Filter Masks
• Generating an m×n linear spatial filter requires that we
specify mn mask coefficients.
• These coefficients are selected based on what the filter
is supposed to do.
• There are different types of filters available, some of
them are;
– Linear filters - In signal processing, a linear filter is a filter
whose output is a linear function of its input.
– Continuous function based filters – e.g. Gaussian
smoothing (it’s a kind of linear filter).
– Non linear filters - In signal processing, a non-linear filter is
a filter whose output is not a linear function of its input.
COM2304 - Computer Graphics & Image
Processing
Generating Spatial Filter Masks (cont…)
• Linear filters
– Implement sum of products
– ex: filters used for smoothing
• Continuous function based filters
– ex: Gaussian function of two variables as shown in the following
equation;
– Where σ is the standard deviation and coordinates x and y are
the positive integers.
– Recall that 2D Gaussian function has bell shape and the σ
control the tightness of the bell.
COM2304 - Computer Graphics & Image
Processing
Generating Spatial Filter Masks (cont…)
• Non linear/ Order static filters
– Non linear filters require to specify the size of the
filter and the operation(s) to be performed on the
image pixel contained in the filter.
• ex: filter 5×5 filter centered at an arbitrary point and
perform max operation.
– Non linear filters are quiet powerful in some
applications, than the linear filters.
COM2304 - Computer Graphics & Image
Processing
Smoothing Spatial Filters
• Smoothing filters are used for blurring and
noise reduction.
• Blurring is used in preprocessing tasks, such as
removal of small details from an image prior
to object extraction, and bridging of small
gaps in lines or curves.
• Noise reduction can be accomplished by
blurring with a linear filter and also by
nonlinear filtering.
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters
• Average /Mean Filter
– The output is simply the average of the pixels
contained in the neighborhood of the filter mask.
– In smoothing filter, it replaces the value of every pixel
in an image by the average of the intensity levels in
the neighborhood defined by the filter mask.
– This process result in an image with reduced “sharp”
transitions in intensities.
– Most obvious application of smoothing is noise
reduction because random noise typically consists of
sharp transitions in intensity levels.
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
– Averaging filters blur edges, because edges
represent the sharp intensity transition.
– Average blurring smoothes the false contours that
result from using an insufficient number of
intensity levels.
– A major use of averaging filters is in the reduction
of “irrelevant” detail (pixel regions that are small
with respect to the size of the filter mask) in an
image.
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
COM2304 - Computer Graphics & Image
Processing
Observe
blurring
occur during
smoothing
operation
Smoothing Linear Filters (Cont…)
– Let Sx,y represent the set of coordinates in neighbourhood
of size m×n, centered at point (x, y).
– The arithmetic mean filter computes the average value of
the corrupted image g( x, y) in the area defined by Sx,y.
– The value of the restored image f’ at point ( x, y) is simply
the arithmetic mean computed using the pixels in the
region defined by Sx,y.
COM2304 - Computer Graphics & Image
Processing


xySts
tsg
mn
yxf
),(
),(
1
),(ˆ
Smoothing Linear Filters (Cont…)
• There are different kinds of mean filters all of
which exhibit slightly different behaviour:
• Geometric Mean:
– Achieves similar smoothing to the arithmetic
mean, but tends to lose less image detail
COM2304 - Computer Graphics & Image
Processing
mn
Sts xy
tsgyxf
1
),(
),(),(ˆ








 
Smoothing Linear Filters (Cont…)
• Harmonic Mean:
– Works well for salt noise, but fails for pepper
noise.
– Also does well for other kinds of noise such as
Gaussian noise
COM2304 - Computer Graphics & Image
Processing


xySts tsg
mn
yxf
),( ),(
1
),(ˆ
Smoothing Linear Filters (Cont…)
• Contraharmonic Mean:
– Q is the order of the filter and adjusting its value
changes the filter’s behaviour.
– Positive values of Q eliminate pepper noise.
– Negative values of Q eliminate salt noise.
– If Q =0 it represents the arithmetic filter.
COM2304 - Computer Graphics & Image
Processing






xy
xy
Sts
Q
Sts
Q
tsg
tsg
yxf
),(
),(
1
),(
),(
),(ˆ
Smoothing Linear Filters (Cont…)
Original
Image
Image
Corrupted
By Gaussian
Noise
After A 3*3
Geometric
Mean Filter
After A 3*3
Arithmetic
Mean Filter
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
Image
Corrupted
By Pepper
Noise
Result of
Filtering Above
With 3*3
Contraharmonic
Q=1.5
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
Image
Corrupted
By Salt
Noise
Result of
Filtering Above
With 3*3
Contraharmonic
Q=-1.5
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
Choosing the wrong value for Q when using the
contraharmonic filter can have drastic results
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
• A spatial averaging filter in which all
coefficients are equal is called a Box
Filter.
• The basic strategy behind weighting
the center point the highest and then
reducing the value of the coefficients
as a function of increasing distance
from the origin in spatial averaging
filter is simply an attempt to reduce
blurring in the smoothing process.
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
• Gaussian Smoothing:
– The Gaussian filter is a non-uniform low pass filter.
– The kernel coefficients diminish with increasing distance from
the kernel’s centre.
– Central pixels have a higher weighting than those on the
periphery.
– Larger values of σ produce a wider peak (greater blurring).
– Kernel size must increase with increasing σ to maintain the
Gaussian nature of the filter (`bell-shaped') .
– Gaussian kernel coefficients depend on the value of σ.
– At the edge of the mask, coefficients must be close to 0.
– The kernel is rotationally symmetric with no directional bias.
– Gaussian filters might not preserve image brightness.
COM2304 - Computer Graphics & Image
Processing
Smoothing Linear Filters (Cont…)
• The Gaussian distribution
in 1-D has the form:
• Where σ is the standard
deviation of the
distribution.
• We have also assumed
that the distribution has a
mean of zero (i.e. it is
centered on the line x=0).
COM2304 - Computer Graphics & Image
Processing
1-D Gaussian distribution with
mean 0 and σ=1
Smoothing Linear Filters (Cont…)
• In 2-D, an isotropic
(i.e. circularly symmetric)
Gaussian has the form:
COM2304 - Computer Graphics & Image
Processing
2-D Gaussian distribution with
mean (0,0) and σ=1
Discrete approximation to Gaussian
function with σ=1
The std. dev σ of the Gaussian
determines the amount of
smoothing.
Smoothing Linear Filters (Cont…)
COM2304 - Computer Graphics & Image
Processing
Smoothing Order Static (Nonlinear)
Filters
• The response of the order static or nonlinear
filters is based on ordering (ranking) the pixels
contained in the image area encompassed by the
filter, and then replacing the value of the center
pixel with the value determine by the ranking
result.
• Useful nonlinear filters include;
– Median filter
– Max and min filter
– Midpoint filter
COM2304 - Computer Graphics & Image
Processing
Smoothing Order Static (Nonlinear)
Filters (Cont…)
• Median Filter:
– It can reduce certain typed of random noise with
less blurring than the linear smoothing filters of
similar size.
– Provides excellent results when applying to reduce
salt and pepper noise.
COM2304 - Computer Graphics & Image
Processing
)},({),(ˆ
),(
tsgmedianyxf
xySts 

Smoothing Order Static (Nonlinear)
Filters (Cont…)
COM2304 - Computer Graphics & Image
Processing
Smoothing Order Static (Nonlinear)
Filters (Cont…)
COM2304 - Computer Graphics & Image
Processing
Smoothing Order Static (Nonlinear)
Filters (Cont…)
• Median filter smoothes ("washes") all edges
and boundaries and may "erase" all details
whose size is about n/2× m/2, where n × 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.
COM2304 - Computer Graphics & Image
Processing
Smoothing Order Static (Nonlinear)
Filters (Cont…)
• Max Filter:
• Min Filter:
–Max filter is useful for finding the brightest points in an
image and min filter for finding the darkest points in an
image.
–Max filter is good for pepper noise and min filter is good for
salt noise
COM2304 - Computer Graphics & Image
Processing
)},({max),(ˆ
),(
tsgyxf
xySts 

)},({min),(ˆ
),(
tsgyxf
xySts 

Smoothing Order Static (Nonlinear)
Filters (Cont…)
• Midpoint Filter:
– Good for random Gaussian and uniform noise
COM2304 - Computer Graphics & Image
Processing



 

)},({min)},({max
2
1
),(ˆ
),(),(
tsgtsgyxf
xyxy StsSts
Smoothing Order Static (Nonlinear)
Filters (Cont…)
• Alpha-trimmed Mean Filter:
– We can delete the d/2 lowest and d/2 highest grey
levels.
– So g(s, t) represents the remaining mn – d pixels.
– When d= 0 : arithmetic mean filter.
– Good for combination of salt and pepper and
Gaussian noise.
COM2304 - Computer Graphics & Image
Processing


xySts
tsg
dmn
yxf
),(
),(
1
),(ˆ
Smoothing Order Static (Nonlinear)
Filters (Cont…)
COM2304 - Computer Graphics & Image
Processing
Removing Periodic Noise
• Removing periodic noise form an image
involves removing a particular range of
frequencies from that image.
• Band reject filters can be used for this
purpose.
Out of the scope of this course -   
COM2304 - Computer Graphics & Image
Processing
Reference
• Chapter 03, Chapter 05 of Gonzalez, R.C.,
Woods, R.E., Digital Image Processing, 3rd ed.
Addison-Wesley Pub.
• http://setosa.io/ev/image-kernels/
• https://en.wikipedia.org/wiki/Kernel_(image_
processing)
COM2304 - Computer Graphics & Image
Processing
Learning Outcomes Revisit
• Now, you should be able to;
– describe the fundamentals of spatial filtering.
– generating spatial filter masks.
– identify smoothing via linear filters and non
linear filters.
– apply smoothing techniques for problem
solving.
COM2304 - Computer Graphics & Image
Processing
QUESTIONS ?
Next Lecture – Intensity Transformation and Spatial Filtering – III
COM2304 - Computer Graphics & Image
Processing

Weitere ähnliche Inhalte

Was ist angesagt?

Digital image processing ppt
Digital image processing pptDigital image processing ppt
Digital image processing pptkhanam22
 
Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domainAshish Kumar
 
digital image processing, image processing
digital image processing, image processingdigital image processing, image processing
digital image processing, image processingKalyan Acharjya
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation pptGichelle Amon
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filtersA B Shinde
 
Lecture 16 KL Transform in Image Processing
Lecture 16 KL Transform in Image ProcessingLecture 16 KL Transform in Image Processing
Lecture 16 KL Transform in Image ProcessingVARUN KUMAR
 
Spatial Filters (Digital Image Processing)
Spatial Filters (Digital Image Processing)Spatial Filters (Digital Image Processing)
Spatial Filters (Digital Image Processing)Kalyan Acharjya
 
Image Filtering in the Frequency Domain
Image Filtering in the Frequency DomainImage Filtering in the Frequency Domain
Image Filtering in the Frequency DomainAmnaakhaan
 
Image Smoothing using Frequency Domain Filters
Image Smoothing using Frequency Domain FiltersImage Smoothing using Frequency Domain Filters
Image Smoothing using Frequency Domain FiltersSuhaila Afzana
 
Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)Moe Moe Myint
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 
Image processing spatialfiltering
Image processing spatialfilteringImage processing spatialfiltering
Image processing spatialfilteringJohn Williams
 
5 spatial filtering p1
5 spatial filtering p15 spatial filtering p1
5 spatial filtering p1Gichelle Amon
 
Lect 02 second portion
Lect 02  second portionLect 02  second portion
Lect 02 second portionMoe Moe Myint
 
Chapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel RelationChapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel RelationVarun Ojha
 

Was ist angesagt? (20)

Digital image processing ppt
Digital image processing pptDigital image processing ppt
Digital image processing ppt
 
Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domain
 
digital image processing, image processing
digital image processing, image processingdigital image processing, image processing
digital image processing, image processing
 
IMAGE SEGMENTATION.
IMAGE SEGMENTATION.IMAGE SEGMENTATION.
IMAGE SEGMENTATION.
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation ppt
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Lecture 16 KL Transform in Image Processing
Lecture 16 KL Transform in Image ProcessingLecture 16 KL Transform in Image Processing
Lecture 16 KL Transform in Image Processing
 
Spatial Filters (Digital Image Processing)
Spatial Filters (Digital Image Processing)Spatial Filters (Digital Image Processing)
Spatial Filters (Digital Image Processing)
 
Dip chapter 2
Dip chapter 2Dip chapter 2
Dip chapter 2
 
Image Filtering in the Frequency Domain
Image Filtering in the Frequency DomainImage Filtering in the Frequency Domain
Image Filtering in the Frequency Domain
 
Image Smoothing using Frequency Domain Filters
Image Smoothing using Frequency Domain FiltersImage Smoothing using Frequency Domain Filters
Image Smoothing using Frequency Domain Filters
 
Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Spatial domain and filtering
Spatial domain and filteringSpatial domain and filtering
Spatial domain and filtering
 
Image processing spatialfiltering
Image processing spatialfilteringImage processing spatialfiltering
Image processing spatialfiltering
 
5 spatial filtering p1
5 spatial filtering p15 spatial filtering p1
5 spatial filtering p1
 
Lect 02 second portion
Lect 02  second portionLect 02  second portion
Lect 02 second portion
 
Pixelrelationships
PixelrelationshipsPixelrelationships
Pixelrelationships
 
Chapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel RelationChapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel Relation
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processing
 

Andere mochten auch

Digital image processing
Digital image processingDigital image processing
Digital image processingVandana Verma
 
Spatial enhancement
Spatial enhancement Spatial enhancement
Spatial enhancement abinarkt
 
Texture in image processing
Texture in image processing Texture in image processing
Texture in image processing Anna Aquarian
 
Smoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainSmoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainMadhu Bala
 
Image Texture Analysis
Image Texture AnalysisImage Texture Analysis
Image Texture Analysislalitxp
 
Edge detection of video using matlab code
Edge detection of video using matlab codeEdge detection of video using matlab code
Edge detection of video using matlab codeBhushan Deore
 
Digital Image Processing: Image Restoration
Digital Image Processing: Image RestorationDigital Image Processing: Image Restoration
Digital Image Processing: Image RestorationMostafa G. M. Mostafa
 
Edge Detection algorithm and code
Edge Detection algorithm and codeEdge Detection algorithm and code
Edge Detection algorithm and codeVaddi Manikanta
 
Digital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Spatial DomainDigital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Spatial DomainMostafa G. M. Mostafa
 
Digital Image Processing: Image Enhancement in the Frequency Domain
Digital Image Processing: Image Enhancement in the Frequency DomainDigital Image Processing: Image Enhancement in the Frequency Domain
Digital Image Processing: Image Enhancement in the Frequency DomainMostafa G. M. Mostafa
 
Introduction to wavelet transform
Introduction to wavelet transformIntroduction to wavelet transform
Introduction to wavelet transformRaj Endiran
 
Image enhancement
Image enhancementImage enhancement
Image enhancementAyaelshiwi
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniquesSaideep
 
Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)Kalyan Acharjya
 
image_enhancement_spatial
 image_enhancement_spatial image_enhancement_spatial
image_enhancement_spatialhoneyjecrc
 
discrete wavelet transform
discrete wavelet transformdiscrete wavelet transform
discrete wavelet transformpiyush_11
 
Digital image processing img smoothning
Digital image processing img smoothningDigital image processing img smoothning
Digital image processing img smoothningVinay Gupta
 

Andere mochten auch (20)

Digital image processing
Digital image processingDigital image processing
Digital image processing
 
Spatial enhancement
Spatial enhancement Spatial enhancement
Spatial enhancement
 
Texture in image processing
Texture in image processing Texture in image processing
Texture in image processing
 
Smoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainSmoothing Filters in Spatial Domain
Smoothing Filters in Spatial Domain
 
Image Texture Analysis
Image Texture AnalysisImage Texture Analysis
Image Texture Analysis
 
Edge detection of video using matlab code
Edge detection of video using matlab codeEdge detection of video using matlab code
Edge detection of video using matlab code
 
Digital Image Processing: Image Restoration
Digital Image Processing: Image RestorationDigital Image Processing: Image Restoration
Digital Image Processing: Image Restoration
 
Edge Detection algorithm and code
Edge Detection algorithm and codeEdge Detection algorithm and code
Edge Detection algorithm and code
 
Digital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Spatial DomainDigital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Spatial Domain
 
Digital Image Processing: Image Enhancement in the Frequency Domain
Digital Image Processing: Image Enhancement in the Frequency DomainDigital Image Processing: Image Enhancement in the Frequency Domain
Digital Image Processing: Image Enhancement in the Frequency Domain
 
Introduction to wavelet transform
Introduction to wavelet transformIntroduction to wavelet transform
Introduction to wavelet transform
 
Edge detection
Edge detectionEdge detection
Edge detection
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
 
Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)Image Restoration (Digital Image Processing)
Image Restoration (Digital Image Processing)
 
image_enhancement_spatial
 image_enhancement_spatial image_enhancement_spatial
image_enhancement_spatial
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
 
Image processing ppt
Image processing pptImage processing ppt
Image processing ppt
 
discrete wavelet transform
discrete wavelet transformdiscrete wavelet transform
discrete wavelet transform
 
Digital image processing img smoothning
Digital image processing img smoothningDigital image processing img smoothning
Digital image processing img smoothning
 

Ähnlich wie COM2304: Intensity Transformation and Spatial Filtering – II Spatial Filtering and Smoothing

COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...Hemantha Kulathilake
 
COM2304: Morphological Image Processing
COM2304: Morphological Image ProcessingCOM2304: Morphological Image Processing
COM2304: Morphological Image ProcessingHemantha Kulathilake
 
Fidelity criteria in image compression
Fidelity criteria in image compressionFidelity criteria in image compression
Fidelity criteria in image compressionKadamPawan
 
Translation Invariance (TI) based Novel Approach for better De-noising of Dig...
Translation Invariance (TI) based Novel Approach for better De-noising of Dig...Translation Invariance (TI) based Novel Approach for better De-noising of Dig...
Translation Invariance (TI) based Novel Approach for better De-noising of Dig...IRJET Journal
 
COM2304: Introduction to Computer Vision & Image Processing
COM2304: Introduction to Computer Vision & Image Processing COM2304: Introduction to Computer Vision & Image Processing
COM2304: Introduction to Computer Vision & Image Processing Hemantha Kulathilake
 
When Discrete Optimization Meets Multimedia Security (and Beyond)
When Discrete Optimization Meets Multimedia Security (and Beyond)When Discrete Optimization Meets Multimedia Security (and Beyond)
When Discrete Optimization Meets Multimedia Security (and Beyond)Shujun Li
 
COM2304: Digital Image Fundamentals - I
COM2304: Digital Image Fundamentals - I COM2304: Digital Image Fundamentals - I
COM2304: Digital Image Fundamentals - I Hemantha Kulathilake
 
Image processing
Image processingImage processing
Image processingkamal330
 
IRJET - Computer-Assisted ALL, AML, CLL, CML Detection and Counting for D...
IRJET -  	  Computer-Assisted ALL, AML, CLL, CML Detection and Counting for D...IRJET -  	  Computer-Assisted ALL, AML, CLL, CML Detection and Counting for D...
IRJET - Computer-Assisted ALL, AML, CLL, CML Detection and Counting for D...IRJET Journal
 
COMPUTER GRAPHICS
COMPUTER GRAPHICSCOMPUTER GRAPHICS
COMPUTER GRAPHICSJagan Raja
 
IRJET - Change Detection in Satellite Images using Convolutional Neural N...
IRJET -  	  Change Detection in Satellite Images using Convolutional Neural N...IRJET -  	  Change Detection in Satellite Images using Convolutional Neural N...
IRJET - Change Detection in Satellite Images using Convolutional Neural N...IRJET Journal
 
DIP Notes Unit-1 PPT.pdf
DIP Notes Unit-1 PPT.pdfDIP Notes Unit-1 PPT.pdf
DIP Notes Unit-1 PPT.pdfGaurav Sharma
 
Final image processing
Final image processingFinal image processing
Final image processingSharanjit Kaur
 

Ähnlich wie COM2304: Intensity Transformation and Spatial Filtering – II Spatial Filtering and Smoothing (20)

COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
 
Segmentation Techniques -I
Segmentation Techniques -ISegmentation Techniques -I
Segmentation Techniques -I
 
COM2304: Morphological Image Processing
COM2304: Morphological Image ProcessingCOM2304: Morphological Image Processing
COM2304: Morphological Image Processing
 
Digital Image Fundamentals - II
Digital Image Fundamentals - IIDigital Image Fundamentals - II
Digital Image Fundamentals - II
 
Segmentation Techniques -II
Segmentation Techniques -IISegmentation Techniques -II
Segmentation Techniques -II
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
ACMP340.pptx
ACMP340.pptxACMP340.pptx
ACMP340.pptx
 
Fidelity criteria in image compression
Fidelity criteria in image compressionFidelity criteria in image compression
Fidelity criteria in image compression
 
Translation Invariance (TI) based Novel Approach for better De-noising of Dig...
Translation Invariance (TI) based Novel Approach for better De-noising of Dig...Translation Invariance (TI) based Novel Approach for better De-noising of Dig...
Translation Invariance (TI) based Novel Approach for better De-noising of Dig...
 
COM2304: Introduction to Computer Vision & Image Processing
COM2304: Introduction to Computer Vision & Image Processing COM2304: Introduction to Computer Vision & Image Processing
COM2304: Introduction to Computer Vision & Image Processing
 
When Discrete Optimization Meets Multimedia Security (and Beyond)
When Discrete Optimization Meets Multimedia Security (and Beyond)When Discrete Optimization Meets Multimedia Security (and Beyond)
When Discrete Optimization Meets Multimedia Security (and Beyond)
 
COM2304: Digital Image Fundamentals - I
COM2304: Digital Image Fundamentals - I COM2304: Digital Image Fundamentals - I
COM2304: Digital Image Fundamentals - I
 
Image processing
Image processingImage processing
Image processing
 
IRJET - Computer-Assisted ALL, AML, CLL, CML Detection and Counting for D...
IRJET -  	  Computer-Assisted ALL, AML, CLL, CML Detection and Counting for D...IRJET -  	  Computer-Assisted ALL, AML, CLL, CML Detection and Counting for D...
IRJET - Computer-Assisted ALL, AML, CLL, CML Detection and Counting for D...
 
COMPUTER GRAPHICS
COMPUTER GRAPHICSCOMPUTER GRAPHICS
COMPUTER GRAPHICS
 
Presentation
PresentationPresentation
Presentation
 
IRJET - Change Detection in Satellite Images using Convolutional Neural N...
IRJET -  	  Change Detection in Satellite Images using Convolutional Neural N...IRJET -  	  Change Detection in Satellite Images using Convolutional Neural N...
IRJET - Change Detection in Satellite Images using Convolutional Neural N...
 
2. filtering basics
2. filtering basics2. filtering basics
2. filtering basics
 
DIP Notes Unit-1 PPT.pdf
DIP Notes Unit-1 PPT.pdfDIP Notes Unit-1 PPT.pdf
DIP Notes Unit-1 PPT.pdf
 
Final image processing
Final image processingFinal image processing
Final image processing
 

Mehr von Hemantha Kulathilake

NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar Hemantha Kulathilake
 
NLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishNLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishHemantha Kulathilake
 
NLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language ModelNLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language ModelHemantha Kulathilake
 
NLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingNLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingHemantha Kulathilake
 
COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation Hemantha Kulathilake
 

Mehr von Hemantha Kulathilake (20)

NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar
 
NLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishNLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for English
 
NLP_KASHK:POS Tagging
NLP_KASHK:POS TaggingNLP_KASHK:POS Tagging
NLP_KASHK:POS Tagging
 
NLP_KASHK:Markov Models
NLP_KASHK:Markov ModelsNLP_KASHK:Markov Models
NLP_KASHK:Markov Models
 
NLP_KASHK:Smoothing N-gram Models
NLP_KASHK:Smoothing N-gram ModelsNLP_KASHK:Smoothing N-gram Models
NLP_KASHK:Smoothing N-gram Models
 
NLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language ModelNLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language Model
 
NLP_KASHK:N-Grams
NLP_KASHK:N-GramsNLP_KASHK:N-Grams
NLP_KASHK:N-Grams
 
NLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit DistanceNLP_KASHK:Minimum Edit Distance
NLP_KASHK:Minimum Edit Distance
 
NLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingNLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological Parsing
 
NLP_KASHK:Morphology
NLP_KASHK:MorphologyNLP_KASHK:Morphology
NLP_KASHK:Morphology
 
NLP_KASHK:Text Normalization
NLP_KASHK:Text NormalizationNLP_KASHK:Text Normalization
NLP_KASHK:Text Normalization
 
NLP_KASHK:Finite-State Automata
NLP_KASHK:Finite-State AutomataNLP_KASHK:Finite-State Automata
NLP_KASHK:Finite-State Automata
 
NLP_KASHK:Regular Expressions
NLP_KASHK:Regular Expressions NLP_KASHK:Regular Expressions
NLP_KASHK:Regular Expressions
 
NLP_KASHK: Introduction
NLP_KASHK: Introduction NLP_KASHK: Introduction
NLP_KASHK: Introduction
 
COM1407: File Processing
COM1407: File Processing COM1407: File Processing
COM1407: File Processing
 
COm1407: Character & Strings
COm1407: Character & StringsCOm1407: Character & Strings
COm1407: Character & Strings
 
COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation
 
COM1407: Input/ Output Functions
COM1407: Input/ Output FunctionsCOM1407: Input/ Output Functions
COM1407: Input/ Output Functions
 
COM1407: Working with Pointers
COM1407: Working with PointersCOM1407: Working with Pointers
COM1407: Working with Pointers
 
COM1407: Arrays
COM1407: ArraysCOM1407: Arrays
COM1407: Arrays
 

Kürzlich hochgeladen

PSP3 employability assessment form .docx
PSP3 employability assessment form .docxPSP3 employability assessment form .docx
PSP3 employability assessment form .docxmarwaahmad357
 
CW marking grid Analytical BS - M Ahmad.docx
CW  marking grid Analytical BS - M Ahmad.docxCW  marking grid Analytical BS - M Ahmad.docx
CW marking grid Analytical BS - M Ahmad.docxmarwaahmad357
 
Pests of Redgram_Identification, Binomics_Dr.UPR
Pests of Redgram_Identification, Binomics_Dr.UPRPests of Redgram_Identification, Binomics_Dr.UPR
Pests of Redgram_Identification, Binomics_Dr.UPRPirithiRaju
 
Pests of tenai_Identification,Binomics_Dr.UPR
Pests of tenai_Identification,Binomics_Dr.UPRPests of tenai_Identification,Binomics_Dr.UPR
Pests of tenai_Identification,Binomics_Dr.UPRPirithiRaju
 
soft skills question paper set for bba ca
soft skills question paper set for bba casoft skills question paper set for bba ca
soft skills question paper set for bba caohsadfeeling
 
biosynthesis of the cell wall and antibiotics
biosynthesis of the cell wall and antibioticsbiosynthesis of the cell wall and antibiotics
biosynthesis of the cell wall and antibioticsSafaFallah
 
Krishi Vigyan Kendras - कृषि विज्ञान केंद्र
Krishi Vigyan Kendras - कृषि विज्ञान केंद्रKrishi Vigyan Kendras - कृषि विज्ञान केंद्र
Krishi Vigyan Kendras - कृषि विज्ञान केंद्रKrashi Coaching
 
Alternative system of medicine herbal drug technology syllabus
Alternative system of medicine herbal drug technology syllabusAlternative system of medicine herbal drug technology syllabus
Alternative system of medicine herbal drug technology syllabusPradnya Wadekar
 
SCIENCE 6 QUARTER 3 REVIEWER(FRICTION, GRAVITY, ENERGY AND SPEED).pptx
SCIENCE 6 QUARTER 3 REVIEWER(FRICTION, GRAVITY, ENERGY AND SPEED).pptxSCIENCE 6 QUARTER 3 REVIEWER(FRICTION, GRAVITY, ENERGY AND SPEED).pptx
SCIENCE 6 QUARTER 3 REVIEWER(FRICTION, GRAVITY, ENERGY AND SPEED).pptxROVELYNEDELUNA3
 
Exploration Method’s in Archaeological Studies & Research
Exploration Method’s in Archaeological Studies & ResearchExploration Method’s in Archaeological Studies & Research
Exploration Method’s in Archaeological Studies & ResearchPrachya Adhyayan
 
geometric quantization on coadjoint orbits
geometric quantization on coadjoint orbitsgeometric quantization on coadjoint orbits
geometric quantization on coadjoint orbitsHassan Jolany
 
Bureau of Indian Standards Specification of Shampoo.pptx
Bureau of Indian Standards Specification of Shampoo.pptxBureau of Indian Standards Specification of Shampoo.pptx
Bureau of Indian Standards Specification of Shampoo.pptxkastureyashashree
 
Pests of wheat_Identification, Bionomics, Damage symptoms, IPM_Dr.UPR.pdf
Pests of wheat_Identification, Bionomics, Damage symptoms, IPM_Dr.UPR.pdfPests of wheat_Identification, Bionomics, Damage symptoms, IPM_Dr.UPR.pdf
Pests of wheat_Identification, Bionomics, Damage symptoms, IPM_Dr.UPR.pdfPirithiRaju
 
Legacy Analysis of Dark Matter Annihilation from the Milky Way Dwarf Spheroid...
Legacy Analysis of Dark Matter Annihilation from the Milky Way Dwarf Spheroid...Legacy Analysis of Dark Matter Annihilation from the Milky Way Dwarf Spheroid...
Legacy Analysis of Dark Matter Annihilation from the Milky Way Dwarf Spheroid...Sérgio Sacani
 
Main Exam Applied biochemistry final year
Main Exam Applied biochemistry final yearMain Exam Applied biochemistry final year
Main Exam Applied biochemistry final yearmarwaahmad357
 
Lehninger_Chapter 17_Fatty acid Oxid.ppt
Lehninger_Chapter 17_Fatty acid Oxid.pptLehninger_Chapter 17_Fatty acid Oxid.ppt
Lehninger_Chapter 17_Fatty acid Oxid.pptSachin Teotia
 
MARKER ASSISTED SELECTION IN CROP IMPROVEMENT
MARKER ASSISTED SELECTION IN CROP IMPROVEMENTMARKER ASSISTED SELECTION IN CROP IMPROVEMENT
MARKER ASSISTED SELECTION IN CROP IMPROVEMENTjipexe1248
 
Pests of ragi_Identification, Binomics_Dr.UPR
Pests of ragi_Identification, Binomics_Dr.UPRPests of ragi_Identification, Binomics_Dr.UPR
Pests of ragi_Identification, Binomics_Dr.UPRPirithiRaju
 

Kürzlich hochgeladen (20)

PSP3 employability assessment form .docx
PSP3 employability assessment form .docxPSP3 employability assessment form .docx
PSP3 employability assessment form .docx
 
CW marking grid Analytical BS - M Ahmad.docx
CW  marking grid Analytical BS - M Ahmad.docxCW  marking grid Analytical BS - M Ahmad.docx
CW marking grid Analytical BS - M Ahmad.docx
 
Pests of Redgram_Identification, Binomics_Dr.UPR
Pests of Redgram_Identification, Binomics_Dr.UPRPests of Redgram_Identification, Binomics_Dr.UPR
Pests of Redgram_Identification, Binomics_Dr.UPR
 
Pests of tenai_Identification,Binomics_Dr.UPR
Pests of tenai_Identification,Binomics_Dr.UPRPests of tenai_Identification,Binomics_Dr.UPR
Pests of tenai_Identification,Binomics_Dr.UPR
 
soft skills question paper set for bba ca
soft skills question paper set for bba casoft skills question paper set for bba ca
soft skills question paper set for bba ca
 
Cheminformatics tools supporting dissemination of data associated with US EPA...
Cheminformatics tools supporting dissemination of data associated with US EPA...Cheminformatics tools supporting dissemination of data associated with US EPA...
Cheminformatics tools supporting dissemination of data associated with US EPA...
 
biosynthesis of the cell wall and antibiotics
biosynthesis of the cell wall and antibioticsbiosynthesis of the cell wall and antibiotics
biosynthesis of the cell wall and antibiotics
 
Krishi Vigyan Kendras - कृषि विज्ञान केंद्र
Krishi Vigyan Kendras - कृषि विज्ञान केंद्रKrishi Vigyan Kendras - कृषि विज्ञान केंद्र
Krishi Vigyan Kendras - कृषि विज्ञान केंद्र
 
Alternative system of medicine herbal drug technology syllabus
Alternative system of medicine herbal drug technology syllabusAlternative system of medicine herbal drug technology syllabus
Alternative system of medicine herbal drug technology syllabus
 
Applying Cheminformatics to Develop a Structure Searchable Database of Analyt...
Applying Cheminformatics to Develop a Structure Searchable Database of Analyt...Applying Cheminformatics to Develop a Structure Searchable Database of Analyt...
Applying Cheminformatics to Develop a Structure Searchable Database of Analyt...
 
SCIENCE 6 QUARTER 3 REVIEWER(FRICTION, GRAVITY, ENERGY AND SPEED).pptx
SCIENCE 6 QUARTER 3 REVIEWER(FRICTION, GRAVITY, ENERGY AND SPEED).pptxSCIENCE 6 QUARTER 3 REVIEWER(FRICTION, GRAVITY, ENERGY AND SPEED).pptx
SCIENCE 6 QUARTER 3 REVIEWER(FRICTION, GRAVITY, ENERGY AND SPEED).pptx
 
Exploration Method’s in Archaeological Studies & Research
Exploration Method’s in Archaeological Studies & ResearchExploration Method’s in Archaeological Studies & Research
Exploration Method’s in Archaeological Studies & Research
 
geometric quantization on coadjoint orbits
geometric quantization on coadjoint orbitsgeometric quantization on coadjoint orbits
geometric quantization on coadjoint orbits
 
Bureau of Indian Standards Specification of Shampoo.pptx
Bureau of Indian Standards Specification of Shampoo.pptxBureau of Indian Standards Specification of Shampoo.pptx
Bureau of Indian Standards Specification of Shampoo.pptx
 
Pests of wheat_Identification, Bionomics, Damage symptoms, IPM_Dr.UPR.pdf
Pests of wheat_Identification, Bionomics, Damage symptoms, IPM_Dr.UPR.pdfPests of wheat_Identification, Bionomics, Damage symptoms, IPM_Dr.UPR.pdf
Pests of wheat_Identification, Bionomics, Damage symptoms, IPM_Dr.UPR.pdf
 
Legacy Analysis of Dark Matter Annihilation from the Milky Way Dwarf Spheroid...
Legacy Analysis of Dark Matter Annihilation from the Milky Way Dwarf Spheroid...Legacy Analysis of Dark Matter Annihilation from the Milky Way Dwarf Spheroid...
Legacy Analysis of Dark Matter Annihilation from the Milky Way Dwarf Spheroid...
 
Main Exam Applied biochemistry final year
Main Exam Applied biochemistry final yearMain Exam Applied biochemistry final year
Main Exam Applied biochemistry final year
 
Lehninger_Chapter 17_Fatty acid Oxid.ppt
Lehninger_Chapter 17_Fatty acid Oxid.pptLehninger_Chapter 17_Fatty acid Oxid.ppt
Lehninger_Chapter 17_Fatty acid Oxid.ppt
 
MARKER ASSISTED SELECTION IN CROP IMPROVEMENT
MARKER ASSISTED SELECTION IN CROP IMPROVEMENTMARKER ASSISTED SELECTION IN CROP IMPROVEMENT
MARKER ASSISTED SELECTION IN CROP IMPROVEMENT
 
Pests of ragi_Identification, Binomics_Dr.UPR
Pests of ragi_Identification, Binomics_Dr.UPRPests of ragi_Identification, Binomics_Dr.UPR
Pests of ragi_Identification, Binomics_Dr.UPR
 

COM2304: Intensity Transformation and Spatial Filtering – II Spatial Filtering and Smoothing

  • 1. COMPUTER GRAPHICS & IMAGE PROCESSING COM2304 Intensity Transformation and Spatial Filtering – II Spatial Filtering and Smoothing K.A.S.H.Kulathilake B.Sc. (Hons) IT (SLIIT), MCS (UCSC), M.Phil (UOM), SEDA(UK) Rajarata University of Sri Lanka Faculty of Applied Sciences Department of Physical Sciences
  • 2. Learning Outcomes COM2304 - Computer Graphics & Image Processing • At the end of this lecture, you should be able to; – describe the fundamentals of spatial filtering. – generating spatial filter masks. – identify smoothing via linear filters and non linear filters. – apply smoothing techniques for problem solving.
  • 3. Filters in Image Processing • Filter can accept or reject certain frequency components. • In image processing filters are mainly used to suppress either the high frequencies in the image, i.e. smoothing the image, or the low frequencies, i.e. enhancing/ sharpening or detecting edges in the image. • An image can be filtered either in the frequency or in the spatial domain. COM2304 - Computer Graphics & Image Processing
  • 4. Fundamentals of Frequency Domain Filtering • Frequency domain filtering involves ; – transforming the image into the frequency domain, – multiplying it with the frequency filter function and – re-transforming the result into the spatial domain. • The filter function is shaped so as to attenuate some frequencies and enhance others. • For example, a simple lowpass function is 1 for frequencies smaller than the cut-off frequency and 0 for all others. COM2304 - Computer Graphics & Image Processing
  • 5. Fundamentals of Spatial Filtering • Spatial filter contains two components; – MASK/ CONVOLUTION MATRIX/ KERNEL: A neighborhood (typically small rectangle:) – FILTER FUNCTION: A predefined operation that is performed on the image pixels encompassed by the neighborhood. • Spatial filtering is the method of choice in situations when only additive random noise is present. • Filtering creates a new pixel value with coordinates equal to the coordinates of the center of the neighborhood, and whose value is the result of the filtering operation. COM2304 - Computer Graphics & Image Processing
  • 6. Fundamentals of Spatial Filtering (Cont….) COM2304 - Computer Graphics & Image Processing
  • 7. Fundamentals of Spatial Filtering (Cont….) COM2304 - Computer Graphics & Image Processing If the operation performed on the image pixels is linear, then the filter is called a linear spatial filter, otherwise, the filter is non-linear.
  • 8. Fundamentals of Spatial Filtering (Cont….) • Spatial filtering of an image of size M×N with a filter of size m×n is given by the expression; • Where w is the mask and f is the image function, x and y are varied so that each pixel in w visits every pixel in f. • m = 2a+1 and n = 2b+1, where a and b are positive integers. • This concept is known as correlation. COM2304 - Computer Graphics & Image Processing
  • 9. Fundamentals of Spatial Filtering (Cont….) • There are two closely related concepts that must be understood clearly when performing linear spatial filtering – Correlation • Correlation is the process of moving a filter mask over the image and computing the sum of products at each location exactly as explained previously. – Convolution • The mechanics of convolution are the same as correlation except that the filter is first rotated by 180 degrees. COM2304 - Computer Graphics & Image Processing
  • 10. Fundamentals of Spatial Filtering (Cont….) COM2304 - Computer Graphics & Image Processing If the filter mask is symmetric, correlation and convolution yield the same result
  • 11. Mask/Kernel/ Convolution Matrix • In image processing, a kernel, convolution matrix, or mask is a small matrix. • It is useful for blurring, sharpening, embossing, edge detection, and more. • This is accomplished by means of convolution between a kernel and an image. COM2304 - Computer Graphics & Image Processing
  • 12. Mask/Kernel/ Convolution Matrix (Cont…) • Important Features of Kernel – Size: 3×3, 5×5, 9×9, 21×21 – Shape: rectangle, cross, strip, circular, diamond or user defined. – Coefficients / Values: set based on the operation. – Anchor point: mostly in middle COM2304 - Computer Graphics & Image Processing 0 -1 0 -1 5 -1 0 -1 0 3×3 Kernel Anchor Values for sharpening operation
  • 13. Mask/Kernel/ Convolution Matrix (Cont…) COM2304 - Computer Graphics & Image Processing 0 -1 0 -1 5 -1 0 -1 0 Kernel
  • 14. Mask/Kernel/ Convolution Matrix (Cont…) COM2304 - Computer Graphics & Image Processing http://setosa.io/ev/image-kernels/ https://en.wikipedia.org/wiki/Kernel_(image_processing)
  • 15. Convolution • Convolution is a simple mathematical operation which is fundamental to many common image processing operators. • This can be used in image processing to implement operators whose output pixel values are simple linear combinations of certain input pixel values. COM2304 - Computer Graphics & Image Processing
  • 16. Convolution (Cont…) COM2304 - Computer Graphics & Image Processing Each kernel position corresponds to a single output pixel, the value of which is calculated by multiplying together the kernel value and the underlying image pixel value for each of the cells in the kernel, and then adding all these numbers together. The convolution is performed by sliding the kernel over the image, generally starting at the top left corner.
  • 17. Convolution (Cont…) COM2304 - Computer Graphics & Image Processing
  • 18. Generating Spatial Filter Masks • Generating an m×n linear spatial filter requires that we specify mn mask coefficients. • These coefficients are selected based on what the filter is supposed to do. • There are different types of filters available, some of them are; – Linear filters - In signal processing, a linear filter is a filter whose output is a linear function of its input. – Continuous function based filters – e.g. Gaussian smoothing (it’s a kind of linear filter). – Non linear filters - In signal processing, a non-linear filter is a filter whose output is not a linear function of its input. COM2304 - Computer Graphics & Image Processing
  • 19. Generating Spatial Filter Masks (cont…) • Linear filters – Implement sum of products – ex: filters used for smoothing • Continuous function based filters – ex: Gaussian function of two variables as shown in the following equation; – Where σ is the standard deviation and coordinates x and y are the positive integers. – Recall that 2D Gaussian function has bell shape and the σ control the tightness of the bell. COM2304 - Computer Graphics & Image Processing
  • 20. Generating Spatial Filter Masks (cont…) • Non linear/ Order static filters – Non linear filters require to specify the size of the filter and the operation(s) to be performed on the image pixel contained in the filter. • ex: filter 5×5 filter centered at an arbitrary point and perform max operation. – Non linear filters are quiet powerful in some applications, than the linear filters. COM2304 - Computer Graphics & Image Processing
  • 21. Smoothing Spatial Filters • Smoothing filters are used for blurring and noise reduction. • Blurring is used in preprocessing tasks, such as removal of small details from an image prior to object extraction, and bridging of small gaps in lines or curves. • Noise reduction can be accomplished by blurring with a linear filter and also by nonlinear filtering. COM2304 - Computer Graphics & Image Processing
  • 22. Smoothing Linear Filters • Average /Mean Filter – The output is simply the average of the pixels contained in the neighborhood of the filter mask. – In smoothing filter, it replaces the value of every pixel in an image by the average of the intensity levels in the neighborhood defined by the filter mask. – This process result in an image with reduced “sharp” transitions in intensities. – Most obvious application of smoothing is noise reduction because random noise typically consists of sharp transitions in intensity levels. COM2304 - Computer Graphics & Image Processing
  • 23. Smoothing Linear Filters (Cont…) COM2304 - Computer Graphics & Image Processing
  • 24. Smoothing Linear Filters (Cont…) – Averaging filters blur edges, because edges represent the sharp intensity transition. – Average blurring smoothes the false contours that result from using an insufficient number of intensity levels. – A major use of averaging filters is in the reduction of “irrelevant” detail (pixel regions that are small with respect to the size of the filter mask) in an image. COM2304 - Computer Graphics & Image Processing
  • 25. Smoothing Linear Filters (Cont…) COM2304 - Computer Graphics & Image Processing Observe blurring occur during smoothing operation
  • 26. Smoothing Linear Filters (Cont…) – Let Sx,y represent the set of coordinates in neighbourhood of size m×n, centered at point (x, y). – The arithmetic mean filter computes the average value of the corrupted image g( x, y) in the area defined by Sx,y. – The value of the restored image f’ at point ( x, y) is simply the arithmetic mean computed using the pixels in the region defined by Sx,y. COM2304 - Computer Graphics & Image Processing   xySts tsg mn yxf ),( ),( 1 ),(ˆ
  • 27. Smoothing Linear Filters (Cont…) • There are different kinds of mean filters all of which exhibit slightly different behaviour: • Geometric Mean: – Achieves similar smoothing to the arithmetic mean, but tends to lose less image detail COM2304 - Computer Graphics & Image Processing mn Sts xy tsgyxf 1 ),( ),(),(ˆ          
  • 28. Smoothing Linear Filters (Cont…) • Harmonic Mean: – Works well for salt noise, but fails for pepper noise. – Also does well for other kinds of noise such as Gaussian noise COM2304 - Computer Graphics & Image Processing   xySts tsg mn yxf ),( ),( 1 ),(ˆ
  • 29. Smoothing Linear Filters (Cont…) • Contraharmonic Mean: – Q is the order of the filter and adjusting its value changes the filter’s behaviour. – Positive values of Q eliminate pepper noise. – Negative values of Q eliminate salt noise. – If Q =0 it represents the arithmetic filter. COM2304 - Computer Graphics & Image Processing       xy xy Sts Q Sts Q tsg tsg yxf ),( ),( 1 ),( ),( ),(ˆ
  • 30. Smoothing Linear Filters (Cont…) Original Image Image Corrupted By Gaussian Noise After A 3*3 Geometric Mean Filter After A 3*3 Arithmetic Mean Filter COM2304 - Computer Graphics & Image Processing
  • 31. Smoothing Linear Filters (Cont…) Image Corrupted By Pepper Noise Result of Filtering Above With 3*3 Contraharmonic Q=1.5 COM2304 - Computer Graphics & Image Processing
  • 32. Smoothing Linear Filters (Cont…) Image Corrupted By Salt Noise Result of Filtering Above With 3*3 Contraharmonic Q=-1.5 COM2304 - Computer Graphics & Image Processing
  • 33. Smoothing Linear Filters (Cont…) Choosing the wrong value for Q when using the contraharmonic filter can have drastic results COM2304 - Computer Graphics & Image Processing
  • 34. Smoothing Linear Filters (Cont…) • A spatial averaging filter in which all coefficients are equal is called a Box Filter. • The basic strategy behind weighting the center point the highest and then reducing the value of the coefficients as a function of increasing distance from the origin in spatial averaging filter is simply an attempt to reduce blurring in the smoothing process. COM2304 - Computer Graphics & Image Processing
  • 35. Smoothing Linear Filters (Cont…) • Gaussian Smoothing: – The Gaussian filter is a non-uniform low pass filter. – The kernel coefficients diminish with increasing distance from the kernel’s centre. – Central pixels have a higher weighting than those on the periphery. – Larger values of σ produce a wider peak (greater blurring). – Kernel size must increase with increasing σ to maintain the Gaussian nature of the filter (`bell-shaped') . – Gaussian kernel coefficients depend on the value of σ. – At the edge of the mask, coefficients must be close to 0. – The kernel is rotationally symmetric with no directional bias. – Gaussian filters might not preserve image brightness. COM2304 - Computer Graphics & Image Processing
  • 36. Smoothing Linear Filters (Cont…) • The Gaussian distribution in 1-D has the form: • Where σ is the standard deviation of the distribution. • We have also assumed that the distribution has a mean of zero (i.e. it is centered on the line x=0). COM2304 - Computer Graphics & Image Processing 1-D Gaussian distribution with mean 0 and σ=1
  • 37. Smoothing Linear Filters (Cont…) • In 2-D, an isotropic (i.e. circularly symmetric) Gaussian has the form: COM2304 - Computer Graphics & Image Processing 2-D Gaussian distribution with mean (0,0) and σ=1 Discrete approximation to Gaussian function with σ=1 The std. dev σ of the Gaussian determines the amount of smoothing.
  • 38. Smoothing Linear Filters (Cont…) COM2304 - Computer Graphics & Image Processing
  • 39. Smoothing Order Static (Nonlinear) Filters • The response of the order static or nonlinear filters is based on ordering (ranking) the pixels contained in the image area encompassed by the filter, and then replacing the value of the center pixel with the value determine by the ranking result. • Useful nonlinear filters include; – Median filter – Max and min filter – Midpoint filter COM2304 - Computer Graphics & Image Processing
  • 40. Smoothing Order Static (Nonlinear) Filters (Cont…) • Median Filter: – It can reduce certain typed of random noise with less blurring than the linear smoothing filters of similar size. – Provides excellent results when applying to reduce salt and pepper noise. COM2304 - Computer Graphics & Image Processing )},({),(ˆ ),( tsgmedianyxf xySts  
  • 41. Smoothing Order Static (Nonlinear) Filters (Cont…) COM2304 - Computer Graphics & Image Processing
  • 42. Smoothing Order Static (Nonlinear) Filters (Cont…) COM2304 - Computer Graphics & Image Processing
  • 43. Smoothing Order Static (Nonlinear) Filters (Cont…) • Median filter smoothes ("washes") all edges and boundaries and may "erase" all details whose size is about n/2× m/2, where n × 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. COM2304 - Computer Graphics & Image Processing
  • 44. Smoothing Order Static (Nonlinear) Filters (Cont…) • Max Filter: • Min Filter: –Max filter is useful for finding the brightest points in an image and min filter for finding the darkest points in an image. –Max filter is good for pepper noise and min filter is good for salt noise COM2304 - Computer Graphics & Image Processing )},({max),(ˆ ),( tsgyxf xySts   )},({min),(ˆ ),( tsgyxf xySts  
  • 45. Smoothing Order Static (Nonlinear) Filters (Cont…) • Midpoint Filter: – Good for random Gaussian and uniform noise COM2304 - Computer Graphics & Image Processing       )},({min)},({max 2 1 ),(ˆ ),(),( tsgtsgyxf xyxy StsSts
  • 46. Smoothing Order Static (Nonlinear) Filters (Cont…) • Alpha-trimmed Mean Filter: – We can delete the d/2 lowest and d/2 highest grey levels. – So g(s, t) represents the remaining mn – d pixels. – When d= 0 : arithmetic mean filter. – Good for combination of salt and pepper and Gaussian noise. COM2304 - Computer Graphics & Image Processing   xySts tsg dmn yxf ),( ),( 1 ),(ˆ
  • 47. Smoothing Order Static (Nonlinear) Filters (Cont…) COM2304 - Computer Graphics & Image Processing
  • 48. Removing Periodic Noise • Removing periodic noise form an image involves removing a particular range of frequencies from that image. • Band reject filters can be used for this purpose. Out of the scope of this course -    COM2304 - Computer Graphics & Image Processing
  • 49. Reference • Chapter 03, Chapter 05 of Gonzalez, R.C., Woods, R.E., Digital Image Processing, 3rd ed. Addison-Wesley Pub. • http://setosa.io/ev/image-kernels/ • https://en.wikipedia.org/wiki/Kernel_(image_ processing) COM2304 - Computer Graphics & Image Processing
  • 50. Learning Outcomes Revisit • Now, you should be able to; – describe the fundamentals of spatial filtering. – generating spatial filter masks. – identify smoothing via linear filters and non linear filters. – apply smoothing techniques for problem solving. COM2304 - Computer Graphics & Image Processing
  • 51. QUESTIONS ? Next Lecture – Intensity Transformation and Spatial Filtering – III COM2304 - Computer Graphics & Image Processing