unit 3 image enhancement-2

Upload: anirudhpammi

Post on 02-Jun-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Unit 3 Image Enhancement-2

    1/74

    UNIT 3IMAGE ENHANCEMENT

    TextbookDigital Image Processingby Gonzales/Woods

    AcknowledgementsDr. Rolf Lakaemper

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    2/74

    Image ENHANCEMENTin theSPATIAL DOMAINImage ENHANCEMENTin theSPATIAL DOMAIN

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    3/74

    Spatial domain techniques

    Point processing / intensity transformations / gray level transformations> Image Negatives

    > Log Transformations

    > Power

    Law

    Transformations

    > Piecewise Linear Transformation Functions Contrast stretching

    Thresholding Graylevel slicing Bitplane slicing

    Mask processing / spatial filtering

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    4/74

    Image Enhancement (Spatial)

    Image enhancement:

    1. Improving the interpretability or perception of information in images for human viewers

    2. Providing `better' input for other automated image processing techniques

    Spatial domain methods:

    operate directly on pixels Frequency domain methods:

    operate on the Fourier transform of an image

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    5/74

    Point Processing The simplest kind of range transformations are

    these independent of position x,y :g = T(f)

    This is called point processing.

    Important: every pixel for himself spatial

    information completely lost!

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    6/74

    Remember ?

    T transforms the given image f(x,y)into another image g(x,y)

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

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    7/74

    Operation on the set of image-pixels

    6 8 2 0

    12 200 20 10

    3 4 1 0

    6 100 10 5

    Spatial Domain

    (Operator: Div. by 2)

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    8/74

    Operation on the set of neighborhoodsN(x,y) of each pixel

    6 8 2 0

    12 200 20 10

    226

    Spatial Domain

    6 8

    12 200

    (Operator: sum)

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    9/74

    Operation on a set of images f1,f2,

    6 8 2 0

    12 200 20 10

    Spatial Domain

    5 5 1 0

    2 20 3 4

    11 13 3 0

    14 220 23 14

    (Operator: sum)

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    10/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    11/74

    Operation on the set of image-pixels

    Remark: these operations can also be seen as operations on the

    neighborhood of a pixel (x,y), by defining the neighborhood as thepixel itself.

    The easiest case of operators g(x,y) = T(f(x,y)) depends only on the value

    of f at (x,y)

    T is called agray-level or intensity transformation

    function

    Spatial Domain w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    12/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    13/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    14/74

    Basic Gray Level Transformations

    Image Negatives Log Transformations Power Law Transformations Piecewise-Linear Transformation

    FunctionsFor the following slides L denotes the max. possible gray value of the

    image, i.e. f(x,y) [0,L-1]

    Transformations w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    15/74

    Image Negatives: s=L-r-1

    Transformations

    Input gray level

    O u

    t p u

    t g r a y

    l e v e

    l

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    16/74

    Log Transformations:s = c * log (1+ r)

    Transformations w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    17/74

    Log Transformations

    Transformations

    InvLog Log

    w w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w

  • 8/10/2019 Unit 3 Image Enhancement-2

    18/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    19/74

    Why power laws are popular?

    A cathode ray tube (CRT), for example,

    converts a video signal to light in a nonlinear way. The light intensity I is proportional to a power ( ) of the source voltage VS

    For a computer CRT, is about 2.2 Viewing images properly on monitors requires

    correction

    w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    20/74

    Power Law Transformations orGamma Transformationss= cr

    Transformations w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    21/74

    varying gamma ( ) obtains familyof possible transformation curves

    > 1 Compresses dark values

    Expands bright values < 1

    Expands dark values Compresses bright values

    Transformations w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    22/74

    Used for gamma-correction

    Transformations w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    23/74

    Used for general purpose contrast manipulation

    Transformations w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    24/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    25/74

    Piecewise Linear Transformations

    Transformations w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    26/74

    Thresholding Function

    r1=r2 and s1=0 and s2=L-1g(x,y) = L if f(x,y) > t,

    0 elset = threshold level

    Piecewise Linear Transformations

    Input gray level

    O u

    t p u

    t g r a y

    l e v e

    l

    w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    27/74

    Gray Level (Intensity level) Slicing

    Purpose: Highlight a specific range of gray values

    Two approaches:

    1. Display high value for range of interest, low valueelse (discard background)

    2. Display high value for range of interest, originalvalue else (preserve background)

    Piecewise Linear Transformations w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    28/74

    w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    29/74

    Bit-plane Slicing

    Extracts the information of asingle bit-plane

    Piecewise Linear Transformations w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    30/74

    Piecewise Linear Transformations

    BP 7

    BP 5

    BP 0

    w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    31/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    32/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    33/74

    Spatial filters

    Smoothening filters

    Low pass filters Median filters

    Sharpening filters

    High boost filters Derivative filters

    w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    34/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    35/74

    Smoothing linear filters /averaging

    filters / low pass filters (linear filter) Uses

    Blurring Noise reduction

    w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w ww

  • 8/10/2019 Unit 3 Image Enhancement-2

    36/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    37/74

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    38/74

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    39/74

    Order static filter / (non linear

    filter) / median filter Objective:

    Replace the valve of the pixel by the median of the intensity values in the neighbourhood of that pixel

    Principle function: Force points with distinct intensity levels to be more

    like their neighbours

    Uses: Noise reduction

    Less blurring Reduce impulse noise

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    40/74

    Sharpening spatial filters

    Objective:

    High light fine details in an image

    Applications: Electronic printing Medical imaging Industrial inspection Autonomous target detection

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    41/74

    High boost

    filtering

    /High frequency emphasis filter /

    Unsharp masking Principle:

    Subtract an unsharp image from the original image

    Uses:

    Printing industry Publishing industry

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w

  • 8/10/2019 Unit 3 Image Enhancement-2

    42/74

    Process steps:

    1. blur the original image 2. subtract the blurred image from the original

    (the difference is the mask) 3. add the weighted mask to the original

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w wj

  • 8/10/2019 Unit 3 Image Enhancement-2

    43/74

    Derivative filtering

    The derivatives of digital functions are defined

    in terms of differences.

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w wj

  • 8/10/2019 Unit 3 Image Enhancement-2

    44/74

    First derivative:1. Must be zero in areas of constant intensity2. Must be non zero at the onset of an intensity

    step or ramp3. Must be non zero along the ramps

    Second derivative 1. Must be zero in areas of constant intensity2. Must be non zero at the onset and end of an

    intensity step or ramp3. Must be zero along the ramps of constant slope

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w wj

  • 8/10/2019 Unit 3 Image Enhancement-2

    45/74

    Using the first order derivatives for (non

    linear) image

    sharpening

    The

    Gradient

    First derivatives

    in

    image

    processing

    are

    implemented using magnitude of the gradient.

    Uses: Industrial inspection Enhance defects Eliminate slowly changing background features

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w wj

  • 8/10/2019 Unit 3 Image Enhancement-2

    46/74

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w.j

  • 8/10/2019 Unit 3 Image Enhancement-2

    47/74

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w.j

  • 8/10/2019 Unit 3 Image Enhancement-2

    48/74

    Using the second derivatives for (linear) image sharpening The Laplacian

    Uses Highlights intensity discontinuities in an image Deemphasizes regions with slowly varying intensity

    levels.

    . j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    S ti l Filt i g w w w .j

  • 8/10/2019 Unit 3 Image Enhancement-2

    49/74

    Spatial Filtering

    Different variants of the Laplacian

    j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w .j

  • 8/10/2019 Unit 3 Image Enhancement-2

    50/74

    Histogram processing

    j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w .jn

  • 8/10/2019 Unit 3 Image Enhancement-2

    51/74

    Histogram processing

    Histogram equalization Histogram matching / specification

    j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histograms w w w .jn

  • 8/10/2019 Unit 3 Image Enhancement-2

    52/74

    Histograms

    Remember:The histogram shows the number of

    pixels having a certain gray-value

    n u m

    b e r o

    f p

    i x e

    l s

    Gray-value (0..1)

    j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histograms w w w . j n

  • 8/10/2019 Unit 3 Image Enhancement-2

    53/74

    Histograms

    The NORMALIZED histogram is thehistogram divided by the total number

    of pixels in the source image.

    The sum of all values in the normalizedhistogram is 1.

    The value given by the normalizedhistogram for a certain gray value canbe read as the probability of randomlypicking a pixel having that gray value

    j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histograms w w w . j n

  • 8/10/2019 Unit 3 Image Enhancement-2

    54/74

    Histograms

    What can the (normalized)

    histogram tell about theimage ?

    j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histograms w w w . j n

  • 8/10/2019 Unit 3 Image Enhancement-2

    55/74

    Histograms

    1. The MEAN VALUE (or average graylevel)

    M = g g h(g)1*0.3+2*0.1+3*0.2+4*0.1+5*0.2+6*0.1=

    2.60.30.20.1

    0.01 2 3 4 5 6

    j n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histograms w w w . j n

  • 8/10/2019 Unit 3 Image Enhancement-2

    56/74

    Histograms

    The MEAN value is the average grayvalue of the image, the overall

    brightness appearance.

    n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histograms w w w . j n

  • 8/10/2019 Unit 3 Image Enhancement-2

    57/74

    Histograms

    2. The VARIANCE

    V = g (g-M) 2 h(g)

    (with M = mean)or similar:

    The STANDARD DEVIATION

    D = sqrt(V)

    n t u w or l d . c o m

    w w w .j n t u w or l d . c o m

  • 8/10/2019 Unit 3 Image Enhancement-2

    58/74

    Histograms w w w . j nt

  • 8/10/2019 Unit 3 Image Enhancement-2

    59/74

    Histograms

    The STANDARD DEVIATION is a valueon the gray level axis, showing theaverage distance of all pixels to themean

    0.30.20.1

    0.0

    0.30.20.10.0

    D1 > D2

    t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histograms w w w . j nt

  • 8/10/2019 Unit 3 Image Enhancement-2

    60/74

    Histograms

    VARIANCE and STANDARD DEVIATIONof the histogram tell us about theaverage contrast of the image !

    The higher the VARIANCE (=the higherthe STANDARD DEVIATION), thehigher the images contrast !

    t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    I Hi t w w w . j nt

  • 8/10/2019 Unit 3 Image Enhancement-2

    61/74

    Image Histograms

    x axis values of intensities rky axis h(rk) or p(rk)

    t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w . j nt

  • 8/10/2019 Unit 3 Image Enhancement-2

    62/74

    Histogram equalization t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    In probability theory , a probability density function (abbreviated as w w w . j nt

    http://en.wikipedia.org/wiki/Probability_theoryhttp://en.wikipedia.org/wiki/Probability_theoryhttp://en.wikipedia.org/wiki/Probability_theoryhttp://en.wikipedia.org/wiki/Probability_theory
  • 8/10/2019 Unit 3 Image Enhancement-2

    63/74

    In probability theory , a probability density function (abbreviated aspdf , or just density ) of a continuous random variable is a function

    that describes

    the

    relative

    likelihood

    for

    this

    random

    variable

    to

    occur at a given point in the observation space. The probability of a random variable falling within a given set is given by the integral of its density over the set.

    A random variable X has density , where is a non negative

    Hence, if F is the cumulative distribution function of X , then:

    The probability density function (PDF) of a continuous distribution is

    defined as the derivative of the cumulative distribution function [source : wikipedia]

    t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histograms w w w . j nt

    http://en.wikipedia.org/wiki/Probability_theoryhttp://en.wikipedia.org/wiki/Probability_theoryhttp://en.wikipedia.org/wiki/Probability_theoryhttp://en.wikipedia.org/wiki/Random_variablehttp://en.wikipedia.org/wiki/Random_variablehttp://en.wikipedia.org/wiki/Random_variablehttp://en.wikipedia.org/wiki/Random_variablehttp://en.wikipedia.org/wiki/Random_variablehttp://en.wikipedia.org/wiki/Random_variablehttp://en.wikipedia.org/wiki/Cumulative_distribution_functionhttp://en.wikipedia.org/wiki/Cumulative_distribution_functionhttp://en.wikipedia.org/wiki/Cumulative_distribution_functionhttp://en.wikipedia.org/wiki/Cumulative_distribution_functionhttp://en.wikipedia.org/wiki/Cumulative_distribution_functionhttp://en.wikipedia.org/wiki/Cumulative_distribution_functionhttp://en.wikipedia.org/wiki/Random_variablehttp://en.wikipedia.org/wiki/Random_variablehttp://en.wikipedia.org/wiki/Probability_theory
  • 8/10/2019 Unit 3 Image Enhancement-2

    64/74

    g

    Histogram Equalization:

    Preprocessing technique toenhance contrast in natural

    images Target: find gray leveltransformation function T totransform image f such that thehistogram of T(f) is equalized

    t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w . j ntu

  • 8/10/2019 Unit 3 Image Enhancement-2

    65/74

    Histogram Equalization (Idea)

    Idea: apply a monotone transform resulting in an approximately uniform histogram

    t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histogram Equalization w w w . j ntu

  • 8/10/2019 Unit 3 Image Enhancement-2

    66/74

    g q

    Example:

    We are looking for

    this transformation !

    T

    t u w or l d . c o m

    w w w .j n t u w or l d . c o m

    w w w . j n t u

  • 8/10/2019 Unit 3 Image Enhancement-2

    67/74

    u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histogram Equalization w w w . j n t u

  • 8/10/2019 Unit 3 Image Enhancement-2

    68/74

    g q

    Discrete:

    g1 is mapped to the (normalized)

    number of pixels havinggray-values 0..g1 .

    u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histogram Equalization w w w . j n t u

  • 8/10/2019 Unit 3 Image Enhancement-2

    69/74

    Histogram Equalization u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Histogram matching or w w w . j n t u

  • 8/10/2019 Unit 3 Image Enhancement-2

    70/74

    Histogram matching or

    Histogram specification

    u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Chapter 3

    w w w . j n t u

  • 8/10/2019 Unit 3 Image Enhancement-2

    71/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    u w or l d . c o m

    w w w .j n t u w or l d . c o m

    Chapter 3

    w w w . j n t u

  • 8/10/2019 Unit 3 Image Enhancement-2

    72/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w or l d . c o m

    w w w .j n t u w or l d . c o m

    Chapter 3

    w w w . j n t u

  • 8/10/2019 Unit 3 Image Enhancement-2

    73/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w or l d . c o m

    w w w .j n t u w or l d . c o m

    Chapter 3

    w w w . j n t uw

  • 8/10/2019 Unit 3 Image Enhancement-2

    74/74

    Chapter 3Image Enhancement in the

    Spatial Domain

    w or l d . c o m

    w w w .j n t u w or l d . c o m