Reference:
Digital Signal Processing
Rafael C. Gonzalez
Richard E. Woods
Overview
Spatial Domain Methods
Point Processing
Linear (Image Negatives and Identity)
Logarithmic (Log and Inverse Log)
Power Law (n
th
power and n
th
root)
Piece-wise Linear
Contrast Stretching
Gray-Level Slicing
Bit-Plane Slicing
Histogram Processing
Histogram Equalization
Histogram Matching or Histogram Specification
Enhancement using Arithmetic/ Logic Operations
Image Subtraction
Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 2
Mask Processing /Filtering
Linear Spatial Filtering
Non-Linear Spatial Filtering
Smoothing Spatial Filters
Smoothing Linear Filters
Box-Filter
Weighted Average Filter
Order-Statistics Filters (Non-Linear Spatial Filters)
Median Filter Median Filter
Max-filter
Min-filter
Sharpening Spatial Filters
Second-Order Derivatives
Laplacian
Unsharp Masking
High Boost Filtering and its Application
First-Order Derivatives (Gradient)
3/20/2012 CS04 804B Image Processing - Module2 3
Image Enhancement
To process an image so that the result is more suitable
than the original image for a specific application.
Two categories: Two categories:
Spatial domain methods
Direct manipulation of pixels
Frequency domain methods
Modifying the Fourier Transform of an image.
3/20/2012 4 CS04 804B Image Processing - Module2
Spatial Domain Methods
Point Processing
Linear (Image Negatives and Identity)
Logarithmic (Log and Inverse Log)
Power Law (n
th
power and n
th
root)
Piece-wise Linear
Contrast Stretching
Gray-Level Slicing
Bit-Plane Slicing
Histogram Processing
Histogram Equalization
Histogram Matching or Histogram Specification
Enhancement using Arithmetic/ Logic Operations
Image Subtraction
Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 5
Spatial Domain Methods
Operates directly on pixels.
Denoted by the expression
g(x,y) = T[f(x,y)] g(x,y) = T[f(x,y)]
where f(x,y) is the input image, g(x,y) is the processed
image, T is an operator on f defined over some
neighbourhood of (x,y).
T can also operate on a set of input images.
3/20/2012 6 CS04 804B Image Processing - Module2
Neighbourhood square or rectangular sub-image
area centred at (x,y).
T is applied at each (x,y) to obtain output g at that
location.
3/20/2012 7 CS04 804B Image Processing - Module2
Simplest form of T
when neighbourhood is of size 1x1 (a single pixel).
g depends only on the value of f at (x,y)
s = T(r)
Enhancement at any point in an image depends only on the
gray level at that point (Point Processing or Gray-Level
Transformation).
Larger neighbourhoods Mask Processing or Spatial
Filtering.
3/20/2012 8 CS04 804B Image Processing - Module2
Spatial Domain Methods
Point Processing
Linear (Image Negatives and Identity)
Logarithmic (Log and Inverse Log)
Power Law (n
th
power and n
th
root)
Piece-wise Linear
Contrast Stretching
Gray-Level Slicing
Bit-Plane Slicing
Histogram Processing
Histogram Equalization
Histogram Matching or Histogram Specification
Enhancement using Arithmetic/ Logic Operations
Image Subtraction
Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 9
Gray Level Transformations
Three basic types:
Linear (Image Negatives and Identity) Linear (Image Negatives and Identity)
Logarithmic (Log and Inverse Log)
Power Law (n
th
power and n
th
root)
3/20/2012 10 CS04 804B Image Processing - Module2
3/20/2012 CS04 804B Image Processing - Module2 11
Image Negatives
The negative of an image with gray levels in the range
[0,L-1] is obtained by using the transformation given by
s = L-1-r
Reverses the intensity levels of an image.
For enhancing gray or white detail embedded in dark
regions of an image.
3/20/2012 CS04 804B Image Processing - Module2 12
Log Transformation
General form: s = c log(1+r)
where c is a constant and r 0.
Maps a narrow range of low-level gray values in the input
image into a wider range of output levels. image into a wider range of output levels.
Maps a wide range of high-level gray values in the input image
into a lower range of output levels.
For expanding the values of dark pixels while compressing
higher-level values.
Compresses the dynamic range of images with large variations
in pixel values.
3/20/2012 CS04 804B Image Processing - Module2 13
3/20/2012 CS04 804B Image Processing - Module2 14
Power-Law Transformation
Basic form:s = cr
=
3/20/2012 CS04 804B Image Processing - Module2 39
0
( ) ( ) (1)
( ) ( ) (2)
s r
r
r
ds
Atransformation functionhas the form
s T r p w dw
RHS is
= =
.) ed at that limit
(3) (1)
( ) ( )
1
( )
( )
s r
r
Substituting in gives
dr
p s p r
ds
p r
p r
=
=
3/20/2012 CS04 804B Image Processing - Module2 41
( )
1; 0 1
( ) :
.
( ).
r
s
r
p r
s
p s is therefore
always auniform probability density function
independent of p r
=
1 1
(1) (2),
( ) ( )
( ) [ ( )] (3)
From and
G z T r
and z must satisfy thecondition
z G s G T r
=
= =
T(r) can be obtained from (1) once p
r
(r) has been
estimated.
G(z) can be obtained from (2) because p
z
(z) is given.
3/20/2012 CS04 804B Image Processing - Module2 49
( ) [ ( )] (3) z G s G T r = =
Assume G
-1
exists and satisfies (a) and (b). Image with
specified histogram can then be obtained as follows:
Obtain the transformation function T(r) using (1).
Use (2) to obtain the transformation function G(z).
Obtain the inverse transformation function G
-1
.
Obtain the output image by applying (3) to all the pixels in
the input image.
The resultant image will have gray levels z with specified
probabilitiy density function p
z
(z).
3/20/2012 CS04 804B Image Processing - Module2 50
Discrete formulation:
0
0
( ) ( )
, 0,1,..., 1
k
k k r j
j
k
j
j
k
s T r p r
n
k L
n
=
=
= =
= =
= = =
= =
= =
= +
2
2
( 1) ( 1) 2 ( )
f
f x f x f x
x
= + +
= + +
3/20/2012 CS04 804B Image Processing - Module2 84
2
2
2
2
( 1, ) ( 1, ) 2 ( , )
( , 1) ( , 1) 2 ( , )
( 1, ) ( 1, )
( , 1) ( , 1) 4 ( , )
f x y f x y f x y
x
f
f x y f x y f x y
y
f f x y f x y
f x y f x y f x y
= + +
= + +
= + + +
+ +
Highlights gray-level discontinuities
2
( , ) ( , )
( , )
if thecentrecoefficient of the
f x y f x y
Laplacianmask is negative
g x y
if thecentrecoefficient of the
Unsharp Masking
Subtracts blurred version of the image from the original
image.
( , ) ( , ) ( , )
s
f x y f x y f x y =
Used in dark-room photography.
3/20/2012 CS04 804B Image Processing - Module2 86
High Boost Filtering
( , )
( , ) ( , ) ( , )
( 1) ( , ) ( , ) ( , )
( 1) ( , ) ( , )
s
hb
f x y
s
f x y Af x y f x y
A f x y f x y f x y
A f x y f x y
=
= +
= +
1442443
3/20/2012 CS04 804B Image Processing - Module2 87
( 1) ( , ) ( , )
s
A f x y f x y = +
2
2
( , ) ( , )
( , ) ( , )
hb
if thecentrecoefficient of the
Af x y f x y
Laplacianmask is negative
f
if thecentrecoefficient of the
Af x y f x y
Laplacianmask is positive
(
(
( =
(
(
First order derivatives of a digital image are based on
various approximations of the 2D gradient.
1
2
2
2
y
f f
Magnitudeof f
x y
(
(
| |
| |
= + (
| |
\
( \
3/20/2012 89 CS04 804B Image Processing - Module2
The mathematical implementation of first order
derivatives can be done by masks known as
Roberts cross-gradient operator
Prewitt operator
Sobel operator
Let the 3 3 area represent the gray levels in a neighborhood of an image, Let the 3 3 area represent the gray levels in a neighborhood of an image,
as shown below
3/20/2012 90 CS04 804B Image Processing - Module2
Roberts cross-gradient operator
Equations
( )
( )
9 5
8 6
x
y
G z z
G z z
=
=
Masks
3/20/2012 91 CS04 804B Image Processing - Module2
Prewitt operator
Equations
( ) ( )
( ) ( )
7 8 9 1 2 3
3 6 9 1 4 7
x
y
G z z z z z z
G z z z z z z
= + + + +
= + + + +
Masks
3/20/2012 92 CS04 804B Image Processing - Module2
Sobel operator
Equations
( ) ( )
( ) ( )
7 8 9 1 2 3
3 6 9 1 4 7
2 2
2 2
x
y
G z z z z z z
G z z z z z z
= + + + +
= + + + +
Masks
3/20/2012 93 CS04 804B Image Processing - Module2
Thank You Thank You
3/20/2012 CS04 804B Image Processing - Module2 94