0% found this document useful (0 votes)
68 views12 pages

Image Enhancement in Spatial Domain: Spatial Filtering Anisha M. Lal

Spatial domain image enhancement techniques directly manipulate pixel values. Smoothing spatial filters average pixel neighborhoods to reduce noise and highlight gross image features. Averaging filters simply average pixel values in a neighborhood window, while weighted filters give closer pixels more importance. Median filters can also reduce noise. Smoothing removes image detail and leaves only gross features. Edge pixels require approaches like padding or replication to avoid artifacts.

Uploaded by

Akash Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views12 pages

Image Enhancement in Spatial Domain: Spatial Filtering Anisha M. Lal

Spatial domain image enhancement techniques directly manipulate pixel values. Smoothing spatial filters average pixel neighborhoods to reduce noise and highlight gross image features. Averaging filters simply average pixel values in a neighborhood window, while weighted filters give closer pixels more importance. Median filters can also reduce noise. Smoothing removes image detail and leaves only gross features. Edge pixels require approaches like padding or replication to avoid artifacts.

Uploaded by

Akash Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Image Enhancement

in Spatial Domain
Spatial Filtering
ANISHA M. LAL
Image Enhancement Methods

• Spatial Domain Methods (Image Plane)


Techniques are based on direct manipulation of pixels in
an image
• Frequency Domain Methods
Techniques are based on modifying the Fourier transform
of the image.
• Combination Methods
There are some enhancement techniques based on various
combinations of methods from the first two categories
Statistical Order/Non-Linear Filters
•Some simple neighbourhood operations include:
– Min: Set the pixel value to the minimum in the
neighbourhood
– Max: Set the pixel value to the maximum in the
neighbourhood
– Median: The median value of a set of numbers is
the midpoint value in that set (e.g. from the set [1, 7,
15, 18, 24] 15 is the median). Sometimes the median
works better than the average
Smoothing Spatial Filters
•One of the simplest spatial filtering operations we can
perform is a smoothing operation
• Simply average all of the pixels in a neighbourhood around a
central value
• Especially useful in removing noise from images.
• Also useful for highlighting gross details in the image.
Simple averaging filter
1/ 1/ 1/
11 1 1 9 9 9
1 1 1 1/ 1/ 1/
9
1 1 1 9 9 9
1/ 1/ 1/
9 9 9
Smoothing Spatial Filtering
Origin x
104 100 108 1/ 1/ 1/
9 9 9

99 106 98

95 90 85
* 1/

1/
9
1/

1/
9
1/

1/
9

9 9 9

1/ 100
104
9
1/ 108
9
1/
9
Original Image Filter
Simple 3*3 1/ 1/ 1/
3*3 Smoothing Pixels
999 106
9 989
Neighbourhood 195
/9 190
/9 185
/9
Filter
e = 1/9*106 +
1/ *104 + 1/ *100 + 1/ *108 +
9 9 9
1/ *99 + 1/ *98 +
9 9
y Image f (x, y) 1/ *95 + 1/ *90 + 1/ *85
9 9 9
= 98.3333
The above is repeated for every pixel in the original image to
generate the smoothed image.
Image Smoothing Example

•The image at the top left


is an original image of
size 500*500 pixels.
•The subsequent images
show the image after
filtering with an averaging
filter of increasing sizes
• 3, 5, 9, 15 and 35
•Notice how detail begins
to disappear
Weighted Smoothing Filters
•More effective smoothing filters can be generated by allowing
different pixels in the neighbourhood different weights in the
averaging function.
• Pixels closer to the central pixel are more important and given
more weightage.
• Often referred to as a weighted averaging filter.
1/ 2/ 1/
16 16 16 Weighted averaging
1 1 2 1
16
2 4 2 2/ 4/ 2/ filter
1 2 1 16 16 16
1/ 2/ 1/
16 16 16
Another Smoothing Example

•By smoothing the original image we get rid of lots of the finer
detail which leaves only the gross features for thresholding.

Original Image Smoothed Image Thresholded Image


Averaging Filter Vs. Median Filter
Example

Original Image Image After Image After


With Noise Averaging Filter Median Filter
•Filtering is often used to remove noise from images.
•Sometimes a median filter works better than an averaging filter.
Strange Things Happen At The
Edges! (cont…)
•There are a few approaches to dealing with 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 black pixels
• Replicate border pixels
• Truncate the image
• Allow pixels wrap around the image
• Can cause some strange image artifacts.
Strange Things Happen At The Edges! (cont…)

Filtered Image: Zero


Padding

Original Filtered Image: Replicate


Image Edge Pixels

Filtered Image:
Wrap Around Edge Pixels
Examples
• Zero Padding • Pixel Replication
00000 11233
01230 11233
04560 44566
07890 77899
00000 77899

• Wrapping of pixels
97897
31231
64564
97897
31231

You might also like