Spatial Domain Image

Processing
Dr. P. Arulmozhivarman
Associate Processor
School of Electrical Sciences
VIT University
Principal application areas
 Improvement of pictorial information for
human interpretation
 Processing of image data for storage,
transmission, and representation for
autonomous machine perception
Gray-level Histogram
Spatial
DFT DCT
Spectral
Digital Image Characteristics
Point Processing Masking Filtering
Enhancement
Degradation Models Inverse Filtering Wiener Filtering
Restoration
Pre-Processing
Information Theory
LZW (gif)
Lossless
Transform-based (jpeg)
Lossy
Compression
Edge Detection
Segmentation
Shape Descriptors Texture Morphology
Description
Digital Image Processing
Features of an image
 Low Frequency Component
Smooth/uniform regions
Approximation component
 High frequency Component
Edges
Detailed component
Image processing
 Low level processing :
primitive operation- enhance quality of
image as suitable for application.
 Mid- level processing :
description of objects for computer
processing and classification.
 High level processing :
making sense of recognized objects
Image processing fundamentals
Example of negative image
Image Enhancement
MRI IMAGING
Image Encryption
Normalized histogram
Histogram Equalization
Image Preprocessing
Enhancement Restoration
Spatial
Domain
Spectral
Domain
Point Processing
•imadjust
•histeq
Spatial filtering
•filter2
Filtering
• fft2/ifft2
• fftshift
• Inverse filtering
• Wiener filtering
 Image restoration attempts to restore images
that have been degraded
 Identify the degradation process and attempt to
reverse it
 Similar to image enhancement, but more objective
Filtering to Remove Noise
We can use spatial filters of different kinds
to remove different kinds of noise
The arithmetic mean filter is a very simple
one and is calculated as follows:
 This is implemented as the
simple smoothing filter
 Blurs the image to remove
