Digital Image Processing Week III

20
Digital Image Processing Week III Thurdsak LEAUHATONG

description

Digital Image Processing Week III. Thurdsak LEAUHATONG. Histogram Matching. Problem of Histogram Equalization. Histogram equalization may not always produce desirable results, particularly if the given histogram is very narrow. It can produce false edges and regions. - PowerPoint PPT Presentation

Transcript of Digital Image Processing Week III

Page 1: Digital Image Processing Week III

Digital Image Processing Week III

Thurdsak LEAUHATONG

Page 2: Digital Image Processing Week III

• Problem of Histogram Equalization•Histogram Matching

• Histogram equalization may not always produce desirable results, particularly if the given histogram is very narrow.• It can produce false edges and regions.• It can also increase image “graininess” and “patchiness.”

Page 3: Digital Image Processing Week III

•Histogram MatchingTransfer to a pre-specified histogram

• In this case, transformation that yields an output image with a pre-specified histogram may produce the preferable result.

• This technique is called histogram matching.

Page 4: Digital Image Processing Week III

•Histogram MatchingAlgorithm

• Let be the pre-specified PDF of the output image.

tp t

r T( ) s G-1( ) t

0

255r

rs T r p r dr • Perform the histogram equalization of the input image.

• Compute the CDF of . tp t 0

255t

tG t p t dt • HM is the inverse of G(s).

T

G

r

s T r

1G s

Page 5: Digital Image Processing Week III

• Example•Histogram Matching

Intensity( s )

# pixels

0 20

1 5

2 25

3 10

4 15

5 5

6 10

7 10

Total 100

Intensity ( t )

# pixels

0 5

1 10

2 15

3 20

4 20

5 15

6 10

7 5

Total 100

Pre-specifiedHistogram

Histogram ofInput Image

Page 6: Digital Image Processing Week III

• Example (cont.)•Histogram Matching

r (nj) SPr s

0 20 0.2 1

1 5 0.25 2

2 25 0.5 3

3 10 0.6 4

4 15 0.75 5

5 5 0.8 6

6 10 0.9 6

7 10 1.0 7

1. Histogram Equalization of both

t (nj) SPt v

0 5 0.05 0

1 10 0.15 1

2 15 0.3 2

3 20 0.5 4

4 20 0.7 5

5 15 0.85 6

6 10 0.95 7

7 5 1.0 7

s T r v G t

Page 7: Digital Image Processing Week III

• Example (cont.)•Histogram Matching

r s

0 1

1 2

2 3

3 4

4 5

5 6

6 6

7 7

v t

0 0

1 1

2 2

4 3

5 4

6 5

7 6

7 7

r t

0 1

1 2

2 2

3 3

4 4

5 5

6 5

7 6

t # Pixels

0 0

1 20

2 30

3 10

4 15

5 15

6 10

7 0

Actual Output Histogram

s T r 1t G v

r s

s v

v t

Page 8: Digital Image Processing Week III

• Example (cont.)•Histogram Matching

Desired histogram

Transfer function

Actual histogram

Page 9: Digital Image Processing Week III

• Example (cont.)•Histogram Matching

Originalimage

After histogram matching

After histogram equalization

Page 10: Digital Image Processing Week III

• Global Histogram Processing

• The intensity of a pixel depends on the PDF of intensities of an entire image.

• Global vs Local Histogram Processing•Local Histogram Processing

• Local Histogram Processing• The intensity at a position

(x,y) depends on the PDF of intensities in a small window whose center locates at (x,y).

Page 11: Digital Image Processing Week III

GLOBAL MEAN AND NTH MOMENT• Global Mean

LOCAL MEAN AND NTH MOMENT

•Local Histogram ProcessingGlobal and Local Statistics

1 1

0 0

1 ,M N

Gx y

m r x yMN

1 1

,0 0

1 ,M N n

n G Gx y

r x y mMN

1 1

20 0

1 ,2 1

M N w w

xyx y i w j w

m r x i y iw

1 1

, 20 0

1 ,2 1 1

M N w w n

n xy xyx y i w j w

r x i y i mw

• Global nth Moment

• Local Mean

• Local nth Moment

Page 12: Digital Image Processing Week III

•Local Histogram ProcessingGlobal and Local StatisticsGLOBAL MEAN AND NTH

MOMENT• Global Mean• measures the intensity’s

average of the entire image.

• Global 2nd Moment or called Variance

• measures how the intensity of the entire spread about the mean.

• It is useful to measure the global contrast of the image.

• Local Mean• measures the average of the local

intensity.

• Local 2nd Moment or called Variance

• measures how the local intensity spread about the local mean.

• It is useful to measure the local contrast, edge, and texture of the image.

LOCAL MEAN AND NTH MOMENT

1 1 22

0 0

1 ,M N

G Gx y

r x y mMN

1 1 22

20 0

1 ,2 1 1

M N w w

xy xyx y i w j w

r x i y i mw

Page 13: Digital Image Processing Week III

•Local Histogram ProcessingLocal Statistics Examples

ORIGINAL IMAGE MEAN 3X3 MEAN 5X5

Page 14: Digital Image Processing Week III

•Local Histogram ProcessingLocal Statistics Examples

STANDARD DEVIATION 3X3

STANDARD DEVIATION 5X5

2xy xySD

Page 15: Digital Image Processing Week III

• For example• Want to enhance the dark

objects.

• How to separate the dark objects from the dark background.

•Local Statistics ProcessingVision Feature• Vision feature• a piece of information which is relevant for solving the

computational task related to a certain application.

• Intensity : Simple vision feature

Dark Objects

Dark Background

Page 16: Digital Image Processing Week III

• Assumption:• The dark objects are the

areas whose intensity is

• .

• Result:• Cannot separate the dark

objects from the dark area.

• Intensity is not a good feature to detect the dark objects.

•Local Statistics ProcessingUsing intensity to detect the dark objects

0.4 Gr m

Page 17: Digital Image Processing Week III

• Assumption:• The dark objects are the

areas whose local mean is

• .

• Result:• Cannot separate the dark

objects from the dark area.

• Local mean is not a good feature to detect the dark objects.

•Local Statistics ProcessingUsing local mean to detect the dark objects

0.4xy Gm m

Page 18: Digital Image Processing Week III

• Assumption:• The dark objects are the

areas whose local variance is• .

• Result:• The local variance does not

detect the dark backgrounds, but detects both of the bright and dark objects.

• Local variance is not a good feature to separate the bright objects from the dark objects.

•Local Statistics ProcessingUsing local variance to detect the dark objects

2 2 20.02 0.4G xy G

Page 19: Digital Image Processing Week III

• Assumption:• The dark objects are the

areas whose local mean and local variance are

• .

• Result:• Can well detect the dark

objects.

•Local Statistics ProcessingUsing the combination of the local mean and local variance.

2 2 20.4 and 0.02 0.4xy G G xy Gm m window size 3x3window size 5x5

window size 7x7

Page 20: Digital Image Processing Week III

•Local Statistics ProcessingUsing the local statistics to enhance the dark objects.

2 2 24 , if 0.4 and 0.02 0.4,

, otherwisexy G G xy Gr x y m m

s x yr x y

window size 3x3Original Image