Image Enhancement in the Spatial Domain (Part...

Post on 31-May-2020

4 views 0 download

Transcript of Image Enhancement in the Spatial Domain (Part...

Image Enhancement in the Spatial Domain (Part 5)

Lecturer: Dr. Hossam Hassan Email : hossameldin.hassan@eng.asu.edu.eg

Computers and Systems Engineering

2

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

Example

Input Image Laplacian Result

4

Mask of Laplacian + addition

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

5

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

6

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

7

Un-sharp Masking

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

),(),(),( yxfyxfyxfs

sharpened image = original image – blurred image

A process used for many years in the publishing industry to sharpen images consists of subtracting a blurred version of an image from the image itself. This process, called unsharp masking, is expressed as:-

8

High-boost filtering

• generalized form of Unsharp masking

• A 1

),(),(),( yxfyxAfyxfhb

),(),()1(

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

yxfyxfA

yxfyxfyxfAyxf

s

hb

9

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

yxfyxfyxfs

10

High-boost filtering

• yields

),(),(

),(),(),(

2

2

yxfyxAf

yxfyxAfyxfhb

if the center coefficient of the Laplacian mask is negative

if the center coefficient of the Laplacian mask is positive

11

High-boost Masks

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

sharpening

12

Example (1)

Example (2) Input Image Laplacian

A=1 A=1.2

https://docs.kde.org/development/en/extragear-graphics/showfoto/using-kapp.html

Example (3) Input Image Laplacian

A=1 A=1.1

15

Gradient Operator

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

y

fx

f

G

Gf

y

x

21

22

21

22 ][)f(||||

y

f

x

f

GGmagf yx

the magnitude becomes nonlinear yx GGf ||||

commonly approx.

16

Gradient Mask

• simplest approximation, 2x2

z1 z2 z3

z4 z5 z6

z7 z8 z9

)( and )( 5658 zzGzzG yx

21

2

56

2

582

122 ])()[(][|||| zzzzGGf yx

5658|||| zzzzf

17

Gradient Mask

• Roberts cross-gradient operators, 2x2

z1 z2 z3

z4 z5 z6

z7 z8 z9

)( and )( 6859 zzGzzG yx

21

2

68

2

592

122 ])()[(][|||| zzzzGGf yx

6859|||| zzzzf

18

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 importance to the center point

19

Note

• the summation of coefficients in all masks equals 0, indicating that they would give a response of 0 in an area of constant gray level.

20

Example

21

Edge Detection

• Why detect edge?

Edges characterize object boundaries and are

useful features for segmentation, registration

and object identification in scenes.

• What is edge (to human vision system)?

Intuitively, edge corresponds to singularities in the image

(i.e. where pixel value experiences abrupt change)

No rigorous definition exists

22

Gradient Operators

• Motivation: detect changes

change in the pixel value large gradient

Gradient

operator image Thresholding

edge

map x(m,n) g(m,n) I(m,n)

otherwise

thnmgnmI

0

|),(|1),(

23

Common Operators

Examples: 1. Roberts operator

01

10

g1 g2

10

01

),(),(),( 2

2

2

1 nmgnmgnmg

• Gradient operator

24

Common Operators (cont’d)

2. Prewitt operator 3. Sobel operator

101

101

101

111

000

111

101

202

101

121

000

121

vertical

horizontal

Input Image Vertical Component

Horizontal Component Prewit Gradient

Pre

witt

Gra

die

nt

Appro

xim

ation

Eff

ect

of

Thre

sho

ldin

g P

aram

eter

s

Input Image Sobel Gradient Magnitude

Threshold = 20% of Max Threshold = 50% of Max

27

Compass Operators

101

101

101

111

000

111

111

000

111

101

101

101

110

101

011

110

101

011

011

101

110

011

101

110

|}),({|max),( nmgnmg kk

Co

mp

ass

Op

erat

or

Ex

amp

le

Input Image Compass Gradient Operator Results

Threshold = 20% of Max Threshold = 50% of Max

Color Image: Image from Google HD

Compass Gradient Operator Results

Color Image: Image from Google HD

Compass Gradient Operator Results