Basic Gray Level Transformations (2) Negative 23 IIP Basic Gray - - PDF document

basic gray level transformations 2 negative
SMART_READER_LITE
LIVE PREVIEW

Basic Gray Level Transformations (2) Negative 23 IIP Basic Gray - - PDF document

Gonzalez & Woods, 2002 Basic Gray Level Transformations (2) Negative 23 IIP Basic Gray Level Transformations (3) Log Transformation (Example for Fourier Transform) Fourier spectrum values ~10 6 brightest pixels


slide-1
SLIDE 1

1

IIP 23

Basic Gray Level Transformations (2) – Negative

Gonzalez & Woods, 2002

IIP 24

Basic Gray Level Transformations (3) – Log Transformation (Example for Fourier Transform)

  • Fourier spectrum

values ~106

  • brightest pixels

dominant display

  • log @(c=1)

values<10 Gonzalez & Woods, 2002

slide-2
SLIDE 2

2

IIP 25

Basic Gray Level Transformations (4) – Power-Law Transformation (1)

Gonzalez & Woods, 2002

IIP 26

Basic Gray Level Transformations (5) – Power-Law Transformation (2)

Gonzalez & Woods, 2002

slide-3
SLIDE 3

3

IIP 27

Basic Gray Level Transformations (6) – Contrast Stretching

[ ]

1 1 min 2 2 max min max

(c) ( , ) ( ,0) and ( , ) ( , 1) linear stretch to 0, 1 & the minimum & maximum GL r s r r s r L L r r = = −  ⇒ −  

poor illumination, lack of dynamic range in sensor… low contrast image solution: increase dynamic range by piecewise linear transformation that cab be arbitrarily complex, however relies on the user

1 1 2 2 1 2 1 2

, linear , 0, 1 thresholding threshold @ mean (d) r s r s r r s s L = = ⇒ = = = − ⇒

Gonzalez & Woods, 2002

IIP 28

Image Enhancement in the Spatial Domain – Histogram Equalization (HE) (1)

  • HE yields output image with equally many pixels

at every gray level (flat histogram) which is useful before comparison/segmentation

  • r – gray level in input image ( )
  • s – gray level transformed by

