0% found this document useful (0 votes)
35 views24 pages

A Filtering Method Is When The Output Is A Weighted Sum of The Input Pixels

The document discusses linear and non-linear spatial filtering methods. Linear filtering methods, like correlation and convolution, produce an output that is a weighted sum of the input pixels. Non-linear methods, like median filtering, do not satisfy this property. Common linear filters include averaging and Gaussian filters for smoothing, and high-pass filters for sharpening. Non-linear median filtering is effective for removing salt-and-pepper noise.

Uploaded by

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

A Filtering Method Is When The Output Is A Weighted Sum of The Input Pixels

The document discusses linear and non-linear spatial filtering methods. Linear filtering methods, like correlation and convolution, produce an output that is a weighted sum of the input pixels. Non-linear methods, like median filtering, do not satisfy this property. Common linear filters include averaging and Gaussian filters for smoothing, and high-pass filters for sharpening. Non-linear median filtering is effective for removing salt-and-pepper noise.

Uploaded by

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

Linear vs Non-Linear

Spatial Filtering
 A filtering method is linear when the output is a weighted
sum of the input pixels.

 Methods that do not satisfy the above property are called


non-linear.

10/28/21 1
Example

10 5 3 0 0 0
4 6 1 0 0.5 0 8
1 1 8 0 1 0.5
Local image mask Modified image data
neighborhood

10/28/21 2
Example

10/28/21 3
Linear Spatial Filtering

 Two main linear spatial filtering methods:

– Correlation
– Convolution

10/28/21 4
Correlation

w(i,j)

f(i,j)

K /2 K /2
g ( x, y )  w( x, y )  f ( x, y )   
s  K /2 t  K /2
w( s, t ) f ( x  s, y  t )

10/28/21 5
Correlation

Often used in applications where


we need to measure the similarity
between images or parts of images
(e.g., pattern matching).

10/28/21 6
Correlation

• Measure the similarity between images or parts of images.

mask

10/28/21 7
Normalized Correlation

10/28/21 8
Correlation (cont’d)

• Traditional correlation cannot handle changes due to:

• size
• orientation
• shape (e.g., deformable objects).

10/28/21 9
Convolution
 Similar to correlation except that the mask is first flipped
both horizontally and vertically.

K /2 K /2
g ( x, y )  w( x, y )  f ( x, y )   
s  K /2 t  K /2
w( s, t ) f ( x  s, y  t )

 Note: if w(x,y) is symmetric, that is w(x,y)=w(-x,-y),


then convolution is equivalent to correlation !
K /2 K /2
g ( x, y )  w( x, y )  f ( x, y )   
s  K /2 t  K /2
w( s, t ) f ( x  s, y  t )

10/28/21 10
Convolution Vs Correlation

Correlation:

Convolution:

10/28/21 11
How do we choose the elements of a mask ?
 Typically, by sampling certain functions

1st derivative 2nd derivative


Gaussian of Gaussian of Gaussian

10/28/21 12
Gaussian Smoothing

 Idea: replace each pixel by a weighted


average of its neighbors
 Mask weights are computed by sampling a
Gaussian function

Note: weight
values decrease
with distance
from mask
center!

10/28/21 13
Filters
 Smoothing (i.e., low-pass filters)
– Reduce noise and small details.
– The elements of the mask must be positive.
– Sum of mask elements is 1

10/28/21 14
Averaging Filters

10/28/21 15
Filters
 Sharpening (i.e., high-pass filters)
– Highlight fine detail or enhance detail that has been blurred.
– The elements of the mask contain both positive and negative
weights.
– Sum of the mask weights is 0

1st derivative 2nd derivative


of Gaussian of Gaussian

10/28/21 16
Averaging Filters
 Mask size determines the degree of smoothing and loss
of detail

original 3x3 5x5 7x7

15x15 25x25

10/28/21 17
Averaging vs Gaussian Smoothing

Averaging

Gaussian

10/28/21 18
Averaging Filters
 Example: extract, largest, brightest objects

15 x 15 averaging image thresholding

10/28/21 19
Spatial Operations - Neighborhood Operations

10/28/21 20
Smoothing Filters (Non-Linear) (Median)
 Very effective for removing “salt and pepper” noise (i.e.,
random occurrences of black and white pixels).

10/28/21 21
Smoothing Filters (Non-Linear) (Median)
 Replace each pixel by the median in a neighborhood
around the pixel

10/28/21 22
Sharpening Filters (High Pass filtering)
 Useful for emphasizing transitions in image intensity
(e.g., edges).

10/28/21 23
Sharpening Filters (High Pass filtering)
 Note that the response of high-pass filtering might be
negative.
 Values must be re-mapped to [0, 255]

original image sharpened images

10/28/21 24

You might also like