image enhancement in the spacial domain

Upload: mohammed-ali-abbaker-ali

Post on 06-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Image Enhancement in the Spacial Domain

    1/100

    Image Enhancement in the Spatial Domain

    (Chapter 3)

    Prepared by:

    Mohammed Ali AbbakerFakher Aldin Yahia Omer

    Waleed Ahmed Hussein

    Diploma/M. Sc. On Computer Architecture and Networking

    Third Term, 2011/12

    Digital Image Processing (DIP) SC614Seminar

    Supervised by:

    Dr. Abdelrahim Elobeid Ahmed

  • 8/2/2019 Image Enhancement in the Spacial Domain

    2/100

    outline

    Image enhancement

    Image transformation

    pixel point processing Intensity transformation with unknown image information

    Intensity transformation with histogram information.

    spatial filtering

  • 8/2/2019 Image Enhancement in the Spacial Domain

    3/100

    Image enhancement

    The principal objective is to process an image so that the

    result is more suitable than the original image for a specific

    application

    specific is important, because it establishes at the outset

    that the techniques discussed in this seminar are very much

    problem oriented

    The best approach for enhancing X-ray images may not

    necessarily be the best for enhancing pictures of Mars

    transmitted by a space probe too

  • 8/2/2019 Image Enhancement in the Spacial Domain

    4/100

    Evaluation of image enhancement method There is no general theory of image enhancement. When an image is

    processed:

    for visual interpretation:

    The algorithm performance evaluation depends ultimately on theviewers judgment.

    subjective process, different form person to person & from situationto another.

    for machine perception:

    The evaluation task is somewhat easier.

    objective process with specific object to achieve. For example, at

    the recognition application: the object could as specific computationalrequirements. The best image processing method would be the oneyielding the best machine recognition results.

    However, even in situations when a clear-cut criterion of performance canbe imposed on the problem, a certain amount of trial and error usually is

    required before a particular image enhancement approach is selected.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    5/100

    Image enhancement approaches

    two broad categories:-

    1. spatial domain methods:

    based on direct manipulation of pixels in an imageimage plane.

    2. frequency domain methods:

    based on modifying the Fourier transform of an image.

    Enhancement techniques like most of the other image

    processing applications based on various combinations of

    methods from these categories.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    6/100

    Background

    value f(x,y) at each x, y is called intensity

    levelor gray level

  • 8/2/2019 Image Enhancement in the Spacial Domain

    7/100

    Digital image representation

  • 8/2/2019 Image Enhancement in the Spacial Domain

    8/100

    Image Transformation - Definition

    Is a process of changing the color or grayscale

    values of an image pixel by operations like

    adjusting the contrast or brightness, sharpening

    lines, modifying colors, or smoothing edges, etc

    This discussion divides image transforms into two

    types:

    pixel point processing Intensity transformation with unknown image information

    Intensity transformation with histogram information.

    spatial filtering

  • 8/2/2019 Image Enhancement in the Spacial Domain

    9/100

    Intensity Transformations and Filters spatial domain :the aggregate of

    pixels composing an image.

    Spatial process expression:

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

    f(x,y) input image,

    g(x,y) output image

    T is an operator on f

    defined over a neighborhood of

    point (x,y)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    10/100

    Spatial Domain Methods

    f(x,y)

    g(x,y)

    g(x,y)

    f(x,y)

    Point pixel

    Processing

    Area/Mask

    Processing

  • 8/2/2019 Image Enhancement in the Spacial Domain

    11/100

    Intensity Transformation 1 x 1 is the smallest possible neighborhood.

    In this case g depends only on value of f at a single point

    (x,y)

    and we call T an intensity (gray-level or mapping)

    transformation and write

    s = T(r)

    where r and s denotes respectively the intensity of g and f at

    any point (x, y).

  • 8/2/2019 Image Enhancement in the Spacial Domain

    12/100

    Transform Functions and Curves (2)

    Transforms can be applied to pixel values in a variety of

    color modes

    If the pixels are grayscale, thenp1

    andp2

    are values

    between 0 and 255

    If the color mode is RGB or some other three-component

    model

    f(p) implies three components, and the transform may be

    applied either to each of the components separately or to the

    three as a composite

    For simplicity, we look at transforms as they apply to

    grayscale images first

  • 8/2/2019 Image Enhancement in the Spacial Domain

    13/100

    Transform Functions and Curves (3)

    An easy way to understand a transform function is to look

    at its graph

    A graph of transform function Tfor a grayscale image has

    p1 on the horizontal axis andp2 on the vertical axis, with

    the values on both axes going from 0 to 255, i.e., from

    black to white (see figure 1)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    14/100

    Transform Functions and Curves (4)

    The transform in Figure 1.adoesnt change the

    pixel values. The output equals the input.

    The transform in Figure 1.b lightens all the

    pixels in the image by a constant amount.

    The transform in Figure 1.c darkens all the

    pixels in the image by a constant amount.

    The transform in Figure 1.d inverts the image,

    reversing dark pixels for light ones.

    The transform in Figure 1.e is a threshold

    function, which makes all the pixels either black

    or white. A pixel with a value below 128

    becomes black, and all the rest become white.

    The transform in Figure 1.fincreases contrast.

    Darks become darker and lights become lighter. Figure 1 Curves for adjusting

    contrast

  • 8/2/2019 Image Enhancement in the Spacial Domain

    15/100

    Transform Functions and Curves (5)

    In Figure 2, weve applied the functions shown in Figure 1

    so you can see for yourself what effect they have

    Figure 2 Adjusting

    contrast and brightness

    with curves function

  • 8/2/2019 Image Enhancement in the Spacial Domain

    16/100

    Point Processing Transformations

    Convert a given pixel value to a new pixel value based on some

    predefined function.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    17/100

    Image transformation

    Image enhancement

    Image transformation

    pixel point processing Intensity transformation with unknown image information

    Intensity transformation with histogram information.

    spatial filtering

  • 8/2/2019 Image Enhancement in the Spacial Domain

    18/100

    1- Identity Transformation

    Some Basic Intensity Transformation Functions

  • 8/2/2019 Image Enhancement in the Spacial Domain

    19/100

    2- Negative Image Negative of an image with intensity levels in the range [0,

    L-1] is obtained using the expression

    s = L1r

    Suited for enhancing white or gray detail embedded in dark

    regions of an image specially when the black areas are

    dominant in size

  • 8/2/2019 Image Enhancement in the Spacial Domain

    20/100

    3- Contrast Stretching or Compression

    Stretch gray-level ranges where

    we desire more information

    (slope > 1).

    Compress gray-level ranges that

    are of little interest

    (0 < slope < 1).

  • 8/2/2019 Image Enhancement in the Spacial Domain

    21/100

    Thresholding

    Special case of contrast compression

  • 8/2/2019 Image Enhancement in the Spacial Domain

    22/100

    3- Contrast-Stretching Transformations

    ErmrTs

    )(1

    1)(

    where rrepresents the intensities of the input image, s

    the corresponding intensity values in the output image,

    andEcontrols the slope of the function.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    23/100

    Fig. 3.2(a): Produce an image of higher contrast than the original in themiddle by:

    by darkening the levels below m & compressing values of r into a narrowrange of s toward black

    By brightening the levels above m in the original image through &compressing values of r into a narrow range of s toward white.

    Fig. 3.2(b): special compressing techniques T(r) produces a two-level

    (binary) image. A mapping of this form is called a thresholding function.

    Thresholding:

  • 8/2/2019 Image Enhancement in the Spacial Domain

    24/100

    29

    i. Contrast Stretching: expands the range of intensity levels in an

    image so that it spans the full intensity range

    Points: (r1, s1) , (r2, s2)

    if: r1 = s1 and r2 = s2linear transformation that produces nochanges in the intensity levels

    if: r1 = r2 and s1 = 0 and s2 =L -1the transformation becomes athresholding function that creates a binary image

    intermediate values of (r1, s1) , (r2, s2) produces various degrees of

    spread in the intensity levels of the output image, thus affecting its

    contrast

    Use: (r1, s1) = (rmin, 0) and (r2, s2) = (rmax,L - 1)

    Piecewise-Linear Transformation Functions

  • 8/2/2019 Image Enhancement in the Spacial Domain

    25/100

    Contrast stretching

    Low-contrast images can result from:

    poor illumination.

    lack of dynamic range in the imaging sensor.

    or even wrong setting of a lens aperture during image

    acquisition.

    The idea behind contrast stretching is to increase the

    dynamic range of the gray levels in the image being

    processed.

    The implementation through wisely slices the linear

    transformation line into different slopes

  • 8/2/2019 Image Enhancement in the Spacial Domain

    26/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    27/100

    Piecewise-Linear Transformation Functions

    ii. Gray level slicing:

    Highlight specific ranges of gray-levels only.

    Same as double

    thresholding!

  • 8/2/2019 Image Enhancement in the Spacial Domain

    28/100

    33

    Piecewise-Linear Transformation Functions

    iii. Bit-Plane Slicing :pixels are digital numbers composed of bits

    In the 256-level gray-scale image is composed of 8 bits

    each pixel is represented by 8 bits

    each 8bit would distributed to 8-planes

    Highlighting the contribution made by a specific bit.

    Each bit-plane is a binary image

    Useful for image compression

    Storing planes: 5, 6, 7, and 8 requires 50% less storage

  • 8/2/2019 Image Enhancement in the Spacial Domain

    29/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    30/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    31/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    32/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    33/100

    4- Logarithmic transformation

    Enhance expand details in the darker regions of an image at

    the expense of detail in brighter regions.

    ( ) ( rcrTs +== 1log

    The dynamic range of the Fourier coefficients (i.e. the intensity values in the Fourier image)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    34/100

    Exponential transformation

    Log inverse transformation

    Reverse effect of that obtained using logarithmic mapping.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    35/100

    Log transformation

  • 8/2/2019 Image Enhancement in the Spacial Domain

    36/100

    41

    5- Power-Law (Gamma) Transformations

    Basic form is s = c r

    wherec and : positive constants Transformation maps a narrow range of dark input values into a

    wider ranger of output values, with the opposite being true for

    higher value of input levels Family of possible transformation curves obtained simply by

    varying Identity transformation when: c = = 1

    Gamma correction: for displaying an image accurately on acomputer screen

    Too dark

    Washed out

  • 8/2/2019 Image Enhancement in the Spacial Domain

    37/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    38/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    39/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    40/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    41/100

    Image transformation

    Image enhancement

    Image transformation

    pixel point processing

    Intensity transformation with unknown image information

    Intensity transformation with histogram information.

    spatial filtering

  • 8/2/2019 Image Enhancement in the Spacial Domain

    42/100

    Histogram Equalization

    A fully automatic gray-level stretching technique.

    Need to talk about image histograms first ...

  • 8/2/2019 Image Enhancement in the Spacial Domain

    43/100

    Image Histograms

    An image histogram is a plot of the gray-level frequencies (i.e.,

    the number of pixels in the image that have that gray level).

  • 8/2/2019 Image Enhancement in the Spacial Domain

    44/100

    Image Histograms (contd)

    Divide frequencies by total number of pixels to represent

    as probabilities.

    Nnp kk /=

  • 8/2/2019 Image Enhancement in the Spacial Domain

    45/100

    Image Histograms (contd)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    46/100

    Properties of Image Histograms

    Histograms clustered at the low end correspond to dark images.

    Histograms clustered at the high end correspond to bright

    images.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    47/100

    Properties of Image Histograms (contd)

    Histograms with small spread correspond to low contrast

    images (i.e., mostly dark, mostly bright, or mostly gray).

    Histograms with wide spread correspond to high contrast

    images.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    48/100

    Properties of Image Histograms (contd)

    Low contrast High contrast

  • 8/2/2019 Image Enhancement in the Spacial Domain

    49/100

    Histogram Equalization

    The main idea is to redistribute the gray-level values uniformly.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    50/100

    Histogram Equalization (contd)

    In practice, the equalized histogram might not be completely

    flat.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    51/100

    Probability - Definitions

    Random experiment: an experiment whose result is not

    certain in advance (e.g., throwing a die)

    Outcome: the result of a random experiment

    Sample space: the set of all possible outcomes (e.g.,

    {1,2,3,4,5,6})

    Event: a subset of the sample space (e.g., obtain an odd

    number in the experiment of throwing a die = {1,3,5})

  • 8/2/2019 Image Enhancement in the Spacial Domain

    52/100

    Random Variables - Review

    A function that assigns a real number to random experiment

    outcomes (i.e., helps to reduce space of possible outcomes)

    X(j)

    X: # of heads

  • 8/2/2019 Image Enhancement in the Spacial Domain

    53/100

    Random Variables - Example

    Consider the experiment of throwing a pair of dice

    Define the r.v. X=sum of dice

    X=x corresponds to the event

  • 8/2/2019 Image Enhancement in the Spacial Domain

    54/100

    Probability density function

    Theprobability density function(pdf) is a real-valued function

    fX(x) describing the density of probability at each point in the

    sample space.

    In the discrete case, this is just a histogram!

    Gaussian

  • 8/2/2019 Image Enhancement in the Spacial Domain

    55/100

    Probability distribution function

    The integral offX(x) defines theprobability distribution function

    FX(x) (i.e., cumulative probability)

    In the discrete case, simply take the sum:

    fX(x) FX(x)

    GaussianfX(a)da

    non-decreasing

  • 8/2/2019 Image Enhancement in the Spacial Domain

    56/100

    Probability distribution function (contd)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    57/100

    Uniform Distribution

    fX(x) FX(x)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    58/100

    Random Variable Transformations

    Suppose Y=T(X)

    e.g., Y=X+1

    If we know fX(x), can we find fY(y)?

    Yes; it can be shown that:

  • 8/2/2019 Image Enhancement in the Spacial Domain

    59/100

    Transformations of r.v. - Example

    =0, =1

    =1, =1

    0

  • 8/2/2019 Image Enhancement in the Spacial Domain

    60/100

    Special transformation!

    1 1( ) ( )

    1( ) [ ( ) ] [ ( ) ] 1

    ( )Y X X x T y x T yX

    dX f y f x f x

    dY f x

    Proof:

  • 8/2/2019 Image Enhancement in the Spacial Domain

    61/100

    Histogram Equalization (contd)

    for PGM images, L=256, k=0,1,2, , 255, rk=k/(L-1)=k/255

  • 8/2/2019 Image Enhancement in the Spacial Domain

    62/100

    Histogram Equalization (contd)

    then, de-normalize:

    skx (L-1)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    63/100

    Histogram Equalization Example

    3 bit

    64 x 64 image

    input histogram equalized histogram

  • 8/2/2019 Image Enhancement in the Spacial Domain

    64/100

    Histogram Equalization Examples

    equalized images and histogramsoriginal images and histograms

  • 8/2/2019 Image Enhancement in the Spacial Domain

    65/100

    Histogram matching

    The desired shape of histogram is specified (not

    necessarily uniform)

    Derivation of histogram matching function:

    s

    uniform

    r

    inputz

    desireds=T(r)

    histogram

    equalization

    s=G(z)

    z=G

    -1

    (s)

    z=G-1(T(r))

    histogram

    equalization

  • 8/2/2019 Image Enhancement in the Spacial Domain

    66/100

    Histogram Matching

    To generate a processed image that has a specified

    histogram. (pz(z) is the specified probability density

    function)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    67/100

    Implementation

    Inversefunction

    of G

  • 8/2/2019 Image Enhancement in the Spacial Domain

    68/100

    Histogram Specification Example

    3 bit

    64 x 64 image

    specified histogram

    actual histogram

    input histogram

  • 8/2/2019 Image Enhancement in the Spacial Domain

    69/100

    Histogram Statistics

    1

    0

    ( ) ( ) ( )L

    n

    n i i

    i

    r r m p r

    1

    0

    ( )L

    i i

    i

    m r p r

    1 1

    0 0

    1( , )

    M N

    x y

    f x yMN

    12 2

    2

    0

    ( ) ( ) ( )L

    i i

    i

    r r m p r

    1 1 2

    0 0

    1 ( , )M N

    x y

    f x y mMN

    n-th momentaround mean

    Variance(2nd moment)

    Useful for estimating image contrast!

    Mean(average intensity)

  • 8/2/2019 Image Enhancement in the Spacial Domain

    70/100

  • 8/2/2019 Image Enhancement in the Spacial Domain

    71/100

    Local Histogram Statistics

    12 2

    0

    Local variance

    ( ) ( ) xy xy xy

    L

    s i s s i

    i

    r m p r

    1

    0

    Local average intensity

    ( )

    denotes a neighborhood

    xy xy

    L

    s i s ii

    xy

    m r p r

    s

  • 8/2/2019 Image Enhancement in the Spacial Domain

    72/100

    Using Histogram Statistics

    for Image Enhancement

    Useful when parts of the image might contain hidden

    features.

    Task: enhance darkareas without changing

    bright areas.

    Idea: Find dark, low contrastareas using local statistics.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    73/100

    Using Histogram Statistics

    for Image Enhancement: Example

    0 1 2

    0 1 2

    ( , ), if and( , )

    ( , ), otherwise

    : global mean; : global standard deviation

    0.4; 0.02; 0.4; 4

    xy xys G G s G

    G G

    E f x y m k m k k g x y

    f x y

    m

    k k k E

  • 8/2/2019 Image Enhancement in the Spacial Domain

    74/100

    Image transformation

    Image enhancement

    Image transformation

    pixel point processing

    Intensity transformation with unknown image information

    Intensity transformation with histogram information.

    spatial filtering

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    75/100

    Image Enhancement in theSpatial Domain

    Enhancement Using

    Arithmetic/Logic Operations1. Arithmetic/logic operations involving images

    are performed on a pixel-by-pixel basisbetween two or more images (this excludes thelogic operation NOT, which is performed on asingle image).

    2. The AND and OR operations are used formasking: that is for selecting subimages in animage.

    3. Image multiplication finds use in enhancementprimarily as a masking operation that is moregeneral than the logical masks, since it canimplement gray-level rather than binary masks.

    Chapter 3h h

  • 8/2/2019 Image Enhancement in the Spacial Domain

    76/100

    Image Enhancement in theSpatial Domain

    Chapter 3I E h t i th

  • 8/2/2019 Image Enhancement in the Spacial Domain

    77/100

    Image Enhancement in theSpatial Domain

    Image Subtraction1. The difference between two images f(x, y) and h(x,y) is expressed as

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

    2. The key usefulness of subtraction is the enhancement ofdifferences

    between images.

    3. higher-order bit planes of an image carry a significant amount of visually relevant detail,

    while the lower planes contribute more to fine (often imperceptible) details. If these lowerplanes are extracted out , by subtracting the higher-order bit planes image form the original

    image . Then we can enhance these fine details of the image.

    4. we note also that change detection via image subtraction

    finds another major application in the area of segmentation. Basically, segmentation

    techniques attempt to subdivide an image into regions based on a specified criterion. Image

    subtraction for segmentation is used when the criterion is "changes." For instance, in tracking(segmenting) moving vehicles in a sequence of images, subtraction is used to remove

    all stationary components in an image. What is left should be the moving elements

    in the image, plus noise.

    Chapter 3I E h t i th

  • 8/2/2019 Image Enhancement in the Spacial Domain

    78/100

    Image Enhancement in theSpatial Domain

  • 8/2/2019 Image Enhancement in the Spacial Domain

    79/100

    Chapter 3Image Enhancement in the

    Spatial Domain

    Image Averaging1- Consider a noisy image g(x, y ) formed by the addition of noise (x, y) to an

    original imagef(x, y); that is,

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

    2- The assumption is that at every pair of coordinates (x, y) the noise is uncorrelated,and

    has zero average value.

    E((x,y,t)* (x,y,t+))=0 ; for 0; = for =0.

    E((x,y,t))=0.

    3- The objective of the Averaging procedure is to reduce the noise content by adding a set

    of noisy images, {gi( x, y)}. If the noise satisfies the constraints just stated, if an image

    (x, y) is formed by averaging K different noisy images,then

  • 8/2/2019 Image Enhancement in the Spacial Domain

    80/100

    Chapter 3Image Enhancement in the

    Spatial Domain Then it follows that

    E{ (x, y)} = f(x, y) And

    As K increases, indicates that the variability (noise) ofthe

    pixel values at each location (x, y) decreases, and hence E{g(x,

    y)} f(x, y). This means that (x, y) approaches f(x, y) as the

    number of noisy images usedin the averaging process

    increases.

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    81/100

    Image Enhancement in theSpatial Domain

    Chapter 3I E h t i th

  • 8/2/2019 Image Enhancement in the Spacial Domain

    82/100

    Image Enhancement in theSpatial Domain

    Spatial Filtering1- Filtering is neighborhood operations work with the values of the image pixels in the neighborhood

    and the corresponding values of a subimage that has the same dimensions as the neighborhood.

    2- The subimage is called afilter, mask,kernel, template, or window, the first three terms being the

    most prevalent terminology. The values in a filter subimage are referred to as coefficients, rather

    than pixels.

    3- The process consists simply of moving the filter mask from point to point in an image.

    4- Spatial filters categorized in to two groups linear spatial filtering and non linear spatial filtering .

    5- For linear spatial the response is given by a sum of products of the filter coefficients and the

    corresponding image pixels in the area spanned by the filter mask.

    6- In general, linear filtering of an imagef of size M X N with a filter wmaskofsize m X n is given by

    the expression:

    a = (m - 1)/2 and b = (n -1 )/2.

    To generate a complete filtered image this equation must be applied forx = 0,1,2,.. , M - 1 andy = 0, 1,2,

    .... N - 1.From the above equation m &n are odd numbers.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    83/100

    Chapter 3Image Enhancement in the

    Spatial Domain

    With the previous approach, there will be bands of pixelsnear the border that will have been processed with a partialfilter mask.

    Other approaches include "padding" the image by addingrows and columns of O's (or other constant gray level), orpadding by replicating rows and columns,or Mirroring .The padding is then stripped off at the end of the process.This keeps the size of the filtered image the same as the

    original. but the values of the padding will have an effectnear the edges that becomes more prevalentas the size ofthe mask increases.

  • 8/2/2019 Image Enhancement in the Spacial Domain

    84/100

    Chapter 3Image Enhancement in the

    Spatial Domain

    Chapter 3

  • 8/2/2019 Image Enhancement in the Spacial Domain

    85/100

    Chapter 3Image Enhancement in the

    Spatial DomainSmoothing Spatial Filters

    1- Smoothing filters are used for blurring and for noise reduction. Blurring isused in preprocessing steps, such as removal of small details from an imageprior to (large) object extraction.And bridging of small gaps in lines or curves.

    Noise reduction can be accomplished by blurring with a linear filter and alsoby nonlinear filtering.

    2- The output (response) of a smoothing. linear spatial filter is simply the average of thepixels contained in the neighborhood of the filter mask. These filters sometimes arecalled averaging filters.

    3- This process results in an image with reduced "sharp" transitions in gray levels. Because

    random noise typically consists of sharp transitions in gray levels. the most obviousapplication of smoothing is noise reduction. However edges (which almost always aredesirable features of an image) also are characterized by sharp transitions in gray levels.So averaging filters have the undesirable side effect that they blur edges.

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    86/100

    Image Enhancement in theSpatial Domain

    1- Another application of this type of process includes the smoothing of false contours that

    result from using an insufficient number of gray levels

    2- A major use of averaging filters is in the reduction of "irrelevant" detail in an image. By

    "irrelevant" we mean pixel regions that are small with respect to the size of the filter mask.

    3- The averaging scheme deployed here can be the conventional one (summing and divide by

    the number of entities) or using a weight to each individual pixel targeted by the MASK .

    4- The general implementation for filtering an MxN image with a weighted averaging filter of

    size mX n (m and nodd) is given by the expression:

    5- From the expression smoothing filters are linear spatial filters.

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    87/100

    Spatial Domain

    As mentioned earlier, an important application of spatial averaging is to blure the imagefor

    the purpose getting a gross representation of objects of interest, such that the intensity of

    smaller objects blends with the background and larger objects become "bloblike" and easy to

    detect. The size of the mask establishes the relative size of the objects that will be blended

    with the

    Background.

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    88/100

    gSpatial Domain

    Non Linear Spatial Filter1- Nonlinear spatial filters also operate on neighborhoods, and the mechanics of sliding a mask

    past an image are the same as was just outlined. In general, however, the filtering operation is

    based conditionally on the values of the pixels in the neighborhood under consideration, and

    they do not explicitly use coefficients in the sum-of-products manner described.

    2- Order-statistics filters are nonlinear spatial filters whose response is based on ordering

    (ranking)the pixels contained in the image area encompassed by the filter. Then replacing

    the value of the center pixel with the value determined by the ranking result.

    3- Median filters are Order-statistics filters replaces the value of the centre pixel value with

    the Median of the gray levels in the neighborhood of that pixel and the pixel. Median filters

    are quite popular because for certain types of random noise. They proivde excellent

    noise-reduction capabilities, with considerably less blurring than linear smoothing filters of

    similar size. Median filters arce particularlv effective in the presence ofimpulse noise also

    called salt-And-pepper Noise because of its appearance as white and black dots superimposed

    on an image.4- In fact, isolated clusters of pixels that are light or dark with respect to their neighbors, and

    whose area is less than n^2/2 (one-half the filter area), are eliminated by an n X n median

    filter.

    Chapter 3

    Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    89/100

    Image Enhancement in theSpatial Domain

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    90/100

    gSpatial Domain

    Sharpening Spatial Filters1- Principal objective of sharpening is to highlight fine detail in animage or to enhance detail that has been blurred, either in error or as

    a natural effect of a particular method of image acquisition.

    2- Sharpening could be accomplished by spatial differentiation.Fundamentally, the strength of the response of a derivative operator

    is proportional to the degree of discontinuity of the image at the

    point at which the operator is applied. Thus, image differentiation

    enhances edges and other discontinuities (such as noise) and

    deemphasizes areas with slowly varying gray-level values

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    91/100

    Image Enhancement in theSpatial Domain

    The derivatives of a digital function are defined in terms of

    differences. There are various ways to define these differences.

    However, we require that and definition we use for a first derivative

    (1) must be zero in flat segments (areas of constant gray-level

    values); (2) must be nonzero at the onset of a gray-level step or

    ramp; and (3) must be nonzero along ramps. Similarly, anydefinition ofa second derivative (1) must be zero in flat areas; (2)

    must be nonzero at the

    onset and end of a gray-level step or ramp; and (3) must be zero

    along ramps of constant slope. Since we are dealing with digital

    quantities whose values are finite, the maximum possible gray-levelchange also is finite, and the shortest distance over which that

    change can occur is between adjacent pixels.

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    92/100

    age a ce e eSpatial Domain

    1- A basic definition of the first-order derivative of a one-dimensional function

    f(x) is the difference:

    Similarly, we define a second-order derivative as the difference:

    2- It is easily verified that these two definitions satisfy the conditions stated previously

    regarding derivatives of the first and second order.

    3- In summary. comparing the response between first- and second-order derivatives. we arriveat the following conclusions. (l) First -order derivatives generally produce thicker edges in animage. (2) Second-order derivatives have a stronger response to fine detail , such as thin lines

    and isolated points. (3) First-order derivatives generally have a stronger response to a gray-level step. (4) Second-order derivatives produce a double response at step changes in graylevel. We also note of second-order derivatives that for similar changes in gray-level values inan image. Their response is stronger to a line than to a step. and to a point than to a line.

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    93/100

    Image Enhancement in theSpatial Domain

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    94/100

    gSpatial Domain

    The Laplacian

    1- The simplest isotropic derivative operator is theLaplacian, which, for a function(image)f(x,y)of two variables, is defined as:

    2- The digital implementation of the two-dimensional Laplacian with recalling the previous

    definition of the second derivatitor, and obtained by summing these two components:

    Which gives an isotropic result for rotations in increments of 90 deg.

    3- The diagonal directions can be incorporated in the definition of the digital Laplacian by adding

    two more terms , one for each of the two diagonal directions . The total subtracted from the

    difference terms now would be -8f(x, y).

    4- Because the Laplacian is a derivative operator. Its use highlights gray-level discontinuities in

    an image and deemphasizes regions with slowly varying gray levels. This will tend to produceimages that have grayish edge lines and other discontinuities all superimposed on a dark.

    featureless background.

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    95/100

    Spatial Domain

    Chapter 3Image Enhancement in the

    S ti l D i

  • 8/2/2019 Image Enhancement in the Spacial Domain

    96/100

    Spatial Domain

    The basic way in which we use the Laplacian for image enhancement is as follows:

    g(x,y)= if the center coefficient of the Laplacian mask is negative.

    g(x,y)= if the center coefficient of the Laplacian mask is positive.

    Chapter 3Image Enhancement in the

  • 8/2/2019 Image Enhancement in the Spacial Domain

    97/100

    gSpatial Domain

    1- Other way of generating a sharpened Immage as laplacian is

    to subtract a blurred image version from the original .)

    2- A slight further generalization of sharpping is called high-boost filtering. A high-boost filtered image is defined at any

    point (x, y) as:g(x,y)=A if the center coefficient of the Laplacian

    mask is negative.

    g(x,y)= A if the center coefficient of the Laplacianmask is positive.

    If A is large enough, the high-boost image will beapproximately equal to the original image multiplied by aconstant.

    Chapter 3Image Enhancement in the

    S ti l D i

  • 8/2/2019 Image Enhancement in the Spacial Domain

    98/100

    Spatial Domain

  • 8/2/2019 Image Enhancement in the Spacial Domain

    99/100

    Questions???!

  • 8/2/2019 Image Enhancement in the Spacial Domain

    100/100

    References

    R.C.Gonzalez, R.E.Woods. 2002.Digital Image Processing. 2ndEdition. s.l. : Prentice Hall, 2002.

    http://www.imageprocessingplace.com/downloads_V3/dip3e_downl

    oads/dip3e_classroom_presentations/DIP3E_CH03_Art_PowerPoint

    .zip

    http://www.cse.unr.edu/~bebis/CS474/Lectures/IntensityTransforma

    tions.ppt

    www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppt

    ebookbrowse.com/3-digital-image-processing-ppt-d178445572

    moodle.ncnu.edu.tw/mod/resource/view.php?id=88282

    http://www.cs.bgu.ac.il/~klara/ATCS111/Intensity%20Transformati

    on%20and%20Spatial%20Filtering%20-

    http://www.imageprocessingplace.com/downloads_V3/dip3e_downloads/dip3e_classroom_presentations/DIP3E_CH03_Art_PowerPoint.ziphttp://www.imageprocessingplace.com/downloads_V3/dip3e_downloads/dip3e_classroom_presentations/DIP3E_CH03_Art_PowerPoint.ziphttp://www.imageprocessingplace.com/downloads_V3/dip3e_downloads/dip3e_classroom_presentations/DIP3E_CH03_Art_PowerPoint.ziphttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.moodle.ncnu.edu.tw/mod/resource/view.php?id=88282http://www.cs.bgu.ac.il/~klara/ATCS111/Intensity%20Transformation%20and%20Spatial%20Filtering%20-Gonzales%20Chapter%203.1-3.3.ppthttp://www.cs.bgu.ac.il/~klara/ATCS111/Intensity%20Transformation%20and%20Spatial%20Filtering%20-Gonzales%20Chapter%203.1-3.3.ppthttp://www.cs.bgu.ac.il/~klara/ATCS111/Intensity%20Transformation%20and%20Spatial%20Filtering%20-Gonzales%20Chapter%203.1-3.3.ppthttp://www.cs.bgu.ac.il/~klara/ATCS111/Intensity%20Transformation%20and%20Spatial%20Filtering%20-Gonzales%20Chapter%203.1-3.3.ppthttp://www.cs.bgu.ac.il/~klara/ATCS111/Intensity%20Transformation%20and%20Spatial%20Filtering%20-Gonzales%20Chapter%203.1-3.3.ppthttp://www.moodle.ncnu.edu.tw/mod/resource/view.php?id=88282http://www.moodle.ncnu.edu.tw/mod/resource/view.php?id=88282http://www.moodle.ncnu.edu.tw/mod/resource/view.php?id=88282http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.ebookbrowse.com/3-digital-image-processing-ppt-d178445572http://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.kau.edu.sa/GetFile.aspx?id=94771&fn=CS482_3.ppthttp://www.imageprocessingplace.com/downloads_V3/dip3e_downloads/dip3e_classroom_presentations/DIP3E_CH03_Art_PowerPoint.ziphttp://www.imageprocessingplace.com/downloads_V3/dip3e_downloads/dip3e_classroom_presentations/DIP3E_CH03_Art_PowerPoint.ziphttp://www.imageprocessingplace.com/downloads_V3/dip3e_downloads/dip3e_classroom_presentations/DIP3E_CH03_Art_PowerPoint.zip