Image Processing Chapter 5
Image Processing Chapter 5
Recognition (IPPR):
(Lecture 5)
a function
Let’s consider a simple 1 dimensional
example
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
6
of
32
A
B
Spatial Differentiation
7
of
32
1st Derivative
The formula for the 1st derivative of a
function is as follows:
f
f ( x 1) f ( x)
x
It’s just the difference between subsequent
values and measures the rate of change of
the function
8
of
32
1st Derivative (cont…)
5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
0 -1 -1 -1 -1 0 0 6 -6 0 0 0 1 2 -2 -1 0 0 0 7 0 0 0
9
of
32
2nd Derivative
The formula for the 2nd derivative of a
function is as follows:
f
2
f ( x 1) f ( x 1) 2 f ( x)
x
2
5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
-1 0 0 0 0 1 0 6 -12 6 0 0 1 1 -4 1 1 0 0 7 -7 0 0
11
of
Using Second Derivatives For Image
32 Enhancement
The 2nd derivative is more useful for image
enhancement than the 1st derivative
– Stronger response to fine detail
– Simpler implementation
– We will come back to the 1st order derivative
later on
The first sharpening filter we will look at is
the Laplacian
– Isotropic
– One of the simplest sharpening filters
– We will look at a digital implementation
12
of
32
The Laplacian
The Laplacian is defined as follows:
f f2 2
f 2 2
2
x y
where the partial 1st order derivative in the x
direction is defined as follows:
f2
f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
x
2
f ( x, y 1) f ( x, y 1)]
4 f ( x, y )
We can easily build a filter based on this
0 1 0
1 -4 1
0 1 0
14
of
32
The Laplacian (cont…)
Applying the Laplacian to an image we get a
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
enhanced image
g ( x, y ) f ( x, y ) f
2
16
of
32
Laplacian Image Enhancement
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
- =
Original Laplacian Sharpened
Image Filtered Image Image
of
32
17
Laplacian Image Enhancement
18
of
32
Simplified Image Enhancement
The entire enhancement can be combined
into a single filtering operation
g ( x, y ) f ( x, y ) f
2
f ( x, y ) [ f ( x 1, y ) f ( x 1, y )
f ( x, y 1) f ( x, y 1)
4 f ( x, y )]
5 f ( x, y ) f ( x 1, y ) f ( x 1, y )
f ( x, y 1) f ( x, y 1)
19
of
32
Simplified Image Enhancement (cont…)
0 -1 0
-1 5 -1
0 -1 0
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
32
20
Simplified Image Enhancement (cont…)
21
of
32
Variants On The Simple Laplacian
There are lots of slightly different versions of
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
-1 -1 -1
-1 9 -1
-1 -1 -1
22
of
32
1st Derivative Filtering
Implementing 1st derivative filters is difficult in
practice
For a function f(x, y) the gradient of f at
coordinates (x, y) is given as the column
vector:
f
Gx x
f f
G y
y
23
of
32
1st Derivative Filtering (cont…)
The magnitude of this vector is given by:
f mag (f )
G G2
x
2
y
1
2
1
f f
2 2 2
x y
z1 z2 z3
z4 z5 z6
z7 z8 z9
25
of
32
Sobel Operators
Based on the previous equations we can
derive the Sobel Operators
-1 -2 -1 -1 0 1
0 0 0 -2 0 2
1 2 1 -1 0 1
An image of a
contact lens which
is enhanced in
order to make
defects (at four
and five o’clock in
the image) more
obvious
(a)
Laplacian filter of
bone scan (a)
(b)
Sharpened version of
bone scan achieved (c)
by subtracting (a)
and (b) Sobel filter of bone
scan (a) (d)
31
of
Combining Spatial Enhancement
32 Methods (cont…)
Result of applying a (h)
power-law trans. to
Images taken from Gonzalez & Woods, Digital Image Processing (2002)