You are on page 1of 22

Digital Image Processing

Lecture 6: Ch3:Image Enhancement in the Spatial Domain:


3:7 Sharpening Spatial Filters

Dr. Hossam Mahmoud Moftah


Assistant professor Faculty of computers and information
Beni Suef University

Sharpening Spatial Filters

Foundation

Laplacian Operator (Lab Assignment using Matlab)

Unsharp Masking and Highboost Filtering

Using First-Order Derivatives for Nonlinear Image


Sharpening
Robert Cross Gradient Operator
Sobel Operator (Lab Assignment using Matlab)
Prewitt operator (Lab Assignment using Matlab)

Sharpening Spatial Filters: Foundation

The

first-order derivative of a one-dimensional


function f(x) is the difference

f
f ( x 1) f ( x)
x
The

second-order derivative of f(x) as the difference


2 f
f ( x 1) f ( x 1) 2 f ( x)
2
x

Sharpening Spatial Filters: Laplace Operator

The second-order isotropic derivative operator is the Laplacian for


a function (image) f(x,y)
2
2

f
2
f 2 2
x
y

2 f
f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
2
x
2 f
f ( x, y 1) f ( x, y 1) 2 f ( x, y )
2
y

2 f f ( x 1, y ) f ( x 1, y ) f ( x, y 1) f ( x, y 1)
- 4 f ( x, y )

Sharpening Spatial Filters: Laplace Operator

Sharpening Spatial Filters: Laplace Operator

Image sharpening in the way of using the Laplacian:


g ( x, y ) f ( x, y ) c 2 f ( x, y )
where,
f ( x, y ) is input image,
g ( x, y ) is sharpenend images,
c -1 if 2 f ( x, y ) corresponding to Fig. 3.37(a) or (b)
and c 1 if either of the other two filters is used.

Unsharp Masking and Highboost Filtering

Unsharp

masking
Sharpen images consists of subtracting an unsharp
(smoothed) version of an image from the original
image
e.g., printing and publishing industry
Steps
1. Blur the original image
2. Subtract the blurred image from the original
3. Add the mask to the original

Unsharp Masking:

Unsharp Masking and Highboost Filtering

Let f ( x, y ) denote the blurred image, unsharp masking is


g mask ( x, y ) f ( x, y ) f ( x, y)
Then add a weighted portion of the mask back to the original
g ( x, y ) f ( x, y ) k * g mask ( x, y )
k 0
when k 1, the process is referred to as highboost filtering.

Unsharp Masking and Highboost Filtering: Example

Edge Detection using Gradient


For function f ( x, y ), the gradient of f at coordinates ( x, y )
is defined as
g x
f grad( f )
g y

f
x

f
y

The magnitude of vector f , denoted as M ( x, y )


Gradient Image

M ( x, y ) mag(f ) g x 2 g y 2

Using this information, we can also calculate the


gradient's direction:

Edge Detection using Gradient

Using this information, we can also calculate the


gradient's direction:

How to Compute Gradient?


1- Sobel Operator

Sobel Operators
M ( x, y ) | ( z7 2 z8 z9 ) ( z1 2 z2 z3 ) |
| ( z3 2 z6 z9 ) ( z1 2 z4 z7 ) |

z1 z2 z3
z4 z5 z6
z7 z8 z9

How to Compute Gradient?


2- Prewitt operator

Gx=

Gy=

How to Compute Gradient?


3- Robert Cross Gradient Operator

The magnitude of vector f , denoted as M ( x, y )


M ( x, y ) mag(f ) g x 2 g y 2

M ( x, y ) | g x | | g y |
Roberts Cross-gradient Operators
M ( x, y ) | z9 z5 | | z8 z6 |
z1 z2 z3
z4 z5 z6
z7 z8 z9

Example

Applying the Sobel operator- Example

20

Applying the Prewitt operator- Example

The end

You might also like