image enhancement ii

Upload: arslan0989

Post on 04-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Image Enhancement II

    1/68

      Digital Image Processing

    Lecture 4: Image Enhancement II

    Dr. Muhammad Amjad Iqbal

  • 8/13/2019 Image Enhancement II

    2/68

    Pixel Operations

    for Image Enhancement

  • 8/13/2019 Image Enhancement II

    3/68

    1/10/2014 3

    Common Pixel Operations

    Image Negatives

    Log Transformations

    Power-LawTransformations

  • 8/13/2019 Image Enhancement II

    4/68

    1/10/2014 4

    Image Negatives

    Reverses the gray level order For L gray levels the transformation function is

    s =T (r ) = (L - 1) - r  

  • 8/13/2019 Image Enhancement II

    5/68

    1/10/2014 5

    Image Scaling

    s =T (r ) = a.r  (a is a constant)

  • 8/13/2019 Image Enhancement II

    6/68

    1/10/2014 6

    Log Transformations

    Function of  s = cLog(1+r )

  • 8/13/2019 Image Enhancement II

    7/68

    1/10/2014 7

    Log Transformations

    Properties of log transformations –For lower amplitudes of input image the range of gray

    levels is expanded

     –For higher amplitudes of input image the range of gray

    levels is compressed  

    Application: – This transformation is suitable for the case when the

    dynamic range of a processed image far exceeds the

    capability of the display device (e.g. display of theFourier spectrum of an image)

     –  Also called “dynamic-range compression / expansion”  

  • 8/13/2019 Image Enhancement II

    8/68

    1/10/2014 8

    Log Transformations

  • 8/13/2019 Image Enhancement II

    9/68

    1/10/2014 9

    Power-Law Transformation

  • 8/13/2019 Image Enhancement II

    10/68

    1/10/2014 10

    Power-Law Transformation

    For γ < 1:  Expands values of dark pixels,compress values of brighter pixels

    For γ > 1:  Compresses values of dark pixels,expand values of brighter pixels

    If γ=1 & c=1:  Identity transformation (s = r)

    A variety of devices (image capture, printing, display) respondaccording to power law and need to be corrected

    Gamma (γ) correction 

    The process used to correct the power-law responsephenomena

  • 8/13/2019 Image Enhancement II

    11/68

    1/10/2014 11

    Power-Law Transformation

  • 8/13/2019 Image Enhancement II

    12/68

    1/10/2014 12

    Gamma Correction

  • 8/13/2019 Image Enhancement II

    13/68

    1/10/2014 13

    Power Law Example

  • 8/13/2019 Image Enhancement II

    14/68

    1/10/2014 14

    Power Law Example (cont…) 

    γ  = 0.6

    00.1

    0.2

    0.3

    0.4

    0.5

    0.60.7

    0.8

    0.9

    1

    0 0.2 0.4 0.6 0.8 1

    Old Intensities

       T

      r  a  n  s   f  o  r  m  e   d   I  n   t  e  n

      s   i   t   i  e  s

  • 8/13/2019 Image Enhancement II

    15/68

    1/10/2014 15

    Power Law Example (cont…) 

    γ  = 0.4

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    1

    0 0.2 0.4 0.6 0.8 1

    Original Intensities

       T  r  a  n  s   f  o  r  m  e   d   I  n   t  e

      n  s   i   t   i  e  s

  • 8/13/2019 Image Enhancement II

    16/68

    1/10/2014 16

    Power Law Example (cont…) 

    γ  = 0.3

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    1

    0 0.2 0.4 0.6 0.8 1

    Original Intensities

       T  r  a  n  s   f  o  r  m  e   d   I  n   t  e

      n  s   i   t   i  e  s

  • 8/13/2019 Image Enhancement II

    17/68

    1/10/2014 17

    Power Law Example (cont…) 

    • The images to theright show amagnetic resonance

    (MR) image of afractured humanspine

    • Different curves

    highlight differentdetail

    s = r 0.6 

     s =

     r  0  . 4 

  • 8/13/2019 Image Enhancement II

    18/68

    1/10/2014 18

    Power Law Example

  • 8/13/2019 Image Enhancement II

    19/68

    1/10/2014 19

    Power Law Example (cont…) 

    γ  = 5.0

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    1

    0 0.2 0.4 0.6 0.8 1

    Original Intensities

       T  r  a  n  s   f  o  r  m  e   d   I  n   t  e  n  s   i   t   i  e  s

  • 8/13/2019 Image Enhancement II

    20/68

    1/10/2014 20

    Power Law Transformations (cont…) 

    • An aerial photo

    of a runway isshown

    • This timepower law

    transforms areused to darkenthe image

    • Different curves

    highlightdifferent detail

    s = r 3.0  

     s =

     r  4  . 0 

    i i i f i

  • 8/13/2019 Image Enhancement II

    21/68

    1/10/2014 21

    Piecewise-Linear Transformation

    Contrast StretchingGoal: 

     – Increase the dynamic range of the gray levels for low

    contrast images

    Low-contrast images can result from

     – poor illumination

     –lack of dynamic range in the imaging sensor

     –wrong setting of a lens aperture during image

    acquisition 

    C S hi E l

  • 8/13/2019 Image Enhancement II

    22/68

    1/10/2014 22

    Contrast Stretching Example

  • 8/13/2019 Image Enhancement II

    23/68

    1/10/2014 23

    Piecewise-Linear Transformation: Contrast Stretching

  • 8/13/2019 Image Enhancement II

    24/68

    1/10/2014 24

    Thresholding

  • 8/13/2019 Image Enhancement II

    25/68

    1/10/2014 25

    Gray Level Slicing

    •Highlighting a specific range ofGray levels in an image

    • First approach

     – Display a high value for all the

    gray levels in the range of

    interest

     – Low value for all other gray

    levels

     – This will produce a Binary Image

  • 8/13/2019 Image Enhancement II

    26/68

    1/10/2014 26

    Gray Level Slicing

    • 2nd approach

     – Brightens the desired range of

    Gray Levels but preserves the

    Gray Levels of rest of the pixels

  • 8/13/2019 Image Enhancement II

    27/68

    Contrast Stretching

  • 8/13/2019 Image Enhancement II

    28/68

     Contrast Stretching through Histogram 

    If r max and r min are the maximum and minimum gray levelof the input image and L is the total gray levels of output

    image The transformation function for contrast stretching

    will be

  • 8/13/2019 Image Enhancement II

    29/68

    Histogram Equalization

  • 8/13/2019 Image Enhancement II

    30/68

    Histogram Equalization

  • 8/13/2019 Image Enhancement II

    31/68

    Histogram Equalization

  • 8/13/2019 Image Enhancement II

    32/68

    Histogram Equalization

  • 8/13/2019 Image Enhancement II

    33/68

    Histogram Equalization

  • 8/13/2019 Image Enhancement II

    34/68

    Histogram Equalization

  • 8/13/2019 Image Enhancement II

    35/68

    Histogram Equalisation(Summary)

    Spreading out the frequencies in an image (orequalising the image) is a simple way to improvedark or washed out images

    The formula for histogramequalisation is given where

     – r k : input intensity

     – sk : processed intensity

     – k : the intensity range(e.g 0.0 – 1.0)

     – n j: the frequency of intensity j

     – n: the sum of all frequencies

    )( k k    r T  s  

     j

     jr    r  p1

    )(

     j

     j

    n

    n

    1

  • 8/13/2019 Image Enhancement II

    36/68

    Example

  • 8/13/2019 Image Enhancement II

    37/68

    Example: cdf

  • 8/13/2019 Image Enhancement II

    38/68

    Example

    Notice that the minimum value (52) is now 0 and the maximum value (154) is now 255.

    Initial Image Image After Equalization

  • 8/13/2019 Image Enhancement II

    39/68

    Example

  • 8/13/2019 Image Enhancement II

    40/68

    Histogram Equalization-Examples

  • 8/13/2019 Image Enhancement II

    41/68

    Histogram Equalization-Examples

  • 8/13/2019 Image Enhancement II

    42/68

  • 8/13/2019 Image Enhancement II

    43/68

    Histogram Equalization-Examples

  • 8/13/2019 Image Enhancement II

    44/68

    Equalisation Transformation Function

       I   m   a   g   e   s   t   a    k   e   n    f   r   o   m   G   o   n   z   a    l   e   z   &   W   o   o    d   s ,   D   i   g   i   t   a    l

       I   m   a   g   e   P   r   o   c   e   s   s   i   n   g    (   2   0   0   2    )

  • 8/13/2019 Image Enhancement II

    45/68

    Histogram Equalization-Examples

  • 8/13/2019 Image Enhancement II

    46/68

    Histogram Equalization-Examples

  • 8/13/2019 Image Enhancement II

    47/68

    Histogram Equalization-Examples

  • 8/13/2019 Image Enhancement II

    48/68

  • 8/13/2019 Image Enhancement II

    49/68

    Edge detection

    S i l Fil i f I Sh i

  • 8/13/2019 Image Enhancement II

    50/68

    Spatial Filtering for Image Sharpening

    Background: to highlight fine detail in an image or toenhance blurred detail

    Applications:  electronic printing, medical imaging, industrialinspection, autonomous target detection (smartweapons)......

    Foundation:

    Blurring/smoothing is performed by spatial averaging(equivalent to integration)

    Sharpening is performed by noting only the gray level

    changes in the image that is the differentiation

    S ti l Filt i f I Sh i

  • 8/13/2019 Image Enhancement II

    51/68

    Spatial Filtering for Image Sharpening

    Operation of Image Differentiation   Enhance edges and discontinuities (magnitude of

    output gray level >>0)

      De-emphasize areas with slowly varying gray-levelvalues (output gray level: 0)

    Mathematical Basis of Filtering for Image Sharpening

      First-order and Second-order Derivatives

      Approximation in Discrete-space Domain

      Implementation by Mask filtering

  • 8/13/2019 Image Enhancement II

    52/68

    1st Derivative

    • The formula for the 1st derivative of a function is as follows:

    • It’s just the difference between subsequent values and

    measures the rate of change of the function

    )()1(   x  f   x  f   x

      f  

  • 8/13/2019 Image Enhancement II

    53/68

    First and Second Order Derivatives

  • 8/13/2019 Image Enhancement II

    54/68

    First and Second Order Derivatives

    l f

  • 8/13/2019 Image Enhancement II

    55/68

    Example for Discrete Derivatives

    Let’s consider a simple 1 dimensional example 

    l f i i i

  • 8/13/2019 Image Enhancement II

    56/68

    Example for Discrete Derivatives

    E l f Di D i i

  • 8/13/2019 Image Enhancement II

    57/68

    Example for Discrete Derivatives

  • 8/13/2019 Image Enhancement II

    58/68

    Various Situations encountered by

    Derivatives• Flat Segment f’=0 and f’’=0 

    • Step f’=0 and f’’=0 

  • 8/13/2019 Image Enhancement II

    59/68

    • Ramp

    •Ramp or step in 1D profile normally characterize an edge in the image

    •f’’ is non-zero on on-set and end of Ramp and produces thin edges

    •f’ is non-zero along whole Ramp and produces thick edges

  • 8/13/2019 Image Enhancement II

    60/68

    • Thin Line

    • Isolated Point

    C i b t f" d f´

  • 8/13/2019 Image Enhancement II

    61/68

    Comparison between f" and f´  

     f´ generally produces thicker edges in an image

     f" has a stronger response to fine detail

     f´ generally has a stronger response to a gray-level step

     f" produces a double response at step changes in gray

    level For image enhancement, f" is generally better suited

    than f´

    Major application of f´ is for edge extraction; f´ used

    together with f" results in impressive enhancement effect

    Appl ing First and 2nd Deri ati e sing 1D

  • 8/13/2019 Image Enhancement II

    62/68

    Applying First and 2nd Derivative using 1D

    Kernel

     E h b 2 d D i i (E l )

  • 8/13/2019 Image Enhancement II

    63/68

    Enhancement by 2nd Derivative (Example)

    L l i f I E h t

  • 8/13/2019 Image Enhancement II

    64/68

    Laplacian for Image Enhancement 

    L l i f I E h t

  • 8/13/2019 Image Enhancement II

    65/68

    Laplacian for Image Enhancement

    Laplacian for Image Enhancement

  • 8/13/2019 Image Enhancement II

    66/68

    Laplacian for Image Enhancement

    Laplacian for Image Enhancement (Example)

  • 8/13/2019 Image Enhancement II

    67/68

    Laplacian for Image Enhancement (Example)

    Laplacian for Image Enhancement (Example)

  • 8/13/2019 Image Enhancement II

    68/68

    Laplacian for Image Enhancement (Example)