intelligente - UniMAP Portal

Download Report

Transcript intelligente - UniMAP Portal

Machine Vision
ENT 273
Image Filters
Hema C.R.
Lecture 5
Why Filters are needed?
• Image processing converts an
input image into an enhanced
image from which information
about the image can be retrieved.
• To enhance images any unwanted
information or distortions called
noise has to be removed.
• Filtering is the process which
removes noise from an image
[which also includes lightening
darker regions to enhance quality
of the image or suppresses
unwanted information /region]
Hema ENT 273
Lecture 5
Original Image
Image with Noise
2
Image Noise
• Images are formed by light
falling on a sensor
• Noises are introduced due to
– Quantization – which reduces
the light levels to 256
– Imperfect sensors
– Imperfect lighting conditions
during acquisition
– Compression formats
Hema ENT 273
Lecture 5
3
Types of Noise
Original Image
• Salt and Pepper
– In salt and pepper noise pixels in the image are vastly different
in color from their surrounding pixels.
– The color of a noisy pixel bears no relation to the color of
surrounding pixels.
– Generally this type of noise will only affect a small number of
image pixels.
– When viewed, the image contains dark and white dots, hence
the term salt and pepper noise.
.
Salt and Pepper
Noise
• Gaussian Noise
– In Gaussian noise (dependent noise), an amount of noise is
added to every part of the picture.
– Each pixel in the image will be changed from its original value
by a (usually) small amount.
– Taking a plot of the amount of distortion of a pixel against the
frequency with which it occurs produces a Gaussian distribution
of noise
• Uniform Noise
Gaussian Noise
Uniform Noise
– Pixel values are usually close to their true values.
– Average value is equal to the real one
Hema ENT 273
Lecture 5
4
Noise Removal
• Most Noise removal processes
are called filters
– Applied to each point in an image
[convolution]
– Use information in the small local
windows of a pixel
• Noise removal Filters
– Linear Filters
– Non-Linear Filters
• Linear Filters
– Gaussian filters
– Mean Filter
• Non-Linear Filters
– Median Filter
Hema ENT 273
Lecture 5
5
Linear Systems
• Space Invariant System
– A system whose response remains the
same irrespective of the position of the
input pulse
Input impulse
 ( x  x0 , y  y0 )
Hema ENT 273
Lecture 5
Linear
Space
Invariant
System
Output impulse
response
g( x  x0 , y  y0 )
6
Linear Space Invariant Systems
In LSI systems the output h(x,y) is a convolution
of f(x,y) with impulse response g(x,y)
h( x , y )  f ( x , y )  g( x , y )
Input Image
f ( x, y )
Hema ENT 273
Lecture 5
Linear
Space
Invariant
System
g(x,y)
Output Image
h( x , y )
7
Convolution Mask
P1 P2 P3
P4 P5 P6
A B C
D E F
G H I
P7 P8 P9
h [i,j]
h[ i , j ]  AP1  BP 2  CP3  DP 4  EP5  FP6  GP7  HP8  IP 9
Hema ENT 273
Lecture 5
8
Convolution
• Convolution
– A neighborhood operation in which each
output pixel is a weighted sum of
neighboring input pixels. The weights are
defined by the convolution kernel. Image
processing operations implemented with
convolution include smoothing, sharpening,
and edge enhancement.
– Convolution is a spatially invariant operation
Hema ENT 273
Lecture 5
9
Linear Filters
Hema ENT 273
Lecture 5
10
Gaussian Filter
• Gaussian filters removes noise by
smoothing but also blurs the image,
• The degree of smoothing is determined by
the standard deviation of the Gaussian.
(Larger standard deviation Gaussians, of
course, require larger convolution masks
in order to be accurately represented.)
• The Gaussian outputs a `weighted
average' of each pixel's neighborhood,
with the average weighted more towards
the value of the central pixels.
• This is in contrast to the mean filter's
uniformly weighted average.
• Gaussian provides gentler smoothing and
preserves edges better than a similarly
sized mean filter
Hema ENT 273
Lecture 5
x2
 2
1
Gx  
e 2
2 
 - Standard deviation of
the distribution
11
Mean Filter
• The mean filter is a simple
sliding-window spatial filter
that replaces the center
value in the window with
the average (mean) of all
the pixel values in the
window.
• The window, or kernel, is
usually square but can be
any shape.
• An example of mean
filtering of a single 3x3
window of values is shown
Hema ENT 273
Lecture 5
5 3 7
2 6 4
8 1 9
*
*
*
*
5 *
*
*
*
12
Median Filter
• The median filter is also a sliding-window
spatial filter, but it replaces the center value 3
57 7
in the window with the median of all the
pixel values in the window.
2 5 6
• As for the mean filter, the kernel is usually
18 4 9
square but can be any shape.
• An example of median filtering of a single
2,3,4,5,6,7,9,18,57
3x3 window of values is shown
• Median filter remove 'impulse' noise
(outlying values, either high or low).
* * *
• The median filter is also widely claimed to
6 *
be 'edge-preserving' since it theoretically *
preserves step edges without blurring.
* *
• However, in the presence of noise it does *
blur edges in images slightly.
Hema ENT 273
Lecture 5
13
Histogram Modification
• Histogram equalization
– Is a method for stretching contrast of unevenly
distributed gray values by uniformly redistributing
the gray values
800
600
400
200
0
0
100
200
0
100
200
1000
500
0
Hema ENT 273
Lecture 5
14
References
• Computer Vision – Linda G Shapiro &
George Stockman
• http://en.wikipedia.org/wiki/Image_noise
• Mat lab reference notes
Hema ENT 273
Lecture 5
15
Machine Vision
End of Lecture 5