dip class3image enhancement

Upload: chitra-manickam

Post on 14-Apr-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Dip Class3Image Enhancement

    1/194

    05/25/13 1

    IMAGE ENHANCEMENT

  • 7/30/2019 Dip Class3Image Enhancement

    2/194

    What Is ImageEnhancement?

    Image enhancement is the process ofmaking images more useful

    The reasons for doing this include: Highlighting interesting detail in images

    Removing noise from images

    Making images more visually appealing

  • 7/30/2019 Dip Class3Image Enhancement

    3/194

    Image Enhancement

    Accentuation, or sharpening of imagefeatures such as edges, boundaries, orcontrast

    Does not increase the inherent information Component in the data

    In general, image enhancement is used togenerate a visually desirable image.

    It can be used as a preprocess or apostprocess.

    Highly application dependent. A technique thatworks for one application may not work foranother.

    05/25/13 3

  • 7/30/2019 Dip Class3Image Enhancement

    4/194

    Image Enhancement

  • 7/30/2019 Dip Class3Image Enhancement

    5/194

    5

    Image Enhancement(Contd)

    The image enhancement methods arebased on either spatial or frequencydomain techniques

    spatial domain approaches : directmanipulation of pixel in an image

    frequency domain approach : modify the

    Fourier transform of an image

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    6/194

    6

    Spatial Domain Method

    Image processing function maybe expressed as

    f(x, y): input image

    g(x, y): processed image T: operator on fdefined oversome neighbor of (x, y)

    Neighborhood shape : square orrectangular arrays are the most

    predominant due to the ease ofimplementation mask processing / filtering

    masks( filters, windows,templates)

    e.g. Image sharpening

    A 3x3 neighborhood about a

    point (x, y) in an image

    )],([),( yxfTyxg =

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    7/194

    7

    Spatial Domain Method

    Simplest form ofT: neighbor gdepends only on the value offat (x,y) T: gray-level transformation function

    s = T(r)(r,s are variables denoting the gray level of f(x, y) and g(x,y) at any point(x, y) )

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    8/194

    8

    Frequency DomainMethod

    Convolution theoremg x y h x y f x y( , ) ( , ) ( , )=

    G u v H u v F u v( , ) ( , ) ( , )=

    H u v( , ): transfer function, optical transfer function

    Visually, f(x, y) is given and the goal, after computation

    ofF(u, v), is to select H(u, v) so that the desired image

    [ ]g x y H u v F u v( , ) ( , ) ( , )= F 1.

    exhibits some highlighted feature off(x, y)

    where G, H, and Fare the Fourier transforms ofg, h, and f

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    9/194

    Image Enhancement Techniques

    Point

    operation

    Mask

    operation TransformoperationColoringoperation

    Image NegativeContrast

    Stretching

    Compression ofdynamic range

    Gray level slicing

    Image

    Subtraction

    Image Averaging

    Histogramoperations

    Smoothing

    operations

    Median

    Filtering Sharpening

    operations

    Derivative

    operations

    Histogram

    operations

    Low pass

    filtering

    High pass

    Filtering Band pass

    filtering

    Homomorphic

    filtering

    Histogramoperations

    False

    coloring

    Full colorprocessing

  • 7/30/2019 Dip Class3Image Enhancement

    10/194

    10

    Image enhancement

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    11/194

    Types of ImageEnhancement

    There are three types of imageenhancement techniques:

    Point operations: each pixel is modifiedaccording to a particular equation,independent of the other pixels.

    Mask operations: each pixel is modified

    according to the values of the pixelsneighbors.

    Global operations: all the pixel values in theimage or subimage are taken into

    consideration.05/25/13 11

  • 7/30/2019 Dip Class3Image Enhancement

    12/194

    Point Operations

    ( )v f u=

    Point operations are zero memory operations

    where a given gray level u [0,L] is mapped into a

    gray level v [0, L] according to a transformation

    1.Contrast Stretching

    2.Clipping and Thresholding

    3. Digital Negative4. Intensity Level Slicing

    5. Bit plane slicing

    6. Log Transformation

    7. Power Law Transformation05/25/13 12

  • 7/30/2019 Dip Class3Image Enhancement

    13/194

    13

    Contrast stretching

    Increase the dynamicrange of the gray levels inthe image

    Before the stretching can

    be performed it isnecessary to specify theupper and lower pixelvalue limits over which

    the image is to benormalized.

    Often these limits willjust be the minimum andmaximum pixel valuesthat the image type05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    14/194

    14

    Contrast stretching

    Call the lower and the upper limits a and brespectively. Scans the image to find the lowestand highest pixel values currently present in theimage. Call these c and d. Then each pixel P is

    scaled using the following function:

    Values below 0 are set to 0 and values about 255

    are set to 255

    acd

    abcPP inout += ))((

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    15/194

    15

    After contrast stretching, using a simple linear interpolation

    between c = 79 and d = 136

    This result is a significant improvement over the original, the

    enhanced image itself still appears somewhat flat.

    Source image

    Its histogram

  • 7/30/2019 Dip Class3Image Enhancement

    16/194

    16

    Otherwise,we canachieve better resultsby contrast stretchingthe image over a more

    narrow range ofgraylevel values fromthe original image

    For example, by setting

    the cutoff fractionparameter to 0.03, weobtain the contrast-stretched image

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    17/194

    17

    Setting the cutofffraction to a highervalue, e.g.0.125,yields the contrast

    stretched image

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    18/194

    Contrast Stretching

    ( )

    0

    a

    ( ) b

    a

    b

    u u a

    v u a v u b

    u b v u L

    = +

    +

    p

    p

    p

    The gray scale intervals where pixels occur most frequentlywould be stretched to improve the overall visibility of a scene

    05/25/13 18

  • 7/30/2019 Dip Class3Image Enhancement

    19/194

    Contrast Stretching

    05/25/13 19

  • 7/30/2019 Dip Class3Image Enhancement

    20/194

    Contrast Stretching

    05/25/13 20

  • 7/30/2019 Dip Class3Image Enhancement

    21/194

    05/25/13 21

  • 7/30/2019 Dip Class3Image Enhancement

    22/194

    Clipping andThresholding

    Clipping-

    This is useful for noise reduction when theinput signal is known to lie in the range

    [a,b]A special case of contrast stretchingwhere 0 = =

    Thresholding

    A special case of clipping

    { 1 u T

    0 u T

    v L=

    p

    05/25/13 22

  • 7/30/2019 Dip Class3Image Enhancement

    23/194

    23

    Thresholding

    Separate out the regions of the imagecorresponding to objects in which we areinterested, from the regions of the image thatcorrespond to background

    perform this segmentation on the basis of thedifferent intensities or colors in the foreground andbackground regions of an image

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    24/194

    24

    A) shows a classic bi-modal intensity distribution.

    This image can be successfully segmented usinga single threshold T1. B) is slightly morecomplicated. Here we suppose the central peakrepresents the objects we are interested in and sothreshold segmentation requires two thresholds:

    T1 and T2. In C), the two peaks of a bi-modaldistribution have run together and so it is almostcertainly not possible to successfully segmentthis image using a single global threshold

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    25/194

    25

    using a single threshold at

    a pixel intensity value of 120

    Input

    Output

  • 7/30/2019 Dip Class3Image Enhancement

    26/194

    Thresholding

    05/25/13 26

  • 7/30/2019 Dip Class3Image Enhancement

    27/194

    27

    Adaptive Thresholding

    Whereas the conventionalthresholding operator uses a globalthreshold for all pixels, adaptive

    thresholding changes the thresholddynamically over the image

    This more sophisticated version of

    thresholding can accommodatechanging lighting conditions in theimage, e.g. those occurring as a

    result of a strong illumination05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    28/194

    28

    Adaptive Thresholding

    For each pixel in the image, a thresholdhas to be calculated. If the pixel valueis below the threshold it is set to the

    background value, otherwise itassumes the foreground value

    Two main approaches to finding the

    threshold: the Chow and Kaneko approach

    local thresholding

    Assumptions: smaller image regions are morelikely to have approximately uniform illumination,05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    29/194

    29

    Adaptive Thresholding

    For each pixel in the image, a thresholdhas to be calculated. If the pixel valueis below the threshold it is set to the

    background value, otherwise itassumes the foreground value

    Two main approaches to finding the

    threshold: the Chow and Kaneko approach

    local thresholding

    Assumptions: smaller image regions are morelikely to have approximately uniform illumination,05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    30/194

    30

    Chow and Kanekoapproach

    Divide an image into an array ofoverlapping subimages and then findthe optimum threshold for each

    subimage by investigating itshistogram

    The threshold for each single pixel is

    found by interpolating the results ofthe subimages

    The drawback of this method is that

    it is computational expensive and,05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    31/194

    31

    Local Thresholding

    Finding the local threshold is to statisticallyexamine the intensity values of the localneighborhood of each pixel

    The statistic which is most appropriate depends

    largely on the input image. Simple and fastfunctions include the meanof the local intensitydistribution,

    the median value,

    or the mean of the minimum and maximum

    values,

    meanT=

    medianT

    =

    2

    maxmin+=T

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    32/194

    32

    Image contains a

    strong illuminationgradient, global

    thresholding produces

    a very poor result

    Source Image

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    33/194

    33

    Using the mean of a 77neighborhood, adaptive

    thresholding

    However, the mean of thelocal area is not suitable

    as a threshold,because the

    range of intensity values

    within a local neighborhood

    is very small and theirmean

    is close to the value of the

    center pixel

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    34/194

  • 7/30/2019 Dip Class3Image Enhancement

    35/194

    35

    The larger window yields the poorer result,

    because it is more adversely affected by theillumination gradient

    Mean, a 77

    neighborhood

    and C=7

    Mean, a 7575

    neighborhood

    and C=10

    Median, a 77

    neighborhood

    and C = 405/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    36/194

    36

    How to choose a thresholdvalue?

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    37/194

    37

    Image negatives

    Display medicalimages

    and photographing ascreen with

    monochrome positivefilm

    Reverse the orderfrom black to white so

    that the intensity ofthe output imagedecreases as theintensity of the input

    increases

    L is the number of gray levels,r and N denote the input and

    output gray levels

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    38/194

    Digital Negative

    Applications:

    display of medical images

    produce negative prints of images

    05/25/13 38

  • 7/30/2019 Dip Class3Image Enhancement

    39/194

    39

    an image its negative

  • 7/30/2019 Dip Class3Image Enhancement

    40/194

    Digital Negative

    Original Image Negative Image

    05/25/13 40

    G /I i l l

  • 7/30/2019 Dip Class3Image Enhancement

    41/194

    41

    Gray/Intensity-levelslicing

    Highlighting a specific range of graylevels is often desired

    Various way to accomplish this Highlight some range and reduce all others

    to a constant level

    Highlight some range but preserve all otherlevels

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    42/194

    Intensity Level Slicing

    , a0 otherwiseL u bv =

    Without Background

    , a

    u otherwise

    L u bv

    =

    With Background

    05/25/13 42

  • 7/30/2019 Dip Class3Image Enhancement

    43/194

    43

    Intensity-level slicing:

    (a) a transformation function that highlights a range [A, B] of intensities whilediminishing all others to a constant ,low level

    (b) a transformation that highlights a range [A, B] of intensities but preserves all others

    (c) Original image

    (d) result of using the transformation in (a)

    These transformations permits segmentation of certain gray level regions from

    the rest of the image

    a)

    d)c)

    b)

  • 7/30/2019 Dip Class3Image Enhancement

    44/194

    44

    Examples of display transfer functions

    Manipulation of the grey scale transfer function:

    a) an original, moderately low-contrast transmission light microscope image

    (prepared slide of a head louse)

    b) expanded linear transfer function adjusted to the minimum and maximumbrightness values

    c) positive gamma (log) function

    d) negative gamma (log) function

    e) negative linear transferfunction

    f) nonlinear transfer function (high slope linear contrast over central portion of

    brightness range, with negative slope or solarization for dark and bright portions)

  • 7/30/2019 Dip Class3Image Enhancement

    45/194

    45

    Bit-plane slicing

    Highlighting the contribution madeto the total image appearance byspecific bits

    Higher-order :The majority of the visually significant data

    Lower-order :

    Subtle details

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    46/194

    Bit Extraction

    05/25/13 46

  • 7/30/2019 Dip Class3Image Enhancement

    47/194

    47

    Bit-plane slicing

    3 2

    1 0

    7 6

    5 4

    Original image

  • 7/30/2019 Dip Class3Image Enhancement

    48/194

    48

    Bit-plane slicing

    Plane 7 containsthe mostsignificant bits,

    and plane 0contains theleast significant

    bits of the pixelsin the originalimage 012

    345

    67

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    49/194

    Log Transformation

    Fourier Spectrum Log Transformed image

    ( )10log 1v c u= +

    05/25/13 49

  • 7/30/2019 Dip Class3Image Enhancement

    50/194

  • 7/30/2019 Dip Class3Image Enhancement

    51/194

    Gamma Correction

    A variety of devices used for imagecapture, printing, and displayrespond according to a power law.

    By convention, the exponent in thepower-law equation is referred to asgamma

    The process used to correct thispower-law response phenomena iscalled gamma correction.

    05/25/13 51

  • 7/30/2019 Dip Class3Image Enhancement

    52/194

    Example

    cathode ray tube (CRT) devices havean intensity-to-voltage response thatis a power function, with exponents

    varying from approximately 1.8 to2.5

    With reference to the curve for g=2.5

    wesee that such display systems would

    tend to produce images that are

    darker05/25/13 52

  • 7/30/2019 Dip Class3Image Enhancement

    53/194

    Gamma Correction

    05/25/13 53

  • 7/30/2019 Dip Class3Image Enhancement

    54/194

    05/25/13 54

  • 7/30/2019 Dip Class3Image Enhancement

    55/194

    55

    What is a histogram?

    A graph indicating the number of times each graylevel occurs in the image, i.e. frequency of thebrightness value in the image

    The histogram of an image with L gray levels isrepresented by a one-dimensional array with L

    elements Algorithm:

    Assign zero values to all

    elements of the array hf;

    For all pixels (x,y) of the

    image f, increment

    hf[f(x,y)] by 1.

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    56/194

    Histogram Processing

    Histogram of a digital image withgray levels in the range [0,L-1] is adiscrete function

    h(rh(rkk) = n) = nkkwherer

    k: the kth gray level

    nk : the number of pixels in the imagehaving gray level r

    k

    h(rk) : histogram of a digital image with

    gray levels rk

    05/25/13 56

  • 7/30/2019 Dip Class3Image Enhancement

    57/194

    Normalized Histogram

    dividing each of histogram at graylevel rr

    kkby the total number of

    pixels in the image, nn

    p(rp(rkk) = n) = nkk/ n/ nfor k = 0,1,,L-1

    p(rp(rkk)) gives an estimate of the

    probability of occurrence of graylevel rr

    kk

    The sum of all components of a

    normalized histogram is equal to 105/25/13 57

  • 7/30/2019 Dip Class3Image Enhancement

    58/194

    Histogram

    An image histogram is a plot of the gray-level frequencies.

    05/25/13 58

  • 7/30/2019 Dip Class3Image Enhancement

    59/194

    Image Histogram

    05/25/13 59

    Properties of Image

  • 7/30/2019 Dip Class3Image Enhancement

    60/194

    Properties of ImageHistogram

    Histograms with small spread correspond to lowcontrast images (i.e., mostly dark, mostly bright,or mostly gray).

    Histograms with wide spread correspond to high

    contrast images.

    05/25/13 60

    Properties of Image

  • 7/30/2019 Dip Class3Image Enhancement

    61/194

    Properties of ImageHistogram

    Histograms clustered at the low end correspond to

    dark images.Histograms clustered at the high end correspond to

    bright images.

    05/25/13 61

  • 7/30/2019 Dip Class3Image Enhancement

    62/194

    Example

    Dark Image

    Components of

    histogram are

    concentrated on

    the low side of thegray scale.

    Bright Image

    Components of

    histogram areconcentrated on the

    high side of the

    gray scale.

    05/25/13 62

  • 7/30/2019 Dip Class3Image Enhancement

    63/194

    Example

    Low contrast image

    histogram is narrow and

    centered toward the

    middle of the gray scale

    High contrast image

    histogram covers broad

    range of the gray scale

    and the distribution of

    pixels is not too far from

    uniform, with very fewvertical lines being much

    higher than the others

    05/25/13 63

  • 7/30/2019 Dip Class3Image Enhancement

    64/194

    64

    Histogram Processing

    Histogramscorresponding to fourbasic image types

    Dark image

    Bright image

    Low-contrast image

    High-contrast image05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    65/194

    65

    Histogram equalization

    Goal: to produce an image withequally distributed brightness levelsover the whole brightness scale

    Effect: enhancing contrast forbrightness values close to histogrammaxima, and decreasing contrast near

    minima. Result is better than just stretching,

    and method is fully automatic

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    66/194

  • 7/30/2019 Dip Class3Image Enhancement

    67/194

    Histogram Equalization

    Let us assume for the moment that the input image to beenhanced has continuous gray values, with r= 0 representing

    black and r= 1 representing white.

    We need to design a gray value transformation s = T(r), basedon the histogram of the input image, which will enhance the

    image.

    he histogram equalization is an approach to enhance a given image.

    The approach is to design a transformation T(.) such that the gray

    values in the output is uniformly distributed in [0, 1].

    05/25/13 67

    As before we assume that:

  • 7/30/2019 Dip Class3Image Enhancement

    68/194

    As before, we assume that:

    (1) T(r) is a monotonically increasing function for 0 r

    1 (preserves order from black to white).

    (2) T(r) maps [0,1] into [0,1] (preserves the range of allowed

    Gray values).

    05/25/13 68

    f ( )

  • 7/30/2019 Dip Class3Image Enhancement

    69/194

    Let us denote the inverse transformation by r= T-1(s) . We

    assume that the inverse transformation also satisfies the above

    two conditions.

    We consider the gray values in the input image and output

    image as random variables in the interval [0, 1].

    Letpin(r) and pout(s)denote the probability density of the

    Gray values in the input and output images.

    05/25/13 69

    If ( ) d T( ) k d T 1( ) ti fi diti 1

  • 7/30/2019 Dip Class3Image Enhancement

    70/194

    If pin(r) and T(r) are known, and r= T-1(s) satisfies condition 1, we can

    write (result from probability theory):

    )(1

    )()(sTr

    inoutdsdrrpsp

    =

    =

    One way to enhance the image is to design a transformation

    T(.) such that the gray values in the output is uniformly

    distributed in [0, 1], i.e.pout(s) = 1, 0 s 1

    In terms of histograms, the output image will have all

    gray values in equal proportion .

    This technique is called histogram equalization.

    05/25/13 70

  • 7/30/2019 Dip Class3Image Enhancement

    71/194

    Equalization

    05/25/13 71

    N t d i th l i th t t i if l

  • 7/30/2019 Dip Class3Image Enhancement

    72/194

    Consider the transformation

    10)()( ,0

    == rdwwprTsr

    in

    Note that this is the cumulative distribution function (CDF) ofpin

    (r)

    and satisfies the previous two conditions.

    From the previous equation and using the fundamental

    theorem of calculus,

    )(rpdr

    dsin=

    Next we derive the gray values in the output is uniformly

    distributed in [0, 1].

    1)()( =

    =

    ds

    drrpsp inout

    05/25/13 72

    Th f th t t hi t i i b

  • 7/30/2019 Dip Class3Image Enhancement

    73/194

    Therefore, the output histogram is given by

    [ ] 10,11)(

    1)()(

    )()(

    1

    1

    ==

    =

    ==

    srp

    rpspsTr

    sTrininout

    The output probability density function is uniform, regardless of

    the input.

    Thus, using a transformation function equal to the CDF of input

    gray values r, we can obtain an image with uniform gray values.

    This usually results in an enhanced image, with an increase inthe dynamic range of pixel values.

    05/25/13 73

    H t i l t hi t

  • 7/30/2019 Dip Class3Image Enhancement

    74/194

    Step 1:For images with discrete gray values, compute:

    n

    nrp kkin =)( 10 kr 10 Lk

    L: Total number of gray levels

    nk: Number of pixels with gray value rk

    n: Total number of pixels in the image

    Step 2: Based on CDF, compute the discrete version of the previous

    transformation :

    =

    ==k

    j

    jinkk rprTs0

    )()( 10 Lk

    How to implement histogramequalization?

    05/25/13 74

    Example: ==k

    jinkk rprTs )()( 10 Lk

  • 7/30/2019 Dip Class3Image Enhancement

    75/194

    Consider an 8-level 64 x 64 image with gray values (0, 1, ,7). The

    normalized gray values are (0, 1/7, 2/7, , 1). The normalized

    histogram is given below:

    NB: The gray values in output are also (0, 1/7, 2/7, , 1).

    =j 0

    05/25/13 75

  • 7/30/2019 Dip Class3Image Enhancement

    76/194

    Gray value

    # pixels

    Normalized gray value

    Fraction of

    # pixels

    05/25/13 76

    Applying the transformation, ==k

    jinkk rprTs )()( we have

  • 7/30/2019 Dip Class3Image Enhancement

    77/194

    =j

    jinkk p0

    )()(

    05/25/13 77

  • 7/30/2019 Dip Class3Image Enhancement

    78/194

    05/25/13 78

    Notice that there are only five distinct gray levels (1/7

  • 7/30/2019 Dip Class3Image Enhancement

    79/194

    Notice that there are only five distinct gray levels --- (1/7,

    3/7,5/7, 6/7, 1) in the output image. We will relabel them

    as (s0,s1, , s4 ).

    With this transformation, the output image will have

    histogram

    05/25/13 79

    Histogram of output

  • 7/30/2019 Dip Class3Image Enhancement

    80/194

    Histogram of output

    image

    # pixels

    Gray values

    Note that the histogram of output image is only approximately, and not exactly,

    uniform. This should not be surprising, since there is no result that claims

    uniformity in the discrete case.

    05/25/13 80

    Example Original image and its histogram

  • 7/30/2019 Dip Class3Image Enhancement

    81/194

    05/25/13 81

    Histogram equalized image and its histogram

  • 7/30/2019 Dip Class3Image Enhancement

    82/194

    Histogram equalized image and its histogram

    05/25/13 82

    Comments:

    Histogram equalization may not always produce desirable

  • 7/30/2019 Dip Class3Image Enhancement

    83/194

    Histogram equalization may not always produce desirable

    results, particularly if the given histogram is very narrow. It

    can produce false edges and regions. It can also increase

    image graininess and patchiness.

    05/25/13 83

  • 7/30/2019 Dip Class3Image Enhancement

    84/194

    05/25/13 84

    Hi t E li ti

  • 7/30/2019 Dip Class3Image Enhancement

    85/194

    Histogram Equalization

    Form the cumulative histogram

    Normalize the value by dividing it bythe total number of pixels

    Multiply these values by themaximum gray level value and roundoff the value

    Map the original value to the result ofstep 3 by a one-one correspondence

    05/25/13 85

    Histogram (Matching)

  • 7/30/2019 Dip Class3Image Enhancement

    86/194

    Histogram (Matching)Specification

    Histogram equalization has adisadvantage which is that it cangenerates only one type of outputimage.

    With Histogram Specification, we canspecify the shape of the histogram thatwe wish the output image to have.

    It doesnt have to be a uniformhistogram05/25/13 86

    Histogram specification /

  • 7/30/2019 Dip Class3Image Enhancement

    87/194

    87

    Histogram specification /matching

    Motivation: Sometimes, the ability to specify particular

    histogram shapes capable of highlightingcertain gray-level ranges in an image is

    desirable

    The aim is to produce an image withdesired distributed brightness levels

    over the whole brightness scale, asopposed to uniform distribution

    05/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    88/194

    88

    Histogram specification)(rp

    r :The original probability density function: The desired probability density function)(zpz

  • 7/30/2019 Dip Class3Image Enhancement

    89/194

    8905/25/13

  • 7/30/2019 Dip Class3Image Enhancement

    90/194

    90

    Example

    Illustration of the histogram specification method:

    (a)original image; (b)image after histogram equalization;

    (c)image enhanced by histogram specification; (d)histograms

    (a) (b)

    (c) (d)

    original

    equalized

    specified

    resulting

    Histogram Specification

  • 7/30/2019 Dip Class3Image Enhancement

    91/194

    Histogram Specification

    Find the mapping table of thehistogram equalization

    Specify the desired histogram.

    Equalize the desired histogram Perform the mapping process so that

    the values of step 1 can be mapped

    to the results of step 2.

    05/25/13 91

    Local enhancement

  • 7/30/2019 Dip Class3Image Enhancement

    92/194

    92

    Local enhancement Motivation:

    To enhance details over small areas in an image

    The computation of a global transformation does notguarantee the desired local enhancement

    Solution:

    Define a square / rectangular neighborhood Move the center of this area from pixel to pixel

    Histogram equalization in each neighborhood region

    05/25/13

    Image Subtraction

  • 7/30/2019 Dip Class3Image Enhancement

    93/194

    93

    Image SubtractionThe difference between two imagesf(x, y) and h(x, y), expressed as

    h(x, y) : mask - an x-ray image of a region of a

    patients body

    f(x, y) : image of the same anatomical region butacquired after injection of a dye into thebloodstream

    ),(),(),( yxhyxfyxg =

    (a) mask image

    (b) image (after injectionof dye into the bloodstream)

    with mask subtracted out

    05/25/13

    l

  • 7/30/2019 Dip Class3Image Enhancement

    94/194

    94

    Example

    Showing image differences by subtraction:

    a) original image; b) image after moving one coin; c) difference image after pixel-by pixel subtraction

    Different images for quality control. A master image is subtracted from

    images of each subsequent part. In this example, the missing chip in a printed

    circuit board is evident in the difference image

    Applications of ImageSubtraction and change

  • 7/30/2019 Dip Class3Image Enhancement

    95/194

    Subtraction and changedetection

    Medical imaging application : displayblood-flow paths

    Automated inspection of printed

    circuits Security monitoring

    05/25/13 95

  • 7/30/2019 Dip Class3Image Enhancement

    96/194

    96

    Two frames from a videotape sequence of free-swimming

    single-celled animals in a drop of pond water , and the

    difference image. The length of the white region divided bythe time interval gives the velocity

    Analysis of motion in a more complex

    situation than shown in fig. Where the

    paths of the swimming microorganisms

    cross, they are sorted out by assuming

    that the path continues in a nearly

    straight direction. (Gualtieri &Coltelli,

    1992)05/25/13

    Image Averaging

  • 7/30/2019 Dip Class3Image Enhancement

    97/194

    97

    Image Averaging

    Motivation: Imaging with very low light levels is

    routine, causing sensor noise frequently

    to render single images virtually uselessfor analysis

    Solution: image averaging

    05/25/13

    Image Averaging

  • 7/30/2019 Dip Class3Image Enhancement

    98/194

    98

    Image Averaging

    Noisy image g(x, y)=noise image

    f(x, y)=original image

    n(x, y)=noise

    Assumption: at every pair of coordinates (x, y), thenoise is uncorrelated & has zero average value

    uncorrelated: covariance

    If an image is formed by averaging K

    different noisy images

    ),(),(),( yxnyxfyxg +=

    0)])([( = jjii mxmxE),( yxg

    { }

    2

    ),(

    2

    ),(

    1

    1

    ),(),(

    ),(1),(

    yxnyxg

    K

    i

    i

    K

    yxfyxgE

    yxgK

    yxg

    =

    =

    = =

    As K increases: the variability

    (noise) of the pixel values at

    each location (x,y) decreases

    05/25/13

    Example

  • 7/30/2019 Dip Class3Image Enhancement

    99/194

    99

    Example

    05/25/13

    Spatial Filtering

  • 7/30/2019 Dip Class3Image Enhancement

    100/194

    p g-Contents

    What is spatial filtering?

    Smoothing Spatial filters.

    Sharpening Spatial Filters.

    Combining Spatial EnhancementMethods

    05/25/13 100

  • 7/30/2019 Dip Class3Image Enhancement

    101/194

    Mask Operation

    Linear systems and linear filtering

    Smoothing operations

    Median Filtering

    Sharpening operations

    Derivative operations

    Correlation

    05/25/13 101

    Neighbourhood

  • 7/30/2019 Dip Class3Image Enhancement

    102/194

    Operations

    Neighbourhood operations simplyoperate on a larger neighbourhood ofpixels than point operations

    Neighbourhoods aremostly a rectanglearound a central pixel

    Any size rectangleand any shape filterare possible

    Origin x

    y Image f (x, y)

    (x, y)Neighbourhood

    05/25/13 102

    Neighbourhood

  • 7/30/2019 Dip Class3Image Enhancement

    103/194

    Operations

    For each pixel in the origin image, theoutcome is written on the samelocation at the target image.

    Origin x

    y Image f (x, y)

    (x, y)

    Neighbourhood

    TargetOrigin

    05/25/13 103

    Simple Neighbourhood

  • 7/30/2019 Dip Class3Image Enhancement

    104/194

    Operations

    Simple neighbourhood operationsexample:

    Min: Set the pixel value to the minimumin the neighbourhood

    Max: Set the pixel value to the

    maximum in the neighbourhood

    05/25/13 104

    Image Enhancement:

    S ti l Filt i

  • 7/30/2019 Dip Class3Image Enhancement

    105/194

    Spatial Filtering Image enhancement in the spatial domain can be represented

    as:

    [ ] ),(),( nmfTnmg =

    Enhanced Image TransformationGiven Image

    The transformation Tmaybe linear or nonlinear. We will mainly study linear

    operators Tbut will see one important nonlinear operation.

    There are two closely related concepts that must be understood when

    performing linear spatial filtering. One is correlation, the other is convolution.

    05/25/13 105

    How to specify T

  • 7/30/2019 Dip Class3Image Enhancement

    106/194

    If the operatorTis linear and shift invariant (LSI), characterized by

    the point-spread sequence (PSS) h(m, n), then (recall convolution)

    =

    =

    =

    =

    =

    =

    =

    l k

    l k

    lkhlnkmf

    lkflnkmh

    nmfnmhnmg

    ),(),(

    ),(),(

    ),(),(),(

    In practice, to reduce computations, h( n , m )is of finite extent:

    where is a small set (called neighborhood). is also called as the support

    of h.

    h( n , m ) =0, for (k,l)

    05/25/13 106

  • 7/30/2019 Dip Class3Image Enhancement

    107/194

  • 7/30/2019 Dip Class3Image Enhancement

    108/194

    (2)The image is extended by appending extra rows/columns at the boundaries. The

    extension is done by repeating the first/last row/column or by setting them to some

    t t (fi d b d )

  • 7/30/2019 Dip Class3Image Enhancement

    109/194

    constant (fixed boundary).

    (3)The boundaries wrap around (periodic boundary).

    For one dimension

    =

    )1(

    )(

    )0(

    )(~

    Nf

    xf

    f

    xf

    1)2/( +

  • 7/30/2019 Dip Class3Image Enhancement

    110/194

    image f(m, n).

    The mask operation can be implemented in matlab using the filter2command, which is based on the conv2command.

    05/25/13 110

    The Spatial Filtering

  • 7/30/2019 Dip Class3Image Enhancement

    111/194

    Processj k lm n o

    p q r

    Origin x

    y Image f (x, y)

    eprocessed= n*e +

    j*a + k*b + l*c +

    m*d + o*f +p*g + q*h + r*i

    Filter (w)Simple 3*3

    Neighbourhoode 3*3 Filter

    a b cd e f

    g h i

    Original Image

    Pixels

    *

    The above is repeated for every pixel in the

    original image to generate the filtered image05/25/13 111

    Spatial Filtering:

  • 7/30/2019 Dip Class3Image Enhancement

    112/194

    Equation Form

    = =

    ++= aas

    b

    bt

    tysxftswyxg ),(),(),(

    Filtering can be given

    in equation form asshown above

    Notations are based

    on the image shownto the left

    05/25/13 112

    Smoothing Filters

  • 7/30/2019 Dip Class3Image Enhancement

    113/194

    Image smoothing refers to any image-to-image transformation designed to

    smooth or flatten the image by reducing the rapid pixel-to-pixel variation in

    gray values.

    Smoothing filters are used for:

    (1) Blurring: This is usually a preprocessing step for removing small

    (unwanted) details before extracting the relevant (large) object, bridging gapsin lines/curves,

    (2)Noise reduction: Mitigate the effect of noise by linear or nonlinear

    operations.

    Image smoothing by averaging (lowpass spatial filtering)

    05/25/13 113

    Smoothing is accomplished by applying an averaging mask.

  • 7/30/2019 Dip Class3Image Enhancement

    114/194

    An averaging mask is a mask with positive weights, which sum to 1. It

    computes a weighted average of the pixel values in a neighborhood. This

    operation is sometimes called neighborhood averaging.

    Some 3 x 3 averaging masks:

    010

    111

    010

    5

    1

    010

    141

    010

    8

    1

    111

    111

    111

    9

    1

    131

    3163

    131

    32

    1

    This operation is equivalent to lowpass filtering.

    05/25/13 114

    Smoothing Spatial Filters

  • 7/30/2019 Dip Class3Image Enhancement

    115/194

    Smoothing Spatial Filters

    One of the simplest spatial filteringoperations we can perform is asmoothing operation

    Simply average all of the pixels in aneighbourhood around a central value

    Especially usefulin removing noisefrom images

    Also useful forhighlighting gross

    detail

    1/91/9

    1/9

    1/91/9

    1/9

    1/91/9

    1/9

    Simpleaveraging

    filter

    05/25/13 115

    Smoothing Spatialil i

  • 7/30/2019 Dip Class3Image Enhancement

    116/194

    Filtering1

    /91

    /91

    /91/9

    1/91/9

    1/91/9

    1/9

    Origin x

    y Image f (x, y)

    e = 1/9*106 +1/9*104 +

    1/9*100 +1/9*108 +

    1/9*99 +

    1/9*98 +1/9*95 +

    1/9*90 +1/9*85

    = 98.3333

    Filter

    Simple 3*3Neighbourhood

    106

    104

    99

    95

    100 108

    98

    90 85

    1/91/9

    1/9

    1/91/9

    1/9

    1/91/9

    1/9

    3*3 SmoothingFilter

    104 100 108

    99 106 98

    95 90 85

    Original Image

    Pixels

    *

    The above is repeated for every pixel in the

    original image to generate the smoothed image05/25/13 116

    Image Smoothingl

  • 7/30/2019 Dip Class3Image Enhancement

    117/194

    Example

    The image at the top leftis an original image ofsize 500*500 pixels

    The subsequent imagesshow the image afterfiltering with an averaging

    filter of increasing sizes 3, 5, 9, 15 and 35

    Notice how detail begins

    to disappear05/25/13 117

    Image Smoothing Example

  • 7/30/2019 Dip Class3Image Enhancement

    118/194

    Image Smoothing Example

    05/25/13 118

    Image Smoothing Example

  • 7/30/2019 Dip Class3Image Enhancement

    119/194

    Image Smoothing Example

    05/25/13 119

    Image Smoothing Example

  • 7/30/2019 Dip Class3Image Enhancement

    120/194

    Image Smoothing Example

    05/25/13 120

    Image Smoothing Example

  • 7/30/2019 Dip Class3Image Enhancement

    121/194

    Image Smoothing Example

    05/25/13 121

    Image Smoothing Example

  • 7/30/2019 Dip Class3Image Enhancement

    122/194

    Image Smoothing Example

    05/25/13 122

    Image Smoothing Example

  • 7/30/2019 Dip Class3Image Enhancement

    123/194

    Image Smoothing Example

    05/25/13 123

    Weighted SmoothingFilt

  • 7/30/2019 Dip Class3Image Enhancement

    124/194

    Filters

    More effective smoothing filters can begenerated by allowing different pixelsin the neighbourhood different weights

    in the averaging function Pixels closer to the

    central pixel are moreimportant

    Often referred to as aweighted averaging

    1/16 2/16 1/16

    2/164/16

    2/16

    1/162/16

    1/16

    Weighted

    averaging filter05/25/13 124

    Another Smoothing Example

  • 7/30/2019 Dip Class3Image Enhancement

    125/194

    Another Smoothing Example

    By smoothing the original image weget rid of lots of the finer detail whichleaves only the gross features forthresholding

    Original Image Smoothed Image Thresholded Image

    * Image taken from Hubble Space Telescope

    05/25/13 125

    Averaging Filter Vs. MedianFilter Example

  • 7/30/2019 Dip Class3Image Enhancement

    126/194

    Filter Example

    Filtering is often used to remove noise

    from images

    Sometimes a median filter worksbetter than an averaging filter

    Original Image

    With Noise

    Image After

    Averaging Filter

    Image After

    Median Filter

    05/25/13 126

    Averaging Filter Vs. Median FilterExample

  • 7/30/2019 Dip Class3Image Enhancement

    127/194

    Example

    Original

    05/25/13 127

    Averaging Filter Vs. Median FilterExample

  • 7/30/2019 Dip Class3Image Enhancement

    128/194

    Example

    Averaging

    Filter

    05/25/13 128

    Averaging Filter Vs. Median FilterExample

  • 7/30/2019 Dip Class3Image Enhancement

    129/194

    Example

    Median

    Filter

    05/25/13 129

    Strange Things Happen At TheEdges!

  • 7/30/2019 Dip Class3Image Enhancement

    130/194

    Edges!

    Origin x

    y Image f (x, y)

    e

    e

    e

    e

    At the edges of an image we are missingpixels to form a neighbourhood

    e e

    e

    05/25/13 130

    Strange Things Happen At TheEdges! (cont )

  • 7/30/2019 Dip Class3Image Enhancement

    131/194

    Edges! (cont)

    There are a few approaches to dealingwith missing edge pixels:

    Omit missing pixels

    Only works with some filters Can add extra code and slow down

    processing

    Pad the image

    Typically with either all white or all blackpixels

    Replicate border pixels

    Truncate the image05/25/13 131

    Correlation &Convolution

  • 7/30/2019 Dip Class3Image Enhancement

    132/194

    Convolution

    The filtering we have been talkingabout so far is referred to ascorrelation with the filter itself referredto as the correlation kernel

    Convolution is a similar operation, withjust one subtle differenceeprocessed= v*e +

    z*a + y*b + x*c +

    w*d + u*e +t*f +s*g + r*h

    r s t

    u v w

    x y z

    Filter

    a b c

    d e e

    f g h

    Original Image

    Pixels

    *

    05/25/13 132

    Sharpening SpatialFilters

  • 7/30/2019 Dip Class3Image Enhancement

    133/194

    Filters

    Previously we have looked atsmoothing filters which remove finedetail

    Sharpening spatial filters seek tohighlight fine detail

    Remove blurring from images

    Highlight edgesSharpening filters are based on spatialdifferentiation05/25/13 133

    Image Sharpening

  • 7/30/2019 Dip Class3Image Enhancement

    134/194

    This involves highlighting fine details or

    enhancing details that have been blurred.Basic highpass spatial filtering

    This can be accomplished by a linear shift-

    invariant operator, implemented by meansof a mask, with positive and negativecoefficients.This is called a sharpening mask, since ittends to enhance abrupt gray levelchanges in the image.

    05/25/13 134

    The mask should have a positive coefficient at thecenter and negative coefficients at the periphery.

  • 7/30/2019 Dip Class3Image Enhancement

    135/194

    The coefficients should sum to zero. Example:

    111

    181111

    9

    1

    This is equivalent to highpass filtering.

    A highpass filtered image g can be thought of asthe difference between the original image fand a

    lowpass filtered version off:g(m,n) = f(m,n) lowpass(f(m,n))

    05/25/13 135

    Example:

  • 7/30/2019 Dip Class3Image Enhancement

    136/194

    05/25/13 136

    High-boost filtering

  • 7/30/2019 Dip Class3Image Enhancement

    137/194

    This is a filter whose output g is produced bysubtracting a lowpass (blurred) version offfroman amplified version offg(m,n) = A f(m,n) lowpass(f(m,n))

    This is also referred to as unsharp masking.

    Observe that

    g(m,n) = A f(m,n) lowpass(f(m,n))

    = (A-1) f(m,n) + f(m,n) lowpass(f(m,n))

    = (A-1) f(m,n) + highpass(f(m,n))

    ForA> 1, part of the original image is added back to the highpass filteredversion of f.

    05/25/13 137

    The result is the original image with the edges enhanced relative to the original

    image.

  • 7/30/2019 Dip Class3Image Enhancement

    138/194

    Example:

    05/25/13 138

    Spatial Differentiation

  • 7/30/2019 Dip Class3Image Enhancement

    139/194

    p

    Differentiation measures the rate ofchange of a function

    Lets consider a simple 1 dimensionalexample

    05/25/13 139

    Spatial Differentiation

  • 7/30/2019 Dip Class3Image Enhancement

    140/194

    A B

    05/25/13 140

    1st Derivative

  • 7/30/2019 Dip Class3Image Enhancement

    141/194

    The formula for the 1st derivative of afunction is as follows:

    Its just the difference betweensubsequent values and measures the

    rate of change of the function

    )()1( xfxf

    x

    f+=

    05/25/13 141

    1st Derivative (cont)

  • 7/30/2019 Dip Class3Image Enhancement

    142/194

    5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7

    0 -1 -1 -1 -1 0 0 6 -6 0 0 0 1 2 -2 -1 0 0 0 7 0 0 0

    f(x)

    f(x)

    05/25/13 142

    2nd Derivative

  • 7/30/2019 Dip Class3Image Enhancement

    143/194

    The formula for the 2nd derivative of afunction is as follows:

    Simply takes into account the valuesboth before and after the current value

    )(2)1()1(2

    2

    xfxfxfx

    f

    ++=

    05/25/13 143

    2nd Derivative (cont)

  • 7/30/2019 Dip Class3Image Enhancement

    144/194

    5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7

    -1 0 0 0 0 1 0 6 -12 6 0 0 1 1 -4 1 1 0 0 7 -7 0 0

    f(x)

    f(x)

    05/25/13 144

  • 7/30/2019 Dip Class3Image Enhancement

    145/194

    05/25/13 145

    1st and 2nd Derivative

  • 7/30/2019 Dip Class3Image Enhancement

    146/194

    f(x)

    f(x)

    f(x)

    146

    Using Second Derivatives ForImage Enhancement

  • 7/30/2019 Dip Class3Image Enhancement

    147/194

    Image Enhancement

    The 2nd

    derivative is more useful forimage enhancement than the 1stderivative

    Stronger response to fine detail

    Simpler implementation

    We will come back to the 1st orderderivative later on

    The first sharpening filter we will lookat is the Laplacian

    Isotropic

    One of the simplest sharpening filters05/25/13 147

    The Laplacian

  • 7/30/2019 Dip Class3Image Enhancement

    148/194

    The Laplacian is defined as follows:

    where the partial 1

    st

    order derivative inthex direction is defined as follows:

    and in the y direction as follows:

    y

    f

    x

    ff

    2

    2

    2

    22

    +

    =

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

    2

    yxfyxfyxf

    x

    f++=

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

    2

    yxfyxfyxf

    y

    f++=

    05/25/13 148

    The Laplacian (cont)

  • 7/30/2019 Dip Class3Image Enhancement

    149/194

    So, the Laplacian can be given asfollows:

    We can easily build a filter based on

    this

    ),1(),1([2 yxfyxff ++=)]1,()1,( +++ yxfyxf

    ),(4 yxf

    0 1 0

    1 -4 1

    0 1 005/25/13 149

    Laplacian Mask

  • 7/30/2019 Dip Class3Image Enhancement

    150/194

    05/25/13 150

    The Laplacian (cont)

  • 7/30/2019 Dip Class3Image Enhancement

    151/194

    Applying the Laplacian to an image weget a new image that highlights edgesand other discontinuities

    Original

    Image

    Laplacian

    Filtered Image

    Laplacian

    Filtered Image

    Scaled for Display05/25/13 151

    But That Is Not VeryEnhanced!

  • 7/30/2019 Dip Class3Image Enhancement

    152/194

    Enhanced!The result of a Laplacianfiltering is not an enhancedimage

    We have to do more work inorder to get our final image

    Subtract the Laplacian resultfrom the original image to

    generate our final sharpenedenhanced image

    Laplacian

    Filtered Image

    Scaled for Display

    fyxfyxg 2),(),( =05/25/13 152

  • 7/30/2019 Dip Class3Image Enhancement

    153/194

    Background features can be recovered whilestill preserving the sharpening effect of theLaplacian operation simply by adding the originaland Laplacian images

    05/25/13 153

    Laplacian ImageEnhancement

  • 7/30/2019 Dip Class3Image Enhancement

    154/194

    Enhancement

    In the final sharpened image edgesand fine detail are much more obvious

    - =

    Original

    Image

    Laplacian

    Filtered Image

    Sharpened

    Image

    05/25/13 154

  • 7/30/2019 Dip Class3Image Enhancement

    155/194

    Simplified ImageEnhancement

  • 7/30/2019 Dip Class3Image Enhancement

    156/194

    Enhancement

    The entire enhancement can becombined into a single filteringoperation

    ),1(),1([),( yxfyxfyxf ++= )1,()1,( +++ yxfyxf)],(4 yxf

    fyxfyxg 2),(),( =

    ),1(),1(),(5 yxfyxfyxf +=)1,()1,( + yxfyxf

    05/25/13 156

    Simplified Image Enhancement(cont)

  • 7/30/2019 Dip Class3Image Enhancement

    157/194

    ( )

    This gives us a new filter which doesthe whole job for us in one step

    0 -1 0

    -1 5 -1

    0 -1 0

    05/25/13 157

    Simplified Image Enhancement(cont)

  • 7/30/2019 Dip Class3Image Enhancement

    158/194

    ( )

    05/25/13 158

  • 7/30/2019 Dip Class3Image Enhancement

    159/194

    Unsharp Masking andHighboost Filtering

  • 7/30/2019 Dip Class3Image Enhancement

    160/194

    g g

    Unsharp maskingSharpen images consists of subtracting anunsharp (smoothed) version of an image from theoriginal image

    e.g., printing and publishing industrySteps

    1. Blur the original image

    2. Subtract the blurred image from the original

    3. Add the mask to the original

    05/25/13 160

    Unsharp masking

  • 7/30/2019 Dip Class3Image Enhancement

    161/194

    ( , ) ( , ) ( , )sf x y f x y f x y=

    ( , )sf x y - sharpened image obtained by unsharp masking

    ( , )f x y - Blurred version of f(x,y)

    161

    High-Boost Filtering

  • 7/30/2019 Dip Class3Image Enhancement

    162/194

    Generalization of unsharp masking iscalled high-boost filtering

    ( )

    ( , ) ( , ) ( , )

    ( , ) ( , ) ( , ) ( , ) ( , )

    ( , ) 1 ( , ) ( , )

    hb

    hb

    hb s

    f x y Af x y f x y

    f x y Af x y f x y f x y f x y

    f x y A f x y f x y

    =

    = + = +

    ( ) 2

    2

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

    ( , ) ( , ) ( , )

    hb

    hb

    f x y A f x y f x y f x y

    f x y Af x y f x y

    = + =

    05/25/13 162

    High-Boost Filtering

  • 7/30/2019 Dip Class3Image Enhancement

    163/194

    05/25/13 163

    High-Boost Filteredimage

  • 7/30/2019 Dip Class3Image Enhancement

    164/194

    image

    05/25/13 164

    Highboost Filtering

  • 7/30/2019 Dip Class3Image Enhancement

    165/194

    05/25/13 165

    1st Derivative Filtering- TheGradient

  • 7/30/2019 Dip Class3Image Enhancement

    166/194

    Implementing 1st derivative filters isdifficult in practice

    For a function f(x, y) the gradient offatcoordinates (x, y) is given as the column

    vector:

    =

    =yf

    x

    f

    G

    G

    y

    xf

    05/25/13 166

    1st Derivative Filtering(cont)

  • 7/30/2019 Dip Class3Image Enhancement

    167/194

    ( )The magnitude of this vector is given by:

    For practical reasons this can besimplified as:

    )f(= magf

    [ ] 21

    22

    yx GG +=

    21

    22

    +

    =

    y

    f

    x

    f

    yx GGf +

    05/25/13 167

    1st Derivative Filtering(cont)

  • 7/30/2019 Dip Class3Image Enhancement

    168/194

    ( )There is some debate as to how best tocalculate these gradients but we will use:

    which is based on these coordinates

    ( ) ( )321987 22 zzzzzzf ++++

    ( ) ( )741963

    22 zzzzzz +++++

    z1 z2 z3

    z4 z5 z6

    z7 z8 z9

    05/25/13 168

  • 7/30/2019 Dip Class3Image Enhancement

    169/194

    Sobel Example

  • 7/30/2019 Dip Class3Image Enhancement

    170/194

    Sobel filters are typically used for edge

    detection

    An image of acontact lens which

    is enhanced in

    order to make

    defects (at four

    and five oclock in

    the image) moreobvious

    05/25/13 170

  • 7/30/2019 Dip Class3Image Enhancement

    171/194

    Combining SpatialEnhancement Methods

  • 7/30/2019 Dip Class3Image Enhancement

    172/194

    Successful imageenhancement is typicallynot achieved using asingle operation

    Rather we combine arange of techniques inorder to achieve a final

    resultThis example will focuson enhancing the bone05/25/13 172

    Combining SpatialEnhancement Methods

    (cont )

  • 7/30/2019 Dip Class3Image Enhancement

    173/194

    (cont)

    Laplacian filter of

    bone scan (a)

    Sharpened version of

    bone scan achieved

    by subtracting (a)

    and (b) Sobel filter of bone

    scan (a)

    (a)

    (b)

    (c)

    (d)05/25/13 173

  • 7/30/2019 Dip Class3Image Enhancement

    174/194

    Combining SpatialEnhancement Methods

    (cont)

  • 7/30/2019 Dip Class3Image Enhancement

    175/194

    (cont)

    Compare the original and final images

    05/25/13 175

    Filtering in FrequencyDomain

  • 7/30/2019 Dip Class3Image Enhancement

    176/194

    05/25/13 176

    Notch Filter

  • 7/30/2019 Dip Class3Image Enhancement

    177/194

    ( , ) 0 ( , ) ( / 2, / 2)1 otherwise

    H u v if u v M N= =

    05/25/13 177

    Transfer Function of IdealLowpass Filter

  • 7/30/2019 Dip Class3Image Enhancement

    178/194

    0

    0

    0

    12 2 2

    ( , ) 1 ( , )

    0 ( , )

    is the cutoff frequency

    ( , )2 2

    H u v if D u v D

    if D u v D

    D

    M ND u v u v

    =

    = +

    f

    05/25/13 178

  • 7/30/2019 Dip Class3Image Enhancement

    179/194

  • 7/30/2019 Dip Class3Image Enhancement

    180/194

  • 7/30/2019 Dip Class3Image Enhancement

    181/194

    05/25/13 181

  • 7/30/2019 Dip Class3Image Enhancement

    182/194

    05/25/13 182

    Butterworth Low pass Filter

    1

  • 7/30/2019 Dip Class3Image Enhancement

    183/194

    [ ]2

    0

    1

    ( , ) 1 ( , ) /nH u v D u v D= +

    05/25/13 183

    Resu ts o F ter ng w tBLPF

  • 7/30/2019 Dip Class3Image Enhancement

    184/194

    05/25/13 184

  • 7/30/2019 Dip Class3Image Enhancement

    185/194

    05/25/13 185

    Gaussian Lowpass Filter

  • 7/30/2019 Dip Class3Image Enhancement

    186/194

    2 2

    0( , )/2

    ( , )D u v D

    H u v e

    =

    05/25/13 186

    High Pass Filter

  • 7/30/2019 Dip Class3Image Enhancement

    187/194

    05/25/13 187

    Transfer function of HPF

    HPFId l

  • 7/30/2019 Dip Class3Image Enhancement

    188/194

    [ ]

    2 20

    0

    0

    0

    2

    0

    ( , )/2

    HPF

    ( , ) 0 ( , )

    1 ( , )

    is the cutoff frequency

    HPF

    1( , )

    1 ( , ) /

    HPF

    ( , ) 1

    n

    D u v D

    Ideal

    H u v if D u v D

    if D u v D

    D

    Butterworth

    H u vD u v D

    Gaussian

    H u v e

    =

    =

    +

    =

    f

    05/25/13 188

    Results of HPF usingButterworth HPF

  • 7/30/2019 Dip Class3Image Enhancement

    189/194

    05/25/13 189

    Homomorphic FilteringApproach

  • 7/30/2019 Dip Class3Image Enhancement

    190/194

    05/25/13 190

    Homomorphic Filtering

    ( , ) ( , ) ( , )f x y i x y r x y=

  • 7/30/2019 Dip Class3Image Enhancement

    191/194

    { } { } { }

    { } { }

    { } { }

    ( , ) ( , ) ( , )

    ( , ) ( , ) ( , )

    ( , ) ln ( , )

    = ln ( , ) ln ( , )( , ) ln ( , )

    = ln ( , ) ln ( , )

    ( , ) ( , ) ( , )i r

    f x y i x y r x y

    F f x y F i x y F r x y

    z x y f x y

    i x y r x yF z x y F f x y

    F i x y F r x y

    Z u v F u v F u v

    =

    +=

    +

    = +

    05/25/13 191

    we process ( , ) by means of a filter function H(u,v)

    ( , ) ( , ) ( , )

    ( ) ( ) ( ) ( )

    If Z u v

    S u v H u v Z u v

    H F H F

    =

    +

  • 7/30/2019 Dip Class3Image Enhancement

    192/194

    { }

    { }

    1

    1 1

    = ( , ) ( , ) ( , ) ( , )

    the spatial domain

    ( , ) ( , )

    ( , ) ( , ) ( , ) (

    i r

    i r

    H u v F u v H u v F u v

    In

    s x y F S u v

    F H u v F u v F H u v F u

    +

    =

    + { }, )

    v

    { }

    { }

    1

    1

    ( , )

    '( , ) '( , )

    0 0

    '( , ) ( , ) ( , )

    '( , ) ( , ) ( , )

    ( , ) '( , ) '( , )( , )

    = .

    ( ) ( )

    i

    r

    s x y

    i x y r x y

    i x y F H u v F u v

    r x y F H u v F u v

    s x y i x y r x yg x y e

    e e

    i

    =

    =

    = +=

    05/25/13 192

    Filter Function H(u,v)

  • 7/30/2019 Dip Class3Image Enhancement

    193/194

    The filter function tends to decrease the contribution made by the low

    frequencies (illumination) and amplify the contributions made by the

    high frequencies (reflectance)

    05/25/13 193

  • 7/30/2019 Dip Class3Image Enhancement

    194/194

    Thank You