Top Banner

of 24

ch03-enhancementspdom

Jul 07, 2018

Download

Documents

Anitha Joseph
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/19/2019 ch03-enhancementspdom

    1/74

    H.R. Pourreza

    Digital ImageProcessing

     

    H.R.Pourreza

    Image Enhancement in theSpatial Domain

    (Chapter 3)

  • 8/19/2019 ch03-enhancementspdom

    2/74

    H.R. Pourreza

    The principal objective of enhancement is toprocess an images so that the result is moresuitable than the original image for aSPECIFIC application

    Category of image enhancement•  Spatial domain•  Frequency domain

    Objective

  • 8/19/2019 ch03-enhancementspdom

    3/74

    H.R. Pourreza

    Background 

     g ( x , y) = T  [ f ( x , y) ]

  • 8/19/2019 ch03-enhancementspdom

    4/74

    H.R. Pourreza

    Point Processing,Gray-Level rans!or"ation Function

    s = T  (r )

    Contrast

    stretching

    Thresholding

  • 8/19/2019 ch03-enhancementspdom

    5/74

    H.R. Pourreza

     g ( x , y) = T  [ f ( x , y) ]  1

    0

    0

    -1

     0

     0

     0

     0

     0

     f ( x, y)  g ( x, y)

    #ask Processing Filtering

  • 8/19/2019 ch03-enhancementspdom

    6/74

  • 8/19/2019 ch03-enhancementspdom

    7/74

    H.R. Pourreza

    I"age $egative

    s = L - 1 - r 

  • 8/19/2019 ch03-enhancementspdom

    8/74

    H.R. Pourreza

    Log rans!or"ations

     s = c log(1+r )

    Pixel values dynamic range=[ ! "#$%"&'

  • 8/19/2019 ch03-enhancementspdom

    9/74

    H.R. Pourreza

    Po%er-La% rans!or"ations

    s = cr  

    s = r 2.5

    r   = [1 10 20 30 40 210 220 230 240 250 255]

     s(γ   = 2.5) = [0 0 0 1 2 157 176 197 219 243 255]

     s(γ   =.4) = [28 70 92 108 122 236 240 245 249 253 255]

  • 8/19/2019 ch03-enhancementspdom

    10/74

    H.R. Pourreza

    Po%er-La% rans!or"ations

     &uto"atic

      Selection

  • 8/19/2019 ch03-enhancementspdom

    11/74

    H.R. Pourreza

    Po%er-La% rans!or"ations - Ga""aCorrection

  • 8/19/2019 ch03-enhancementspdom

    12/74

    H.R. Pourreza

    Po%er-La% rans!or"ations

    c=1

    γ   = 0.4c=1

    γ   = 0.3

    c=1γ   = 0.6 

  • 8/19/2019 ch03-enhancementspdom

    13/74

    H.R. Pourreza

    Po%er-La% rans!or"ations

    c=1

    γ   = 3

    c=1

    γ   = 5

    c=1

    γ   = 4

  • 8/19/2019 ch03-enhancementspdom

    14/74

    H.R. Pourreza

    • A!antage• Ar"itraril# comple$

    • Disa!antage• %ore user input

    • pe o' &rans'ormations•

    Contrast stretching• ra#le!el slicing

    • *itplane slicing

    Piecewise-Linear Transformation

    Functions

  • 8/19/2019 ch03-enhancementspdom

    15/74

    H.R. Pourreza

    Contrast Stretc'ing

    (bjective+ Increase the #namic range o' the gra#le!els in the image

    Causes for poorimagePoor illumination,rong lens aperture,rong shutter spee-ac o' #namicrangein the imaging sensor

  • 8/19/2019 ch03-enhancementspdom

    16/74

    H.R. Pourreza

    )xample "For image *ith intensity range [$ ! "$'+hat should ,r"-s". and ,r/-s/. be to increase

    the dynamic range of the image to [ !/$$'0

     s

    Contrast Stretc'ing

  • 8/19/2019 ch03-enhancementspdom

    17/74

    H.R. Pourreza

    (bjective1 2ighlighting a speci3c range of gray levels inan image#

    Gray-Level Slicing

  • 8/19/2019 ch03-enhancementspdom

    18/74

    H.R. Pourreza

    255 138 30

    65 12 201

    180 111 85

    255

    138

    30

    65

    12

    201

    183

    111

    85

      1 1 1 1 1 1 1 1

      0 1 0 1 0 0 0 1

      1 1 1 1 1 0 0 0

      1 0 0 0 0 0 1 0

      0 0 1 1 0 0 0 0

      1 0 0 1 0 0 1 1

      1 1 1 0 1 1 0 1

      1 1 1 1 0 1 1 0

      1 0 1 0 1 0 1 0

    MSBLSB

    1 1 0

    0 0 1

    1 0 0

    MSB plane

    1 0 1

    1 0 1

    1 1 1

    LSB plane

    Bit-Plane Slicing

  • 8/19/2019 ch03-enhancementspdom

    19/74

    H.R. Pourreza

    Bit-Plane Slicing

  • 8/19/2019 ch03-enhancementspdom

    20/74

    H.R. Pourreza

    Bit-Plane Slicing

  • 8/19/2019 ch03-enhancementspdom

    21/74

    H.R. Pourreza

    2istogram &he histogram o' a igital image /ith gra# le!els inthe range 012 L4 is a iscrete 'unction

    h(r k 

    ) 5 nk 

    2

    /here r k  is the k th gra# le!el an nk  is the num"er o'

    pi$els in the image ha!ing gra# le!el r k .

    4ormali5ed 2istogram

    Di!iing each !alue o' the histogram "# the total numo' pi$els in the image2 enote "# n.

     p(r k ) 5 nk  6n.

    7ormalize histogram pro!ie use'ul image statistics.

    (istogra" Processing

  • 8/19/2019 ch03-enhancementspdom

    22/74

    H.R. Pourreza

    !n"#$on %o&'al$e*$# = 'g*$#($'g)

    [,/]=$e($'g)

    $#=e&o(256,1)

    o& & = 1o& "=1/

    $#($'g(&,")+1,1)=$#($'g(&,")+1,1)+1 8

      en

    en

     %o&'al$e*$# = $#(/) plo#(%o&'al$e*$#)

    (istogra" E)traction using #atlab

  • 8/19/2019 ch03-enhancementspdom

    23/74

    H.R. Pourreza

    (istogra" Processing

  • 8/19/2019 ch03-enhancementspdom

    24/74

    H.R. Pourreza

    2istogram equali5ation is used to enhance imagecontrast and gray!level detail by spreading thehistogram of the original image#  s = , r  .   r   "-*here r   and s  are normali5ed pixel intensities

    Conditions for the transformation*a+  , r  . is single!valued and monotonically increasing

    in the interval r   "

    ,b.   , r  . " for r   "

    1

    (istogra" Eualiation

  • 8/19/2019 ch03-enhancementspdom

    25/74

    H.R. Pourreza

    9":ecti!e o' histogram e;ualization  &rans'orm the histogram 'unction o' theoriginal image  pr (r ) to a uni'orm histogram

    'unction. ps(s) 5 1≤ s ≤ 

    !al$e& 

    &ano&'a#$on pr (r )  p s( s)

    ∫ ==r 

    r    dww pr T  s

    0

    )()(   ∑=

    ==k 

     j

     jr k k    r  pr T  s0

    )()(

    Continuous case Discrete case

    (istogra" Eualiation

  • 8/19/2019 ch03-enhancementspdom

    26/74

    H.R. Pourreza

    0

    1

    2

    3

    128

    129

    130

    253

    254

    255

    0

    0

    0

    0.004

    0.15

    0.05

    0.005

    0.006

    0.004

     pr (r k )k 

    T  (r k )

    00

    0

    0

    00.004

    0.154

    0.204

    0.989

    0.994

    1

     sk 

    0

    0

    0

    0

    10

    39

    52

    252

    253

    255

    0

    0.004

    0.008

    0.011

    0.5

    0.505

    0.51

    0.992

    0.996

    1

    r k 

    255 255

    np!# $'age !#p!# $'age

  • 8/19/2019 ch03-enhancementspdom

    27/74

    H.R. Pourreza

    (istogra" Eualiation

  • 8/19/2019 ch03-enhancementspdom

    28/74

    H.R. Pourreza

    255

    (istogra" Eualiation

    (i E li il$

  • 8/19/2019 ch03-enhancementspdom

    29/74

    H.R. Pourreza

    (istogra" Eualiation

    15

    1

    8

    0.5

    4

    0.25

    12

    0.75

    0.4

    0.2

    0.3

    0.1

    0

    1

    23

    4

    5

    67

    8

    9

    10

    11

    12

    13

    14

    15

    0

    0

    00

    0.09

    0.06

    0.10.15

    0.3

    0.18

    0.05

    0.07

    0

    0

    0

    0

    0

    0

    00

    0.09

    0.15

    0.250.4

    0.7

    0.88

    0.93

    1

    1

    1

    1

    1

    r k   pr (r k ) %o&'al$e sk 

    0

    0

    00

    1

    2

    46

    11

    13

    14

    15

    15

    15

    15

    15

     sk 

    plo#( sk )

    np!# $'age $e 100 × 100

  • 8/19/2019 ch03-enhancementspdom

    30/74

    H.R. Pourreza

    6s histogram equali5ation a good approachto enhance the belo* image0

    (istogra" #atc'ing

  • 8/19/2019 ch03-enhancementspdom

    31/74

    H.R. Pourreza

    2istogram 7atching method generates aprocessed image that has a speci3edhistogram#

    np!# $'age

     pr (r )

    T  (r )

    ∫ r 

    r    dt t  p

    0

    )(  s

    e$&e!#p!# $'age

     p z ( z )

    G ( z )

    ∫  z 

     z    dt t  p

    0

    )( v

     s ≈ v, $n"e :o#; $'a#el? !n$o&' pdf 

     z  = G-1[T ( s )] s = G[T ( r  )]

    (istogra" #atc'ing

  • 8/19/2019 ch03-enhancementspdom

    32/74

    H.R. Pourreza

    (istogra" #atc'ing

  • 8/19/2019 ch03-enhancementspdom

    33/74

    H.R. Pourreza

    (istogra" #atc'ing

  • 8/19/2019 ch03-enhancementspdom

    34/74

    H.R. Pourreza

    0.6

    0.12

    0.08

    0.0

    0.01

    0.005

    0

    0.6

    0.72

    0.8

    0.8

    0.9

    0.95

    1

    153

    184

    204

    204

    230

    242

    255

    (istogra" Eualiation

  • 8/19/2019 ch03-enhancementspdom

    35/74

    H.R. Pourreza

    ) %oi'# the histogram o'   the image to o"tain  p z ( z ).

    e histogram in

      step .3) =in the in!erse G ( z )?) Enhance image is

    o"taine "# appl#ing G to thepi$els o' the histograme;ualizeimage sho/n in =ig. 3.

  • 8/19/2019 ch03-enhancementspdom

    36/74

    H.R. Pourreza

    125128

    0.98

    0.002

    250255

    0.70.3

    178

    255

    Lo"al $#og&a'

    @lo:al $#og&a'

    125 128

    Local (istogra" En'ance"ent 

  • 8/19/2019 ch03-enhancementspdom

    37/74

    H.R. Pourreza

    Local (istogra" En'ance"ent 

  • 8/19/2019 ch03-enhancementspdom

    38/74

    H.R. Pourreza

    Contrast manipulation using local statistics2 such as the mean an!ariance2 is use'ul 'or images /here part o' the image is accepta"ut other parts ma# contain hien 'eatures o' interest.

    (istogra" Statistics !or I"age En'anc.

  • 8/19/2019 ch03-enhancementspdom

    39/74

    H.R. Pourreza

    -et ( x 2 y ) "e the coorinates o' a pi$el in an image2 an let S xy enote a neigh"orhoo (su"image) o' speci>e size2 centere at( x 2 y ).

    .)(][

    )(

    ),(

    ,2

    ,2

    ),(

    ,,

    −=

    =

     xy

     xy xy

     xy xy

    S t  s

    t  sS t  sS 

    S t  s

    t  st  sS 

    r  pmr 

    r  pr m

    σ 

     &he local mean an !ariance are the ecision 'actors to /hetherlocal enhancement or not.

    (istogra" Statistics !or I"age En'anc.

  • 8/19/2019 ch03-enhancementspdom

    40/74

    H.R. Pourreza

      ≤≤≤=

     o#;e&e

    parameters

     E = 4,

    k 0 = 0.4,

    k 1= 0.02,

    k  = 0.4

    S$e o lo"al a&ea = 3 × 3

    (istogra" Statistics !or I"age En'anc.

  • 8/19/2019 ch03-enhancementspdom

    41/74

    H.R. Pourreza

    125 135 145 135 ..

    168 175 158 149 ..

    210 231 215 129 ..

    187 192 145 200 ..

    174

    'age Mean

    164

    187

     µ ( x, y)

    σ( x, y)

     E 

    (istogra" Statistics !or I"age En'anc.

  • 8/19/2019 ch03-enhancementspdom

    42/74

    H.R. Pourreza

    Enhance Image 9riginal Image

    (istogra" Statistics !or I"age En'anc.

  • 8/19/2019 ch03-enhancementspdom

    43/74

    H.R. Pourreza

    Arithmetic6logic operations in!ol!ing images areper'orme on a pi$el"#pi$el "asis "et/een t/o ormore images.

    8rithmetic (perations Aition2 Su"traction2 %ultiplication2 an Di!ision

    9ogic (perations

      A7D2 9R2 79&

    En'ance"ent /sing &rit'"etic0LogicO1.

  • 8/19/2019 ch03-enhancementspdom

    44/74

    H.R. Pourreza

    A%

     

    -ogic operations are per'orme on the "inar#

    representation o' the pi$el intensities

    En'ance"ent /sing 84: and (; LogicO1.

  • 8/19/2019 ch03-enhancementspdom

    45/74

    H.R. Pourreza

    En'ance"ent /sing &rit'"etic O1. 2S

  • 8/19/2019 ch03-enhancementspdom

    46/74

    H.R. Pourreza

    Pro"lem+ &he pi$el intensities in the i@erence image can range 'rom

  • 8/19/2019 ch03-enhancementspdom

    47/74

    H.R. Pourreza

    [ ]2

    ),(

    2

    ),(

    1

    1),(),(

    ),(1

    ),(

    ),(),(),(

     y x y x g 

     y x f   y x g  E 

     y x g k 

     y x g 

     y x y x f   y x g 

    η σ σ 

    η 

    ==

    =

    +=

    ∑=

    9riginal image 7oise /ith zero mean

    En'ance"ent /sing &rit'"etic O1.8veraging

  • 8/19/2019 ch03-enhancementspdom

    48/74

    H.R. Pourreza

    @a!$an %o$e

    'ean = 0

    a&$an"e = 64

     ! = 8

     ! = 32

     ! = 16

     ! = 128

     f ( x, y)  g ( x, y)

    µ µ+σµ-σ x

    En'ance"ent /sing &rit'"etic O1.8veraging

  • 8/19/2019 ch03-enhancementspdom

    49/74

    H.R. Pourreza

    Di@erenceimages"et/eenoriginal imagean imageso"taine 'roma!eraging.

     ! = 8

     ! = 16

     ! = 32

     ! = 128

    7otice themean an

    !arianceo' thei@erenceimagesecrease as

    K  increases.

    En'ance"ent /sing &rit'"etic O1.8veraging

  • 8/19/2019 ch03-enhancementspdom

    50/74

    H.R. Pourreza

    Spatial >ltering are>ltering operationsper'orme on the pi$elintensities o' an imagean not on the're;uenc# componentso' the image.

    ∑ ∑−= −=

    ++="

    " s

    #

    #t 

    t  y s x f  t  sw y x g    ),(),(),(

    " = (m - 1) 2 # = ($ - 1) 2

    Basics o! S1atial Filtering - 9inear

  • 8/19/2019 ch03-enhancementspdom

    51/74

    H.R. Pourreza

    Response2 R2 o' an m × n mas at an# point ( x 2  y )

    ∑=

    =m$

     z w %

    1

    Special consieration is gi!en /hen the center o' theapproach the "oarer o' the image.

    Basics o! S1atial Filtering

  • 8/19/2019 ch03-enhancementspdom

    52/74

    H.R. Pourreza

    7onlinear spatial >lters operate on neigh"orhoos2 anthe mechanics o' sliing a mas past an image are thesame as /as :ust outline. In general ho/e!er2 the>ltering operation is "ase conitionall# on the !alues o'

    the pi$el in the neigh"orhoo uner consieration2 anthe# o not e$plicitl# use coeBcients in the sumo'proucts manner escri"e pre!iousl#.

    )xampleComputation 'or the meian is a nonlinear operation.

    $onlinear o! S1atial Filtering

  • 8/19/2019 ch03-enhancementspdom

    53/74

    H.R. Pourreza

    Smoothing >lters are use  7oise reuction  Smoothing o' 'alse contours  Reuction o' irrele!ant etail

    nesira"le sie e@ect o' smoothing >lters  *lur eges

    Ce$g;#e

    ae&age

    Bo>

    $l#e& 

    ,eighte a!erage >lterreuces "lurring in the

    smoothing process. 

    S"oot'ing S1atial Filtering - Linear  &veraging *lo%-1ass+ Filters

  • 8/19/2019 ch03-enhancementspdom

    54/74

    H.R. Pourreza

    $ = $l#e& $e

    $ = 3

    $ = 5 $ = 9

    $ = 15

    $ = 35

    S"oot'ing S1atial Filtering 2 Linear  &veraging *lo%-1ass+ Filters

  • 8/19/2019 ch03-enhancementspdom

    55/74

    H.R. Pourreza

    $l#e& $e

    $ = 15

    ;&; = 25D o

    ;$g;e# $n#en$#?

    S"oot'ing S1atial Filtering &veraging 4 'res'old 

  • 8/19/2019 ch03-enhancementspdom

    56/74

    H.R. Pourreza

    9rerstatistics >lters are nonlinear spatial >lters/hoseresponse is "ase on orering (raning) the pi$elscontaine in the image area encompasse "# the

    >lter2 an then replacing the !alue o' the centerpi$el /ith the !alue etermine "# the raningresult.3 × 3 Me$an $l#e& [10 125 125 135 141 141 144 230 240] = 141

    3 × 3 Ma> $l#e& [10 125 125 135 141 141 144 230 240] = 2403 × 3 M$n $l#e& [10 125 125 135 141 141 144 230 240] = 10

    %eian >lter eliminates isolate clusters o' pi$elsthat are light or ar /ith respect to their neigh"ors2an /hose area is less than n

  • 8/19/2019 ch03-enhancementspdom

    57/74

    H.R. Pourreza

    $ = 3

    Ae&age

    $l#e& 

    $ = 3

    Me$an

    $l#e& 

    Order Statistic Filters

  • 8/19/2019 ch03-enhancementspdom

    58/74

    H.R. Pourreza

    The principal objective of sharpening is tohighlight 3ne detail in an image or toenhance detail that has been blurred#

    ∫ 

    ∑9

    1

    9

    1

    9

    1

    91

     z 

     z 

    'age Bl!&&e 'age

    The derivatives of a digital function are de3ned interms of di>erences#

    S'ar1ening S1atial Filters

  • 8/19/2019 ch03-enhancementspdom

    59/74

    H.R. Pourreza

    Re;uirements 'or igital eri!ati!e  =irst eri!ati!e  ) %ust "e zero in at segment 

  • 8/19/2019 ch03-enhancementspdom

    60/74

    H.R. Pourreza

    S'ar1ening S1atial Filters

  • 8/19/2019 ch03-enhancementspdom

    61/74

    H.R. Pourreza

    Comparing the response bet*een 3rst! and second!orderedderivatives1". First!order derivative produce thic?er edge/. Second!order derivative have a stronger responseto 3ne detail- such as thin lines and isolated points#@. First!order derivatives generally have a strongerresponse to a gray!level step A/ B "$B. Second!order derivatives produce a doubleresponse at step changes in gray level#

    In general the secon eri!ati!e is "etter than the >rsteri!ati!e 'or image enhancement. &he principle use o' >rsteri!ati!e is 'or ege e$traction.

    S'ar1ening S1atial Filters

    /se o! First 5erivative !or Edge

  • 8/19/2019 ch03-enhancementspdom

    62/74

    H.R. Pourreza

    First derivatives in image processing are implementedusing the magnitude of the gradient#

     y x

    GG y

     f 

     x

     f m"g  f 

     y

     f 

     x

     f 

    +≈

       

      

     ∂∂

    +   

      

    ∂∂

    =∇=∇

    ∂∂

    ∂∂

    =∇

    5.022

    )( f 

    f   z 1  z 2

     z 6 z 8

     z 4 z 7

     z 3

     z 9 z 5

    ;oberts operator

    G> = ( z 9- z 5) an G? = ( z 8 - z 6)Sobel operator

    G> = ( z 3+2 z 6 +9) - ( z 1+2 z 4+7) an

    G?

    = ( z 7

    +2 z 8

    +9

    ) - ( z 1

    +2 z 2

    +3

    )

    /se o! First 5erivative !or EdgeE)tractionGradient 

  • 8/19/2019 ch03-enhancementspdom

    63/74

    /se o! First 5erivative !or Edge

  • 8/19/2019 ch03-enhancementspdom

    64/74

    H.R. Pourreza

     f ( x, y) = [40, 140]

    E. 0 0 0 0 0 0

    E. 0 200 400 400 400 400 EE

    E. 0 400 600 400 400 400 E...

    E. 0 400 400 0 0 0

    E. 0 400 400 0 0 0

    E. 0 400 400 0 0 0

    -1 -2

    0

    2

    0

    1

    -1

    1

    0

    -1 0

    2

    0

    -2

    -1

    1

    1

    0

    E 0 0 0 0 0

    E 0 100 200 200 200

    E 0 200 0 0 0

    E 0 200 0 0 0

    -11

    -11

    /se o! First 5erivative !or EdgeE)tractionGradient 

    /se o! First 5erivative !or Edge

  • 8/19/2019 ch03-enhancementspdom

    65/74

    H.R. Pourreza

    /se o! First 5erivative !or EdgeE)tractionGradient 

  • 8/19/2019 ch03-enhancementspdom

    66/74

    H.R. Pourreza

    2

    2

    2

    22

     y

     f 

     x

     f  f 

    ∂+

    ∂=∇

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

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

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

    2

    2

    2

    2

    2

     y y f  y x f  y x f  y x f  y x f  f 

     y x f  y x f  y x f  y

     f 

     y x f  y x f  y x f  x

     f 

    −−+++−++=∇

    −−++=∂∂

    −−++=∂∂

    6nd  5erivative 2 La1lacian

  • 8/19/2019 ch03-enhancementspdom

    67/74

    H.R. Pourreza

    2

    2

    2

    22

     y

     f 

     x

     f  f 

    ∂+

    ∂=∇

    6sotropic 3lter response is independent of thedirection of the discontinuities in the image to*hich the 3lter is applied#

    /se o! 6nd  5erivative !or En'ance"ent La1lacian

  • 8/19/2019 ch03-enhancementspdom

    68/74

  • 8/19/2019 ch03-enhancementspdom

    69/74

  • 8/19/2019 ch03-enhancementspdom

    70/74

    H.R. Pourreza

     g ( x, y) = f ( x, y) -

    0 1

    1

    1

    1

    0

    0

    0

    -4

    ),(2  y x f  ∇

    =

    )],(4)1,()1,(),1(),1([2  y x f   y x f   y x f   y x f   y x f   f     −−+++−++=∇

    /se o! 6nd  5erivative !or En'ance"ent La1lacian

  • 8/19/2019 ch03-enhancementspdom

    71/74

    H.R. Pourreza

    High"oost >ltering is use /hen the original image is"lurre an ar.

    ),(),(   2  y x f   y x &f   f  '#   ∇−=  &  1

    /n-s'ar1 #asking and (ig'-boostFiltering

  • 8/19/2019 ch03-enhancementspdom

    72/74

    H.R. Pourreza

    ( :)

    /n-s'ar1 #asking and (ig'-boostFiltering

    Co"bining S1atial

  • 8/19/2019 ch03-enhancementspdom

    73/74

    H.R. Pourreza

    Co"bining S1atialEn'ance"ent#et'ods

    Co"bining S1atial

  • 8/19/2019 ch03-enhancementspdom

    74/74

    Co"bining S1atialEn'ance"ent#et'ods