0% found this document useful (0 votes)
69 views

Spatial Filtering For Smoothing: Is Usually Used in Preprocessing Steps

Spatial filtering can be used for smoothing (blurring) images to reduce noise or enhance edges. Smoothing is done by averaging pixel values within a neighborhood mask, equivalent to low-pass filtering. Median filtering is also used for smoothing, assigning the median value within the mask to reduce impulse noise while preserving edges. Image sharpening can be done with high-pass filters like unsharp masking, subtracting a blurred image from the original to enhance details. Derivative filters like the Laplacian are also used for sharpening, emphasizing edges by detecting intensity changes.

Uploaded by

Ahmad
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Spatial Filtering For Smoothing: Is Usually Used in Preprocessing Steps

Spatial filtering can be used for smoothing (blurring) images to reduce noise or enhance edges. Smoothing is done by averaging pixel values within a neighborhood mask, equivalent to low-pass filtering. Median filtering is also used for smoothing, assigning the median value within the mask to reduce impulse noise while preserving edges. Image sharpening can be done with high-pass filters like unsharp masking, subtracting a blurred image from the original to enhance details. Derivative filters like the Laplacian are also used for sharpening, emphasizing edges by detecting intensity changes.

Uploaded by

Ahmad
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

Spatial filtering for Smoothing

 For blurring/noise reduction;


 Blurring is usually used in preprocessing steps,
e.g., to remove small details from an image prior to object
extraction, or to bridge small gaps in lines or curves
 Equivalent to Low-pass filtering in frequency domain because
smaller (high frequency) details are removed based on
neighborhood averaging (averaging filters)
 Implementation: simplest form: averaging with a square mask
(assume m×m mask) with the all coefficients equal
to 1/m2 (averaging).
 Applications: Reduce noise; smooth false contours
 Side effect: Edge blurring

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 1


Smoothing filters

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 2


Spatial filtering for Smoothing (example)

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 3


Spatial filtering for Smoothing (example)

Original image Smoothed by


size: 500 x 500 3 x 3 box filter

Smoothed by Smoothed by
5 x 5 box filter 9 x 9 box filter

Smoothed by Smoothed by
15 x 15 box filter 35 x 35 box filter

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 4


Order-statistics filtering
 Nonlinear spatial filters
 Output is based on order of gray levels in mask (subimage)
 Examples: Median filtering, Max & Min filtering
Median filtering
 Assigns the mid value of all the gray levels in the mask to the
center of mask;
 Particularly effective when
– noise pattern consists of strong, spiky components (impulse
noise, salt-and-pepper
– edges are to be preserved
– Force pixels with distinct gray levels to be more like their
neighbors

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 5


Median Filtering

Output ?

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 6


Median Filtering (example)

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 7


Spatial filtering for image sharpening
Background: To highlight fine detail in an image or to
enhance blurred detail
Applications: Electronic printing, medical imaging,
industrial inspection, autonomous target
detection (smart weapons)......
Foundation:
 Blurring/smoothing is performed by spatial averaging
(equivalent to integration)
 Sharpening is performed by noting only the gray level
changes in the image that is the differentiation

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 8


Spatial filtering for image sharpening
Operation of Image Differentiation
 Enhance edges and discontinuities
 De-emphasize areas with slowly varying gray-level
values
Mathematical Basis of Filtering for Image Sharpening
 Implementation by mask filtering
 First-order and second-order derivatives

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 9


Sharpening Filters: Unsharp Masking
 Obtain a sharp image by subtracting a lowpass filtered (i.e., smoothed) image
from the original image:

- =
10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 10
Sharpening Filters: Unsharp Masking (cont’d)
 If A=1, we get a high pass filter
 If A>1, part of the original image is added back to the high pass filtered image.

A=1.4 A=1.9

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 11


Unsharp Masking (cont’d)

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 12


Image sharpening (High-Pass Filters)
 Spatial filters whose effect on the output image is
equivalent to preserving or emphasizing its high-
frequency components (e.g., fine details, points, lines,
and edges), i.e. to highlight transitions in intensity within
the image.

 Linear HPFs can be implemented using 2D masks with


positive and negative weights / coefficients, (Laplacian, a
simple, isotropic (i.e., rotation invariant) second-order
derivative)

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 13


First-order and second-order derivatives

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 14


Example

2D convolution
(center location only)

The filter factors


into a product of 1D
filters:

Perform convolution
along rows: * =

Followed by convolution
along the remaining column: * =
Example for discrete derivatives

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 16


Example for discrete derivatives

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 17


Various situations encountered for derivatives

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 18


Various situations encountered for derivatives

 Ramps or steps in the 1D profile normally characterize


the edges in an image
 f ″ is nonzero at the onset and end of the ramp:
produces thin (double) edges
 f ′ is nonzero along the entire ramp: produces thick edges

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 19


Various situations encountered for derivatives
 Thin lines

 Isolated point

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 20


Comparison between f" and f´
 f´ generally produce thicker edges in an image
 f" have a stronger response to fine detail
 f´ generally have a stronger response to a gray-level step
 f" produces double response at step changes in gray level
 f" responses given similar changes in gray-level values
point > step > line
 For image enhancement, f" is generally better suited
than f´
 Major application of f´ is for edge extraction;
f´ used together with f" results in impressive
enhancement effect

10/28/21 COMSATS IIT, Lahore -- Special Topics in Image Processing -- CSC857 21

You might also like