noise
¯
e
=
xy
S t s
t s g
mn
y x f
) , (
) , (
1
) , (
ˆ

1
/
9

1
/
9

1
/
9

1
/
9

1
/
9

1
/
9

1
/
9

1
/
9

1
/
9
Other Means
 There are different kinds of mean filters all of
which exhibit slightly different behaviour:
 Arithmetic Mean
 Geometric Mean
 Harmonic Mean
 Contraharmonic Mean
Other Means (cont…)
 There are other variants on the mean which
can give different performance
 Geometric Mean:
 Achieves similar smoothing to the arithmetic
mean, but tends to lose less image detail
mn
S t s
xy
t s g y x f
1
) , (
) , ( ) , (
ˆ

=
I
e
Other Means (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
¯
e
=
xy
S t s
t s g
mn
y x f
) , (
) , (
1
) , (
ˆ
Other Means (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
¯
¯
e
e
+
=
xy
xy
S t s
Q
S t s
Q
t s g
t s g
y x f
) , (
) , (
1
) , (
) , (
) , (
ˆ
Order Statistics Filters
 Spatial filters that are based on ordering the
pixel values that make up the nieghbourhood
operated on by the filter
 Useful spatial filters include
 Median filter
 Max and min filter
 Midpoint filter
 Alpha trimmed mean filter
Median Filter
 Median Filter:
 Excellent at noise removal, without the
smoothing effects that can occur with other
smoothing filters
 Particularly good when salt and pepper noise
is present
)} , ( { ) , (
ˆ
) , (
t s g mean y x f
xy
S t s e
=
Max and Min Filter
 Max Filter:
 Min Filter:
 Max filter is good for pepper noise and min is
good for salt noise
)} , ( { max ) , (
ˆ
) , (
t s g y x f
xy
S t s e
=
)} , ( { min ) , (
ˆ
) , (
t s g y x f
xy
S t s e
=
Midpoint Filter
 Midpoint Filter:
 Good for random Gaussian and uniform
noise

+ =
e e
)} , ( { min )} , ( { max
2
1
) , (
ˆ
) , ( ) , (
t s g t s g y x f
xy xy
S t s S t s
Alpha-Trimmed Mean Filter
 Alpha-Trimmed Mean Filter:
 We can delete the d/2 lowest and d/2 highest
grey levels
 So g
r
(s, t) represents the remaining mn – d
 pixels
¯
e
÷
=
xy
S t s
r
t s g
d mn
y x f
) , (
) , (
1
) , (
ˆ
Detection of Discontinuities
 3 basic types of gray-level discontinuities:
Points
Lines
Edges
 Common method of detection: run a mask
through the image.
Filter Mask
Point Detection
 T: nonnegative threshold:
¯
=
= + + + =
9
1
9 9 2 2 1 1
...
i
i i
z w z w z w z w R

| R|>T
Point Detection
 A point has been detected at the location on
which the mask is centered if: |R|>T
 The gray level of an isolated point will be
quite different from the gray levels of its
neighbors
 measure the weighted differences between the
center point and its neighbors
Line Detection
 If at a certain point |R
i
|>|R
j
|, this point is
more likely associated with a line in the
direction of mask i.
R
1
R
2
R
3
R
4
Edge Detection
 Edge (a set of connected pixels):
 the boundary between two regions with relatively
distinct gray-level properties.
 Note: edge vs. boundary
 Assumption:
 the regions are sufficiently homogeneous, so that
the transition between two regions can be
determined on the basis of gray-level
discontinuities alone.
Image Segmentation
Edge Detection
 Basic Idea:
 A profile is defined perpendicularly to the edge
direction and the results are interpreted.
 The magnitude of the first derivative is used to
detect an edge (if a point is on a ramp)
 The sign of the second derivative can determine
whether an edge pixel is on the dark or light side of
an edge.
 Remarks on second derivative:
 It produces two responses for every edge
 The line that can be formed joining its positive and
negative values crosses zero at the mid point of
the edge (zero-crossing)
Edge Detection
 Computation of a local derivative operator
 A profile is defined perpendicularly to the edge
direction and the results are interpreted.
 The first derivative is obtained by using the
magnitude of the gradient at that point.
 The second derivative is obtained by using the
Laplacian.
Gradient Operators

c
c
c
c
=

= V
y
f
x
f
G
G
F
y
x
The gradient vector points in the direction of
maximum rate of change of f at (x,y).
Gradient Operators
Gradient:
2 / 1 2 2
] [ ) (
y x
G G F mag f + = V = V
(maximum rate of increase of f(x,y) per unit distance)
| | | |
y x
G G f + ~ V
Direction angle of ∇f at (x,y):
|
|
.
|

\
|
=
÷
x
y
G
G
y x a
1
tan ) , (
Image Segmentation
Image Segmentation
Image Segmentation
Image Segmentation
Image Segmentation
Gradient Operators
 Computation of the gradient of an image:
 Soebel operators provide both a differencing &
a smoothing effect:
) 2 ( ) 2 (
3 2 1 9 8 7
z z z z z z G
x
+ + ÷ + + =
) 2 ( ) 2 (
7 4 1 9 6 3
z z z z z z G
y
+ + ÷ + + =
Summary: Gradient Operators
Smooth edges due to
blurring (result of sampling)
Positive: leading
Negative: trailing
Zero: in constant gray levels
Positive: from dark side
Negative: from light side
Zero: in constant gray levels
 The magnitude of the first derivative detects
the presence of an edge and the sign of the
second detects whether the edge pixel lies on
the dark or light side of an edge.
 The second derivative has a zero-crossing at
the mid-point of a transition.
Laplacian
 (of a 2-D function f(x,y)):
2
2
2
2
2
y
f
x
f
f
c
c
+
c
c
= V
• A 3 x 3 discrete mask based on the above is:
) ( 4
8 6 4 2 5
2
z z z z z f + + + ÷ = V
Laplacian
 The idea:
 Coefficient of center pixel should be positive
 Coefficients of outer pixels should be negative
 Sum of coefficients should be zero
(the Laplacian is a derivative)
Image Segmentation
Laplacian
 The Laplacian is seldom used in practice,
because:
 It is unacceptably sensitive to noise (as second-
order derivative)
 It produces double edges
 It is unable to detect edge direction
Laplacian
 An important use of the Laplacian:
 To find the location of edges using its zero-
crossings property.
 Plus, the Laplacian plays only the role of
detector of whether a pixel is on the dark
or light side of an edge.
Laplacian
 Convolve an image with the Laplacian of a
2D Gaussian function of the form:

h(x, y) = ÷exp ÷
x
2
+ y
2
2o
2
|
\

|
.
|
where o is the standard deviation.
Laplacian
 The Laplacian of the above Gaussian is:

V
2
h = ÷
r
2
÷o
2
o
4
|
\

|
.
|
exp ÷
r
2
2o
2
|
\

|
.
|
where r
2
= x
2
+ y
2
.
o determines the degree of blurring that occurs.
Image Segmentation
Image Segmentation
Thank you!

Sign up to vote on this title
UsefulNot useful