IMAGE PROCESSING TECHNIQUE
MODULE 4
(IMAGE RESTORATION & IMAGE SEGMENTATION)
IMAGE DEGRADATION MODEL, NOISE MODELS, MEAN FILTERS,
ORDER STATISTIC FILTER, ADAPTIVE FILTERS.
EDGE DETECTION, GRADIENT OPERATORS, LAPLACE OPERATORS
AND ZERO CROSSINGS.
THRESHOLDING, BASIC GLOBAL THRESHOLDING, OPTIMUM
GLOBAL THRESHOLDING USING OTSU METHOD, MULTIPLE
THRESHOLDS, VARIABLE THRESHOLDING, MULTIVARIABLE
THRESHOLDING.
REGION-BASED APPROACH TO SEGMENTATION.
Image Restoration
Image degradation model, Noise models, Mean
Filters, Order Statistic filter, Adaptive filters.
What is Image Restoration?
➢Restoration attempts to recover an image that has been
degraded by using a known of the degradation phenomenon
➢Identify the degradation process and attempt to reverse it
➢Similar to image enhancement, but more objective
A Model of the Image
Degradation/Restoration Process
➢ Here , image degradation is modelled as applying a degradation
function together with an additive noise term, on an input
image f(x,y)to produce a degraded image g(x,y)
➢ Likewise Image restoration is modelled as estimating the function
from the degraded image by using some knowledge
about the degradation function H, and some knowledge about the additive
noise term .We want the estimate to be as close as possible to the
original input image f(x,y)
Contd..
➢If H is a linear, position-invariant process, then the degraded image
g(x,y) is given in the spatial domain by
where h is the spatial representation of the degradation function
and,operation is convolution.
➢We know that convolution in the spatial domain is analogous to
multiplication in the frequency domain, so we may write the model as
equivalent frequency domain representation:
where the terms in capital letters are the Fourier transforms of the
corresponding terms in the above equation.
These two equations are the bases for most of the restoration
material in this chapter.
Contd..
In the following sections, we assume that H
is the identity operator, and we deal only with
degradations due to noise
Noise and Images
➢The sources of noise in digital images arise
during image acquisition (digitization) and
transmission
◦ Imaging sensors can be affected by ambient conditions
◦ Interference can be added
to an image during transmission
Noise Models
➢We can consider a noisy image to be modelled as follows:
g ( x, y ) = f ( x, y ) + ( x, y )
where f(x, y) is the original image pixel, η(x, y)
is the noise term and g(x, y) is the resulting noisy pixel
➢If we can estimate the model that the noise in an image is
based on, this will help us to figure out how to restore the
image
Types of Noise Models
➢Type of noise determines best types of filters for
removing it.
➢Here Noise may be considered random variables,
characterized by a probability density
function(PDF)
Types of Noise Models
1. Salt and pepper noise:
➢Randomly scattered black + white pixels
➢Also called impulse noise, shot noise , binary
noise , Data-drop-out or spike noise
➢Caused by sudden sharp disturbance
➢The PDF of (bipolar) impulse noise is given by
Contd..
➢ If b>a intensity b will appear as a light dot in the image.
Conversely, level a will appear like a dark dot.
➢ Normally value of b is taken as highest possible value for
bright pixel(say 255)and value of a is as highest value for
dark pixel( say 0)
➢ If either a or b is zero, the impulse noise is called unipolar.
Types of Noise Models
2. Gaussian noise
➢ Idealized form of white noise added to image,
normally distributed
➢The PDF of a Gaussian random variable, , is given by
Types of Noise Models
3. Rayleigh noise
➢The PDF of Rayleigh noise is given by
➢The mean and variance of this density is given by
Types of Noise Models
4. Erlang (gamma) noise
➢The PDF of Erlang noise is given by
Types of Noise Models
5. Exponential noise
Types of Noise Models
6. Uniform noise
Types of Noise Models
7. Periodic Noise
➢ Caused by disturbances of a periodic Nature
➢Periodic noise in an image arises typically from
electrical or electromechanical interference during
image acquisition
➢Salt and pepper, Gaussian and other noise can be
cleaned using spatial filters
➢Periodic noise can be cleaned Using frequency
domain filtering
The PDFs provide useful tools for modeling a broad
range of noise corruption situations found in practice
❖For example, Gaussian noise arises in an image due to factors such as
electronic circuit noise and sensor noise due to poor illumination
and/or high temperature.
❖The Rayleigh density is helpful in characterizing noise phenomena in
range imaging.
❖The exponential and gamma densities find application in laser
imaging.
❖Impulse noise is found in situations where quick transients, such as
faulty switching, take place during imaging.
❖The uniform density is perhaps the least descriptive of practical
situations. However, the uniform density is quite useful as the basis for
numerous random number generators that are used in simulations
Noise Example
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
The test pattern to the right is ideal for
demonstrating the addition of noise
The following slides will show the result of adding
noise based on various models to this image
Image
Histogram to go here
Histogram
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Noise Example (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Noise Example (cont…)
Restoration in the Presence of Noise
Only—Spatial Filtering
➢ The noise terms are unknown, so subtracting them from or is
not a realistic option for restoring.
➢ Mainly we are using spatial filtering operation
Restoration in the Presence of Noise
Only—Spatial Filtering
➢Main filters used in spatial filtering are
1. Mean filters
2.Order statistic filters
3.Adaptive filters
Mean filters
➢We can use spatial Mean filters of different kinds
to remove different kinds of noise.
(i) Arithmetic mean filter
(ii)Geometric Mean
(iii)Harmonic Mean
(iv)Contraharmonic Mean
Mean filters(contd..)
Arithmetic Mean filter
➢The arithmetic mean filter is a very simple one and is calculated as
follows:
1
ˆ
f ( x, y ) = g ( s, t )
mn ( s ,t )S xy
➢ie, each pixel is replaced by the average of pixels in the neighbourhood
of size m*n
➢ This is implemented as the simple smoothing filter
➢Blurs the image to remove noise
Mean filters(contd..)
Geometric Mean filter
➢An image restored using a geometric mean filter is given
by the expression
1
mn
fˆ ( x, y ) = g ( s, t )
( s ,t )S xy
➢Here, each restored pixel is given by the product of the
pixels in the subimage window, raised to the power 1/mn
Mean filters(contd..)
Harmonic Mean filter
➢The harmonic mean filtering operation is given by the
expression
mn
fˆ ( x, y ) =
1
( s ,t )S xy g ( s, t )
➢Works well for salt noise, but fails for pepper noise Also
does well for other kinds of noise such as Gaussian noise
Mean filters(contd..)
Contraharmonic Mean filter
➢The contraharmonic mean filter yields a restored image
based on the expression
g
( s ,t )S xy
( s , t ) Q +1
fˆ ( x, y ) =
g (
( s ,t )S xy
s , t ) Q
➢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
➢It cannot do both simultaneously
Question :Find the new pixel value at position (2,2)
using various mean filers for image
restoration??suppose filter size is (3*3)
Original Image x Filtered Image x
4 2 7 5 6 2 5
5 9 1 0 2 53 58
51 204 2 5 0 57 60
48 50 1 9 3 59 63
49 51 52 55 58 64 67
50 54 57 60 63 67 70
51 55 59 62 65 69 72
Image f (x, y) Image f (x, y)
y y
Order Statistics Filters
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
➢Spatial filters that are based on ordering the pixel
values that make up the neighbourhood operated
on by the filter
➢Useful spatial filters include
❑Median filter
❑Max and min filter
❑Midpoint filter
❑Alpha trimmed Mean filter
Order Statistics Filters(contd..)
Median Filter
➢ It replaces the value of a pixel by the median of the intensity levels in the
neighborhood of that pixel:
fˆ ( x, y ) = median{g ( s, t )}
( s ,t )S xy
➢Excellent at noise removal, without the smoothing effects that can occur with
other smoothing filters
➢Particularly good when salt and pepper noise is present
Order Statistics Filters(contd..)
Max and Min Filter
Max Filter: It replaces value of pixel by maximum value of its specified
fˆ ( x, y ) = max {g ( s, t )}
neighbourhood
( s ,t )S xy
Min Filter: It replaces value of pixel by minimum value of its specified
neighbourhood
fˆ ( x, y ) = min {g ( s, t )}
( s ,t )S xy
➢Max filter is good for pepper noise and min is good for salt noise
Order Statistics Filters(contd..)
Midpoint Filter
➢The midpoint filter simply computes the midpoint between
the maximum and minimum values in the area encompassed
by the filter
ˆf ( x, y) = 1 max {g ( s, t )} + min {g ( s, t )}
2 ( s ,t )S xy ( s ,t )S xy
➢Note that this filter combines order statistics and averaging.
It works best for randomly distributed noise, like Gaussian
or uniform noise
Order Statistics Filters(contd..)
Alpha-Trimmed Mean Filter
➢Suppose that we delete the lowest d/2and the highest d/2
intensity values of in the neighborhood Sxy Let represent the
remaining mn-d Pixels by gr(s,t) .
➢A filter formed by averaging these remaining pixels is
called an alphatrimmed mean filter:
1
fˆ ( x, y ) =
mn − d
g ( s, t )
( s ,t )S xy
r
➢Alpha-trimmed filter is useful in situations involving
multiple types of noise, such as a combination of salt-and-
pepper and Gaussian noise
Question :Find the new pixel value at position
(1,3) using various order statistic filers for
image restoration?? suppose filter size is (3*3
Adaptive Filters
➢Adaptive filters are a special type of filters
whose behavior changes based on statistical
characteristics of the image inside the filter
region .
➢Two examples of adaptive filters
1. Adaptive, local noise reduction filter
2. Adaptive median filter
Adaptive, local noise reduction
filter
➢The simplest statistical measures of a random
variable are its mean and variance.
➢The mean gives a measure of average intensity in
the region over which the mean is computed, and the
variance gives a measure of contrast in that region.
Suppose Our filter is to operate on a local region S xy The
response of the filter at any point (x, y) on which the region is
centered is to be based on four quantities:
Contd..
(a) g(x,y),the value of the noisy image at (x, y)
(b) the variance of the noise corrupting to form
(c) the local mean of the pixels in S xy
(d) The local variance of the pixels in S xy
❑The algorithm takes an assumption that >=
Contd..
➢The algorithm works as follows;
1.If is zero, the filter should return simply the value of
g(x,y).This is the trivial, zero-noise case in which g(x,y) is
equal to f(x,y) .
2. If the local variance is high relative to the filter
should return a value close to g(x, y).A high local variance
typically is associated with edges, and these should be
preserved.
3. If the two variances are equal, we want the filter to return
the arithmetic mean value of the pixels in S xy .This condition
occurs when the local area has the same properties as the
overall image, and local noise is to be reduced simply by
averaging.
Contd..
➢An adaptive expression for obtaining based on these
assumptions may be written as
➢In terms of overall noise reduction, the adaptive filter achieved
results similar to the arithmetic and geometric mean filters.
However, the image filtered with the adaptive filter is much
sharper.
➢Disadvantage :Filter complexity is high in adaptive filters than
normal filters
Adaptive median filter
➢The adaptive median filter changes (increases) the
size of S xy during filter operation, depending on
certain conditions listed below;
➢Consider the following notations;
Contd..
➢The adaptive median-filtering algorithm works in two
stages, denoted stage A and stage B, as follows:
Contd..
➢The key to understanding the mechanics of this
algorithm is to keep in mind that it has three main
purposes:
1. To remove salt-and-pepper (impulse) noise
2. To provide smoothing of other noise that may not be
impulsive
3. To reduce distortion, such as excessive thinning or
thickening of object boundaries
➢The values and Z min and Z max are considered statistically by the
algorithm to be “impulse-like”noise components, even if these are not the
lowest and highest possible pixel values in the image
Contd..(Algorithm explanation)
➢At stage A, Algorithm first checks , whether the median value is any of the
extreme values (Z min or Z max ). ie, whether Median value represents salt or
pepper. If it is not, then we will go to Stage B
➢If median value is one of the extreme value, then we increase the size of the
window and repeat the Stage A until the size of window reaches the maximum
specified value. When window size reaches the maximum value , it returns the
median value as new pixel value
➢In stage B , we check whether , the original value of the center pixel is any of
the extreme values. If not ( means it is not a salt and pepper noise) , we retain
its original value. By not changing these “intermediate-level” points, distortion
is reduced in the image. If the value is any of the extreme values, then we
replace it with median value.(like normal median filtering).
Comparison between
Normal Median filtering and Adaptive
Median filtering
1. Adaptive median filter works well if the spatial density (Pa or
Pb )of the impulse noise is large. But normal median filtering is
not.
2. Adaptive median filter retain certain pixel values as such ,
while performing filtering. But in median filtering all pixel
values are changed.
3. Adaptive filter can change the filter window size
Image segmentation
Edge Detection, gradient operators, Laplace operators and zero crossings.
Thresholding, Basic Global Thresholding, Optimum global thresholding
using Otsu method, Multiple thresholds, Variable thresholding,
Multivariable thresholding.
Region-Based Approach to Segmentation