(r,s=0 is black & r,s=1 is white)

) (r T s =

[ ]

normalized s.t 0,1 r r ∈

slide-4
SLIDE 4

4

IIP 29

HE (2)

  • Assume T(r) satisfies:
  • a. T(r) is single-valued & monotonically

increasing in b.

  • The inverse transform

exists (a) and the increasing

  • rder from black to white (a)

and range (b) are preserved ( ) 1 for 0 1 (monotonicity) T r r ≤ ≤ ≤ ≤ 1 ≤ ≤ r

1( ), 0

1 r T s s

= ≤ ≤

IIP 30

HE (3)

  • Viewed as random variables in [0,1], the gray

levels are characterized by the (different) probability density functions (PDFs)

) ( and ) ( s p r p

s r

“dark” image “light” image

slide-5
SLIDE 5

5

IIP 31

HE (4)

  • Following probability theory, if

are known and satisfies condition (a) then the PDF of the transformed gray levels is given by

  • The following enhancement techniques are

based on modifying the appearance of an image by controlling the PDF of its gray levels via the transformation function T(r).

) ( and ) ( s p r p

s r

) (

1 s

T − ( ) ( )

(1)

s r

dr s r ds

p p

=

IIP 32

HE (5)

  • Consider the (important in IP) transformation

which is the cumulative distribution function (CDF) of

  • r. Since (1) the pdf is always positive, integral=area

and T is single valued condition (a); (2) integral of a pdf in [0,1] is also in [0,1](b), that is, the two conditions above are satisfied (check for yourself)

1 , ) ( ) ( ) 2 ( ≤ ≤ = =

r dw w r T s

r r

p

slide-6
SLIDE 6

6

IIP 33

HE (6)

  • Solving (1) for the transformation in (2) yields
  • That is, the CDF transformation yields a random variable,

s, having a uniform probability density (thus increasing the gray level dynamic range). Notice, is always uniform independent of the form of .

1 ( ) ( ) ( ) 1 1 ( ) ( ) ( ) ( ) 1 ( ) 1 0 1

( )

s r r r r r r r

dr s r r ds ds dr r r dT r d w dw dr dr r s r

p p p p p p p r p

= = = =       = = ≤ ≤

( )

r r

p

( )

s s

p

IIP 34

HE (7) – Example (Continuous Case)

   ≤ ≤ + − =

  • therwise

1 r 2 2 ) ( r r pr

r r dw w r T s

r

2 ) 2 2 ( ) (

2

+ − = + − = =

1( )

1 1 1 1 r T s s s

= = ± − = − − [0,1] r ∈

( ) ( ) ( 2 2) 2(1 1 ) 2 (1 1 ) 2( 1 ) (1 1 ) 1 0 1

s r

dr dr s r r ds ds d s s ds d s s s ds

p p

= = − + =     − − − + − − =           − − − = ≤ ≤      

slide-7
SLIDE 7

7

IIP 35

HE (8)

  • For digital images – density probability,
  • The probability of occurrence of gray level is

n is the total number of pixels in the image and is the number of pixels having gray level

  • The discrete version of the CDF transformation

This transformation is called histogram equalization (show that T satisfies both conditions)

→∑

1, 0, 1 for levels

( ) ,

k

k k r

r k L L

n r n

p

≤ ≤ = −

=

( ) ( ) , 0, 1

k k j k k r j j j

n s T r p r k L n

= =

= = = = −

∑ ∑

k

r

k

r

k

n

IIP 36

HE (9)

  • Unlike for the continuous transformation, it

cannot be proved that this discrete transformation will produce the discrete equivalent of a uniform pdf, which would be a uniform histogram. However, it does have the tendency of spreading the histogram so that the levels of the histogram-equalized image will span a fuller range of the gray scale

slide-8
SLIDE 8

8

IIP 37

HE (10)

Advantages:

  • Gray level span the entire range
  • Automatic (based on image; no parameter

selection)

  • Simple to calculate

IIP 38

HE (11) – Example (Discrete Case) (1)

  • 64x64, 8-level image having the following

distribution

Gonzalez & Wintz, 1977

=

= = = = 19 . ) ( ) ( ) (

j r j r

r p r p r T s

1 1 1 1

( ) ( ) ( ) ( ) 0.44

r j j r r

s T r p r p r p r

=

= = = + =

2 3 4 5 6 7

0.65, 0.81, 0.89, 0.95, 0.98, 1.00 s s s s s s = = = = = =

(Fig. a)

slide-9
SLIDE 9

9

IIP 39

HE (12) – Example (Discrete Case) (2)

  • Only eight equally-spaced levels are allowed,

thus each of the transformed values must be assigned to its closest valid level

  • There are only 5 distinct histogram-equalized

gray levels, thus redefinition yields the levels

1 2 3 4 5 6 7

1/ 7, 3/ 7, 5/ 7, 6/ 7, 6/ 7, 1, 1, 1 s s s s s s s s ≅ ≅ ≅ ≅ ≅ ≅ ≅ ≅

1 , 7 / 6 , 7 / 5 , 7 / 3 , 7 / 1

4 3 2 1

= = = = = s s s s s

(Fig. b) (Fig. c)

1 2 3 4

790 pixels @ 1/ 7, 1023 pixels @ 3/ 7, 850 pixels @ 5/ 7, 656 329 985 pixels @ 6/ 7, 245 122 81 448 pixels @ 1 s s s s s = = = + = = + + = =

IIP 40

HE (13) – Example (Discrete Case) (3)

slide-10
SLIDE 10

10

IIP 41

HE (10) – Illustration 1

Castleman, 1996

  • utput image with equally many

pixels at every gray level

IIP 42

HE (11) – Illustration 2

Gonzalez & Wintz, 1977

slide-11
SLIDE 11

11

IIP 43

HE (12) – Illustration 3

Gonzalez & Woods, 2002

1 2 4 3