0% found this document useful (0 votes)
10 views44 pages

Lec 6

This lecture discusses various filtering techniques in computer vision, focusing on high pass and low pass filters, as well as the Sobel operator for image gradients. It explains the convolution theorem and the importance of Fourier transforms in filtering processes, highlighting the limitations of ideal low pass filters and the advantages of using Gaussian filters. The lecture concludes with a mention of other filter types such as median and bilateral filters.

Uploaded by

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

Lec 6

This lecture discusses various filtering techniques in computer vision, focusing on high pass and low pass filters, as well as the Sobel operator for image gradients. It explains the convolution theorem and the importance of Fourier transforms in filtering processes, highlighting the limitations of ideal low pass filters and the advantages of using Gaussian filters. The lecture concludes with a mention of other filter types such as median and bilateral filters.

Uploaded by

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

COMP/ECE/ENGI: COMPUTER

VISION

Lecture 6: Filters and convolutions continued..

COMPUTER VISION www.mun.ca


QUESTIONS?
High pass filter

Suppose H is a low pass filter and F is an image that we want to filter

This gives us enough information to create a high pass filtered version of F

highpass(F) = F - H⊗F


Filters are linear operators

That means

H1 ⊗ F + H2 ⊗ F = (H1 + H2) ⊗ F

This means we can implement our high pass operator as a filter:

F-H⊗F = I⊗F-H⊗F
= (I - H) ⊗ F
Filtering demo

https://setosa.io/ev/image-kernels/
Image gradient

The gradient of an image:

The gradient points in the direction of most rapid change in intensity


Image gradient

How can we differentiate a digital image?

How can we write this as a cross-correlation filter?

-1 1

H[u,v
]
Filtering demo

https://setosa.io/ev/image-kernels/
The Sobel operator

Better approximations of the gradient exist

-1 0 1 1 2 1
⅛ -2 0 2 ⅛ 0 0 0
-1 0 1 -1 -2 -1
The standard definitions of these Sobel filters omit the ⅛ term
● ⅛ not needed for edge detection
● ⅛ is needed to correctly compute gradient values
Low pass filtering
What is the digital version of this filter?

?
Is the Gaussian really a low-pass filter?

If so why?
CMOS sensor
And can we do better?
Fourier Transform

Fourier transform
● Decomposes any signal or image into weighted sum of sines and cosines
Fourier Series

We want to get this function

Following slides from Alyosha Efros


Fourier Series

≈ +

We want to get this function

Following slides from Alyosha Efros


Fourier Series

≈ +

We want to get this function

=
Fourier Series

≈ +

We want to get this function

=
Fourier Series

≈ +

We want to get this function

=
Fourier Series

≈ +

We want to get this function

=
Fourier Series

We want to get this function We’ll get there in the limit


Fourier transform

f(x) |F(𝟂)|
signal Fourier transform of signal
Fourier transform as change of basis

* =
The math

Where are the sines and cosines?

The result is a complex function

We’ve been showing only the amplitude A so far:

Phase is also encoded:


Nice tutorial on Fourier Series
Nice tutorial on Fourier transform
2D Fourier Transform
What does a sine look like in 2D?

http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering
Fourier Transform of an image

f(x,y) |f(𝟂)|
2D Fourier Transform
Low pass filtering in the Fourier domain

h(𝟂) |f(𝟂)|
Low pass filtering in the Fourier domain

h(𝟂) |f(𝟂)|

This is a product of two functions, not a convolution


Low pass filtering in the Fourier domain

f(x,y) |h(𝟂) f(𝟂)| FT-1[h(𝟂)f(𝟂)]


The Convolution Theorem

FT[h﹡f ] = FT[h] FT[f ]


Convolution in the spatial domain = multiplication in the Fourier domain

FT-1[h f ] = FT-1[h ]﹡FT-1[f ]


Works for inverse Fourier transforms too:
Applying the convolution theorem

FT-1 =

FT-1
﹡ FT-1
Applying the convolution theorem

FT-1 =

FT-1
﹡ FT-1
Applying the convolution theorem

FT-1 =


The “ideal” low pass filter

﹡ =
sinc[u,v] F[x,y] G[x,y]

Wait a minute, it still looks soiled!


Remember what happens when you filter an impulse

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0 i h g

0 0 0 1 0 0 0 f e d

0 0 0 0 0 0 0 c b a

H[u,v
0 0 0 0 0 0 0

]
F[x,y G[x,y
0 0 0 0 0 0 0

] ]
This phenomenon with sinc known as “ringing”
Be careful what you wish for...

The “ideal” low-pass filter is not that good


● produces ringing artifacts
● requires infinite size
● seldom what you want anyway

What went wrong?


● Our goal is to remove high frequencies
● Not to pass through all low frequencies untouched
Fade out the high frequencies

f(x,y) |h(𝟂) f(𝟂)| FT-1[h(𝟂)f(𝟂)]


Applying the convolution theorem

FT-1 =


Gaussian(𝛔
)

Gaussian(1/𝛔)
And that’s why filtering with a Gaussian works...

Lesson learned!
● Before you downsample an image, filter with a Gaussian (or similar filter)!
The case
of the
Soiled Van Gogh

SOLVED!
Epilogue
Lots of other types of filters: median

Median pixel value in nxn window


Lots of other types of filters: bilateral

original mean filtered Bilateral filtered

You might also like