lecture 6 sharpening filters 1.the concept of sharpening filter 2.first and second order derivatives...

33
Lecture 6 Sharpening Filters 1. The concept of sharpening filter 2. First and second order derivatives 3. Laplace filter 4. Unsharp mask 5. High boost filter 6. Gradient mask 7. Sharpening image with MatLab

Upload: shea-sidwell

Post on 14-Dec-2015

253 views

Category:

Documents


3 download

TRANSCRIPT

Lecture 6 Sharpening Filters

1. The concept of sharpening filter

2. First and second order derivatives

3. Laplace filter

4. Unsharp mask

5. High boost filter

6. Gradient mask

7. Sharpening image with MatLab

2

Sharpening Spatial Filters

• To highlight fine detail in an image or to enhance detail that has been blurred, either in error or as a natural effect of a particular method of image acquisition.

• Blurring vs. Sharpening

• Blurring/smooth is done in spatial domain by pixel averaging in a neighbors, it is a process of integration

• Sharpening is an inverse process, to find the difference by the neighborhood, done by spatial differentiation.spatial differentiation.

3

Derivative operator

• The strength of the response of a derivative operator is proportional to the degree of discontinuity of the image at the point at which the operator is applied.

• Image differentiation – enhances edges and other discontinuities (noise)– deemphasizes area with slowly varying gray-level

values.

4

Sharpening edge by First and second order derivatives

• Intensity function f =

• First derivative f ’ =

• Second-order derivative

f ’’ =

• f- f ’’ =

f

f’

f’’f-f’’

5

First and second order difference of 1D

• The basic definition of the first-order derivative of a one-dimensional function f(x) is the difference

• The second-order derivative of a one-dimensional function f(x) is the difference

)()1( xfxfx

f

)(2)1()1(2

2

xfxfxfx

f

7

First and Second-order derivative of 2D

• when we consider an image function of two variables, f(x, y), at which time we will dealing with partial derivatives along the two spatial axes.

y

yxf

x

yxf

yx

yxf

),(),(),(

f

2

2

2

22 ),(),(

y

yxf

x

yxff

(linear operator)

Laplacian operator(non-linear)

Gradient operator

8

Discrete form of Laplacian

),(2),1(),1(2

2

yxfyxfyxfx

f

),(2)1,()1,(2

2

yxfyxfyxfy

f

from

)],(4)1,()1,(

),1(),1([2

yxfyxfyxf

yxfyxff

9

Result Laplacian mask

10

Laplacian mask implemented an extension of diagonal neighbors

11

Other implementation of Laplacian masks

give the same result, but we have to keep in mind that when combining (add / subtract) a Laplacian-filtered image with another image.

12

Effect of Laplacian Operator• as it is a derivative operator,

– it highlights gray-level discontinuities in an image– it deemphasizes regions with slowly varying gray levels

• tends to produce images that have – grayish edge lines and other discontinuities, all superimposed on

a dark, – featureless background.

13

Correct the effect of featureless background

• easily by adding the original and Laplacian image.• be careful with the Laplacian filter used

),(),(

),(),(),(

2

2

yxfyxf

yxfyxfyxg

if the center coefficient of the Laplacian mask is negative

if the center coefficient of the Laplacian mask is positive

14

Example

• a). image of the North pole of the moon

• b). Laplacian-filtered image with

• c). Laplacian image scaled for display purposes

• d). image enhanced by addition with original image

1 1 1

1 -8 1

1 1 1

15

Mask of Laplacian + addition

• to simply the computation, we can create a mask which do both operations, Laplacian Filter and Addition the original image.

16

Mask of Laplacian + addition

)]1,()1,(

),1(),1([),(5

)],(4)1,()1,(

),1(),1([),(),(

yxfyxf

yxfyxfyxf

yxfyxfyxf

yxfyxfyxfyxg

0 -1 0

-1 5 -1

0 -1 0

17

Example

18

Note

0-1

0

-1

5-1

0-1

0

0 0 0

0 1 0

0 0 0

),(),(

),(),(),(

2

2

yxfyxf

yxfyxfyxg

= +0

-1

0

-1

4-1

0-1

0

0-1

0

-1

9-1

0-1

0

0 0 0

0 1 0

0 0 0= +

0-1

0

-1

8-1

0-1

0

19

Unsharp masking

• to subtract a blurred version of an image produces sharpening output image.

),(),(),( yxfyxfyxf s

sharpened image = original image – blurred imagesharpened image = original image – blurred image

Unsharp mask

22

High-boost filtering

• generalized form of Unsharp masking• A 1

),(),(),( yxfyxAfyxfhb

),(),()1(

),(),(),()1(),(

yxfyxfA

yxfyxfyxfAyxf

s

hb

23

High-boost filtering

• if we use Laplacian filter to create sharpen image fs(x,y) with addition of original image

),(),()1(),( yxfyxfAyxf shb

),(),(

),(),(),(

2

2

yxfyxf

yxfyxfyxf s

),(),(

),(),(),(

2

2

yxfyxAf

yxfyxAfyxfhb

24

High-boost Masks

A 1 if A = 1, it becomes “standard” Laplacian sharpening

25

Example

26

Gradient Operator

• first derivatives are implemented using the magnitude of the gradientmagnitude of the gradient.

y

fx

f

G

G

y

xf

21

22

2122 ][)f(

y

f

x

f

GGmagf yx

the magnitude becomes nonlinearyx GGf

commonly approx.

27

Gradient Mask

• simplest approximation, 2x2z1 z2 z3

z4 z5 z6

z7 z8 z9

)( and )( 5658 zzGzzG yx

212

562

582

122 ])()[(][ zzzzGGf yx

5658 zzzzf

28

Gradient Mask

• Roberts cross-gradient operators, 2x2

z1 z2 z3

z4 z5 z6

z7 z8 z9

)( and )( 6859 zzGzzG yx

212

682

592

122 ])()[(][ zzzzGGf yx

6859 zzzzf

29

Gradient Mask

• Sobel operators, 3x3

z1 z2 z3

z4 z5 z6

z7 z8 z9

)2()2(

)2()2(

741963

321987

zzzzzzG

zzzzzzG

y

x

yx GGf

the weight value 2 is to achieve smoothing by giving more important to the center point

30

Example

31

Example of Combining Spatial Enhancement Methods

• want to sharpen the original image and bring out more skeletal detail.

• problems: narrow dynamic range of gray level and high noise content makes the image difficult to enhance

32

Example of Combining Spatial Enhancement Methods

• solve :

1. Laplacian to highlight fine detail2. gradient to enhance prominent edges3. gray-level transformation to increase the dynamic

range of gray levels