Docsity

Image Enhancement: Histogram Equalization and Specification Techniques, Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download Image Enhancement: Histogram Equalization and Specification Techniques and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Histogram Processing 1

Image Enhancement:

Histogram Processing

Reading: Chapter 3 (Spatial domain)

Histogram Processing

  • Histogram Equalization
  • Histogram Specification/Matching

Histogram Processing 3

Histogram

p(rk)= nk/n rk rk ∈ { 0, 1, 2, 3...., L−1} nk : # pixels with gray level rk n : # pixels in the image

Histogram

Histogram Processing 7

Histogram Equalization

( i ) T ( r ) is single valued valued and monotonically increasing in 0! r! 1 ( ii ) 0! T ( r )! 1 for 0! r! 1 [0, 1] T " "# [ 0 , 1 ] Inverse transformation : T $^1 ( s )= r 0! s! 1 T $^1 ( s ) also satisfies ( i ) and ( ii ) The gray levels in the image can be viewed as random variables taking values in the range [0,1]. Let pr ( r ) : p.d.f. of input level r and let ps ( s ) : p.d.f. of s s = T ( r ) ; % ps ( s ) = pr ( r ) dr^ ds r = T $^1 ( s ) (from ECE 140)

Equalization (contd.)

We are interested in obtaining a transformation function T( ) which transforms an arbitrary p.d.f. to an uniform distribution pr(r) ps(s) s

Histogram Processing 9

Consider s = T ( r ) = pr ( w ) dw 0! r! 1

0 r

(Cumulative distribution function of r)

ps ( s ) = pr ( r ) dr^

ds r = T #^1 ( s )

ds

dr

d

dr

pr ( w ) dw

0 r

) =^ pr ( r )

* ps ( s ) = pr ( r )

pr ( r )

r = T #^1 ( s )

+ 1 0! s! 1

Equalization: Example

2 r^1 pr(r) pr ( r ) = ! 2 r + 2 0 " r " 1 0 Else

s = T ( r ) = ( 2! 2 w ) dw 0 r

& =^ (^2 w^!^ w

2 ) (^0) r = 2 r! r 2 ' r^2! 2 r + s = 0

Histogram Processing 13

Fig 3.18: Transformation curves

Equalization: Discrete Case

0 Number of levels p r n n r k L L s T r p r n n r k k k k k r j j j k j k ( ) ; , ,..., ( ) ( ) =!! = "

= = = = = $ $ 1 0 1 1 0 0

Histogram Processing 15

Discrete Case: Example

64x64 image; 8 gray levels. Notice that equalized histogram is not perfectly flat! k r n n n S^ n n p^ s s s s s s s s s k k k k j j k = s k !! !! !! !! !! !! !! !! = " 0 (^17) 0 (^17 3 ) 1 (^2 7 5 ) 2 (^3 7 6 ) 3 (^4 7 6 ) 3 (^5 ) 4 (^6 ) 4 (^7 ) 4

Equalization: Image Examples

Original, Equalized (64) Equalized (256)

Histogram Processing 19

Question

  • What happens when you apply equalization to an already equalized histogram - In the continuous case? - In the discrete case?

Fig 3.19: Matching

Histogram Processing 21

Matching: Summary

Steps: (1) Equalize the levels of original image (2) Specify the desired pz(z) and obtain G(z) (3) Apply z=G-1(s) to the levels s obtained in step 1

Matching: an example

z p z v G r n p z

z

z

z

z s

z s

z s

z s

z

k z k k k k z k

1 7 3 7 5 7 6 7

0 1 1 7 2 2 7 3 3 7 0 4 4 (^7 ) 5 5 (^7 ) 6 6 7 3 7

1 0 15 1.0! s 4 = 1 448 0. 11

Histogram Processing 25

Desired & modified histograms

I2=histeq(I1,imhist(J)); Imhist(I2); Imhist(J) J=some image

Histogram modified image

Histogram Processing 27

Fig 3.20: Another example

Fig 3.