Digital Image Processing - PowerPoint PPT Presentation

1 / 40
About This Presentation
Title:

Digital Image Processing

Description:

Digital Image Processing Image Enhancement Spatial Filtering – PowerPoint PPT presentation

Number of Views:103
Avg rating:3.0/5.0
Slides: 41
Provided by: abc51
Category:

less

Transcript and Presenter's Notes

Title: Digital Image Processing


1
Digital Image Processing
  • Image Enhancement
  • Spatial Filtering

2
Image Enhancement Spatial Filtering
  • Image enhancement in the spatial domain can be
    represented as
  • g(m,n) T(f)(m,n)
  • The transformation T maybe linear or nonlinear.
    We will mainly study linear operators T but
    will see one important nonlinear operation.

Transformation
Enhanced Image
Given Image
3
How to specify T
  • If the operator T is linear and shift
    invariant (LSI), characterized by the
    point-spread sequence (PSS) h(m,n) , then
    (recall convolution)

4
How to specify T
  • In practice, to reduce computations, h(m,n)
    is of finite extent
  • h(k,l) 0 for (k,l) ? ?
  • where D is a small set (called neighborhood). D
    is also called as the support of h.
  • In the frequency domain, this can be represented
    as
  • G(u,v) He(u,v) Fe(u,v)
  • where He(u,v) and Fe(u,v) are obtained after
    appropriate zeropadding.

5
How to specify T
  • Many LSI operations can be interpreted in
    the frequency domain as a filtering operation.
    It has the effect of filtering frequency
    components (passing certain frequency components
    and stopping others).
  • The term filtering is generally associated
    with such operations.

6
How to specify T
  • Examples of some common filters (1-D case)

Lowpass filter
Highpass filter
7
  • If h(m, n) is a 3 by 3 mask given by
  • then

w1 w2 w3
h w4 w5 w6
w7 w8 w9
8
  • The output g(m, n) is computed by sliding the
    mask over each pixel of the image f(m, n).
    This filtering procedure is sometimes referred
    to as moving average filter.
  • Special care is required for the pixels at
    the border of image f(m, n). This depends on
    the so-called boundary condition. Common
    choices are
  • The mask is truncated at the border (free
    boundary)
  • 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
    constant (fixed boundary).
  • The boundaries wrap around (periodic boundary).

9
  • In any case, the final output g(m, n) is
    restricted to the support of the original image
    f(m, n).
  • The mask operation can be implemented in MATLAB
    using the filter2 command, which is based
    on the conv2 command.

10
Smoothing Filters
  • 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 grayvalues.
  • Smoothing filters are used for
  • Blurring This is usually a preprocessing step
    for removing small (unwanted) details before
    extracting the relevant (large) object,
    bridging gaps in lines/curves,
  • Noise reduction Mitigate the effect of noise
    by linear or nonlinear operations.

11
Image smoothing by averaging (lowpass
spatial filtering)
  • Smoothing is accomplished by applying an
    averaging mask.
  • 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
  • This operation is equivalent to lowpass
    filtering.

12
Example of Image Blurring
Original Image
Avg. Mask
13
Example of Image Blurring
N 3
N 7
14
Example of Image Blurring
N 11
N 21
15
Example of noise reduction
Noise-free Image
16
Example of noise reduction
Zero-mean Gaussian noise, Variance 0.01
17
Example of noise reduction
Zero-mean Gaussian noise, Variance 0.05
18
Median Filtering
  • The averaging filter is best suited for noise
    whose distribution is Gaussian
  • The averaging filter typically blurs edges and
    sharp details.
  • The median filter usually does a better job of
    preserving edges.
  • Median filter is particularly suited if the noise
    pattern exhibits strong (positive and negative)
    spikes. Example salt and pepper noise.

19
Median Filtering
  • Median filter is a nonlinear filter, that also
    uses a mask. Each pixel is replaced by the median
    of the pixel values in a neighborhood of the
    given pixel.
  • Suppose A a1, a2, , ak are the pixel values
    in a neighborhood of a given pixel with a1 ? a2 ?
    ? ak. Then
  • Note Median of a set of values is the center
    value, after sorting.
  • For example If A 0,1,2,4,6,6,10,12,15 then
    median(A) 6.

20
Example of noise reduction
Gaussian noise s 0.2 Salt Pepper noise
prob. 0.2
MSE 0.0337
MSE 0.062
21
Example of noise reduction
Output of 3x3 Averaging filter
MSE 0.0075
MSE 0.0125
22
Example of noise reduction
Output of 3x3 Median filter
MSE 0.0042
MSE 0.0089
23
Image Sharpening
  • This involves highlighting fine details or
    enhancing details that have been blurred.

Before
After Sharpening
24
Basic highpass spatial filtering
  • This can be accomplished by a linear
    shift-invariant operator, implemented by means of
    a mask, with positive and negative coefficients.
  • This is called a sharpening mask, since it tends
    to enhance abrupt graylevel changes in the image.
  • The mask should have a positive coefficient at
    the center and negative coefficients at the
    periphery. The coefficients should sum to zero.

25
Basic highpass spatial filtering
  • Example
  • This is equivalent to highpass filtering.
  • A highpass filtered image g can be thought of as
    the difference between the original image f and a
    lowpass filtered version of f
  • g(m,n) f(m,n) lowpass(f(m,n))

26
Example
Original Image
Highpass filtering
27
High-boost filtering
  • This is a filter whose output g is produced by
    subtracting a lowpass (blurred) version of f from
    an amplified version of f
  • g(m,n) Af(m,n) lowpass(f(m,n))
  • This is also referred to as unsharp masking.

28
High-boost filtering
  • Observe that
  • g(m,n) Af(m,n) lowpass(f(m,n))
  • (A-1)f(m,n) f(m,n) lowpass(f(m,n))
  • (A-1)f(m,n) hipass(f(m,n))
  • For 1 gt A , part of the original image is added
    back to the highpass filtered version of f.
  • The result is the original image with the edges
    enhanced relative to the original image.

29
Example
Original Image
Highpass filtering
High-boost filtering
30
Derivative filter
  • Averaging tends to blur details in an image.
    Averaging involves summation or integration.
  • Naturally, differentiation or differencing
    would tend to enhance abrupt changes, i.e.,
    sharpen edges.
  • Most common differentiation operator is the
    gradient

31
Derivative filter
  • The magnitude of the gradient is
  • Discrete approximations to the magnitude of the
    gradient is normally used.

32
Derivative filter
  • Consider the following image region
  • We may use the approximation

z1 z2 z3
z4 z5 z6
z7 z8 z9
33
Derivative filter
  • This can implemented using the masks
  • As follows

34
Derivative filter
  • Alternatively, we may use the approximation
  • This can implemented using the masks
  • As follows

35
Derivative filter
  • The resulting maks are called Roberts
    cross-gradient operators.
  • The Roberts operators and the Prewitt/Sobel
    operators (described later) are used for edge
    detection and are sometimes called edge detectors.

36
Example Roberts cross-gradient operator
37
Example Roberts cross-gradient operator
38
Prewitt operators
  • Better approximations to the gradient can be
    obtained by
  • This can be implemented using the masks
  • as follows

39
Sobel operators
  • Another approximation is given by the masks
  • The resulting masks are called Sobel operators.

40
Example
Prewitt
Sobel
Write a Comment
User Comments (0)
About PowerShow.com