Spatial Processing

Embed Size (px)

Citation preview

  • 8/14/2019 Spatial Processing

    1/59

    Spatial Domain ImageProcessing

    Dr. P. ArulmozhivarmanAssociate Processor

    School of Electrical Sciences

    VIT University

  • 8/14/2019 Spatial Processing

    2/59

    Principal application areas

    Improvement of pictorial information for

    human interpretation

    Processing of image data for storage,

    transmission, and representation for

    autonomous machine perception

  • 8/14/2019 Spatial Processing

    3/59

    Gray-level Histogram

    Spatial

    DFT DCT

    Spectral

    Digital Image Characteristics

    Point Processing Masking Filtering

    Enhancement

    Degradation Models Inverse Filtering Wiener Filtering

    Restoration

    Pre-Processing

    Information Theory

    LZW (gif)

    Lossless

    Transform-based (jpeg)

    Lossy

    Compression

    Edge Detection

    Segmentation

    Shape Descriptors Texture Morphology

    Description

    Digital Image Processing

  • 8/14/2019 Spatial Processing

    4/59

    Features of an image

    Low Frequency Component

    Smooth/uniform regions

    Approximation component

    High frequency Component

    EdgesDetailed component

  • 8/14/2019 Spatial Processing

    5/59

    Image processing

    Low level processing :

    primitive operation- enhance quality of

    image as suitable for application.

    Mid- level processing :

    description of objects for computer

    processing and classification.

    High level processing :

    making sense of recognized objects

  • 8/14/2019 Spatial Processing

    6/59

  • 8/14/2019 Spatial Processing

    7/59

    Image processing fundamentals

  • 8/14/2019 Spatial Processing

    8/59

  • 8/14/2019 Spatial Processing

    9/59

  • 8/14/2019 Spatial Processing

    10/59

  • 8/14/2019 Spatial Processing

    11/59

  • 8/14/2019 Spatial Processing

    12/59

    Example of negative image

  • 8/14/2019 Spatial Processing

    13/59

    Image Enhancement

  • 8/14/2019 Spatial Processing

    14/59

    MRI IMAGING

  • 8/14/2019 Spatial Processing

    15/59

    Image Encryption

  • 8/14/2019 Spatial Processing

    16/59

  • 8/14/2019 Spatial Processing

    17/59

    Normalized histogram

  • 8/14/2019 Spatial Processing

    18/59

    Histogram Equalization

  • 8/14/2019 Spatial Processing

    19/59

    Image Preprocessing

    Enhancement Restoration

    SpatialDomain

    SpectralDomain

    Point Processingimadjusthisteq

    Spatial filteringfilter2

    Filtering fft2/ifft2

    fftshift

    Inverse filtering Wiener filtering

  • 8/14/2019 Spatial Processing

    20/59

    Image restoration attempts to restore images

    that have been degraded

    Identify the degradation process and attempt to

    reverse it

    Similar to image enhancement, but more objective

  • 8/14/2019 Spatial Processing

    21/59

    Filtering to Remove Noise

    We can use spatial filters of different kinds

    to remove different kinds of noise

    The arithmetic mean filter is a very simpleone and is calculated as follows:

    This is implemented as the

    simple smoothing filter Blurs the image to remove

    noise

    xySts

    tsgmn

    yxf),(

    ),(1),(

    1

    /9

    1

    /9

    1

    /9

    1/9

    1/91/9

    1/91/91/9

  • 8/14/2019 Spatial Processing

    22/59

    Other Means

    There are different kinds of mean filters all of

    which exhibit slightly different behaviour:

    Arithmetic Mean

    Geometric Mean

    Harmonic Mean

    Contraharmonic Mean

  • 8/14/2019 Spatial Processing

    23/59

    Other Means (cont)

    There are other variants on the mean which

    can give different performance

    Geometric Mean:

    Achieves similar smoothing to the arithmetic

    mean, but tends to lose less image detail

    mn

    Sts xy

    tsgyxf

    1

    ),(

    ),(),(

  • 8/14/2019 Spatial Processing

    24/59

    Other Means (cont)

    Harmonic Mean:

    Works well for salt noise, but fails for pepper

    noiseAlso does well for other kinds of noise such as

    Gaussian noise

    xyStstsg

    mnyxf

    ),( ),(1

    ),(

  • 8/14/2019 Spatial Processing

    25/59

    Other Means (cont)

    Contraharmonic Mean:

    Q is the order of the filter and adjusting its value

    changes the filters behaviourPositive values of Q eliminate pepper noise

    Negative values of Q eliminate salt noise

    xy

    xy

    Sts

    Q

    Sts

    Q

    tsg

    tsg

    yxf),(

    ),(

    1

    ),(

    ),(

    ),(

  • 8/14/2019 Spatial Processing

    26/59

    Order Statistics Filters

    Spatial filters that are based on ordering the

    pixel values that make up the nieghbourhood

    operated on by the filter

    Useful spatial filters include Median filter

    Max and min filter

    Midpoint filter Alpha trimmed mean filter

  • 8/14/2019 Spatial Processing

    27/59

    Median Filter

    Median Filter:

    Excellent at noise removal, without thesmoothing effects that can occur with othersmoothing filters

    Particularly good when salt and pepper noiseis present

    )},({),(),(

    tsgmeanyxfxySts

  • 8/14/2019 Spatial Processing

    28/59

    Max and Min Filter

    Max Filter:

    Min Filter:

    Max filter is good for pepper noise and min is

    good for salt noise

    )},({max),(),(

    tsgyxf

    xy

    Sts

    )},({min),(

    ),(

    tsgyxfxySts

  • 8/14/2019 Spatial Processing

    29/59

    Midpoint Filter

    Midpoint Filter:

    Good for random Gaussian and uniformnoise

    )},({min)},({max2

    1),(

    ),(),(tsgtsgyxf

    xyxy StsSts

  • 8/14/2019 Spatial Processing

    30/59

    Alpha-Trimmed Mean Filter

    Alpha-Trimmed Mean Filter:

    We can delete the d/2 lowest and d/2 highestgrey levels

    So gr(s, t) represents the remaining mn

    d pixels

    xySts

    r tsg

    dmn

    yxf),(

    ),(1

    ),(

  • 8/14/2019 Spatial Processing

    31/59

    Detection of Discontinuities

    3 basic types of gray-level discontinuities:

    Points

    LinesEdges

    Common method of detection: run a maskthrough the image.

  • 8/14/2019 Spatial Processing

    32/59

    Filter Mask

  • 8/14/2019 Spatial Processing

    33/59

    Point Detection

    T: nonnegative threshold:

    9

    1992211

    ...i ii

    zwzwzwzwR

    R T

  • 8/14/2019 Spatial Processing

    34/59

    Point Detection

    A point has been detected at the location on

    which the mask is centered if: |R|>T

    The gray level of an isolated point will bequite different from the gray levels of its

    neighbors

    measure the weighted differences between thecenter point and its neighbors

  • 8/14/2019 Spatial Processing

    35/59

    Line Detection

    If at a certain point |Ri

    |>|Rj

    |, this point ismore likely associated with a line in thedirection of mask i.

    R1 R2 R3 R4

  • 8/14/2019 Spatial Processing

    36/59

    Edge Detection

    Edge (a set of connected pixels):

    the boundary between two regions with relativelydistinct gray-level properties.

    Note: edge vs. boundary

    Assumption:

    the regions are sufficiently homogeneous, so thatthe transition between two regions can be

    determined on the basis of gray-leveldiscontinuities alone.

  • 8/14/2019 Spatial Processing

    37/59

    Image Segmentation

  • 8/14/2019 Spatial Processing

    38/59

    Edge Detection Basic Idea:

    A profile is defined perpendicularly to the edgedirection and the results are interpreted.

    The magnitude of the first derivative is used todetect an edge (if a point is on a ramp)

    The sign of the second derivative can determinewhether an edge pixel is on the dark or light side ofan edge.

    Remarks on second derivative: It produces two responses for every edge

    The line that can be formed joining its positive andnegative values crosses zero at the mid point ofthe edge (zero-crossing)

  • 8/14/2019 Spatial Processing

    39/59

    Edge Detection

    Computation of a local derivative operator

    A profile is defined perpendicularly to the edgedirection and the results are interpreted.

    The first derivative is obtained by using themagnitude of the gradient at that point.

    The second derivative is obtained by using theLaplacian.

  • 8/14/2019 Spatial Processing

    40/59

    Gradient Operators

    y

    fx

    f

    G

    GF

    y

    x

    The gradient vector points in the direction of

    maximum rate of change of f at (x,y).

  • 8/14/2019 Spatial Processing

    41/59

    Gradient Operators

    Gradient: 2/122 ][)( yx GGFmagf

    (maximum rate of increase of f(x,y) per unit distance)

    |||| yx GGf

    Direction angle off at (x,y):

    x

    y

    G

    G

    yxa1

    tan),(

    Image Segmentation

  • 8/14/2019 Spatial Processing

    42/59

    Image Segmentation

  • 8/14/2019 Spatial Processing

    43/59

    Image Segmentation

    I S t ti

  • 8/14/2019 Spatial Processing

    44/59

    Image Segmentation

    I S t ti

  • 8/14/2019 Spatial Processing

    45/59

    Image Segmentation

  • 8/14/2019 Spatial Processing

    46/59

    Image Segmentation

  • 8/14/2019 Spatial Processing

    47/59

    Gradient Operators

    Computation of the gradient of an image:

    Soebel operators provide both a differencing &a smoothing effect:

    )2()2( 321987 zzzzzzGx

    )2()2( 741963 zzzzzzGy

  • 8/14/2019 Spatial Processing

    48/59

    Summary: Gradient Operators

    Smooth edges due toblurring (result of sampling)

    Positive: leadingNegative: trailing

    Zero: in constant gray levels

    Positive: from dark sideNegative: from light side

    Zero: in constant gray levels

  • 8/14/2019 Spatial Processing

    49/59

    The magnitude of the first derivative detects

    the presence of an edge and the sign of the

    second detects whether the edge pixel lies on

    the dark or light side of an edge.

    The second derivative has a zero-crossing atthe mid-point of a transition.

  • 8/14/2019 Spatial Processing

    50/59

    Laplacian

    (of a 2-D function f(x,y)): 22

    2

    2

    2

    y

    f

    x

    ff

    A 3 x 3 discrete mask based on the above is:

    )(4 864252

    zzzzzf

  • 8/14/2019 Spatial Processing

    51/59

    Laplacian

    The idea:

    Coefficient of center pixel should be positive

    Coefficients of outer pixels should be negative

    Sum of coefficients should be zero(the Laplacian is a derivative)

  • 8/14/2019 Spatial Processing

    52/59

    Image Segmentation

  • 8/14/2019 Spatial Processing

    53/59

    Laplacian

    The Laplacian is seldom used in practice,

    because:

    It is unacceptably sensitive to noise (as second-order derivative)

    It produces double edges

    It is unable to detect edge direction

  • 8/14/2019 Spatial Processing

    54/59

    Laplacian

    An important use of the Laplacian:

    To find the location of edges using its zero-crossings property.

    Plus, the Laplacian plays only the role ofdetector of whether a pixel is on the darkor light side of an edge.

  • 8/14/2019 Spatial Processing

    55/59

    Laplacian

    Convolve an image with the Laplacian of a2D Gaussian function of the form:

    h(x,y) exp x2 y

    2

    22

    where is the standard deviation.

  • 8/14/2019 Spatial Processing

    56/59

    Laplacian

    The Laplacian of the above Gaussian is:

    2h r2

    2

    4

    exp

    r2

    22

    where r2 = x2 + y2.

    determines the degree of blurring that occurs.

    Image Segmentation

  • 8/14/2019 Spatial Processing

    57/59

    Image Segmentation

    Image Segmentation

  • 8/14/2019 Spatial Processing

    58/59

  • 8/14/2019 Spatial Processing

    59/59

    Thank you!