03 Image Enhancement in The Frequency Domain (Chapter 04)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

CSE483 Computer Vision

Image Enhancement in the Frequency


Domain
Very incredibly annoying lecture, would be best to
study it in further depth from the book - Chapter 4.

Prof. Mahmoud Khalil


Spring 2022
1
Why do we bother converting to Frequency Domain? This has an overhead of its own of course...
Well, one reason among many is for example JPEG compression which uses frequency domain.

Image Enhancement in the Frequency Domain

2
Image Enhancement in the Frequency Domain

Very hard to point out the


noise in terms of spatial
domain, but once you go
frequency, it's very easy to
notice the strong sinusoidal
noise pattern, which means
over the frequency domain it
will have a strong feedback
and thus be easily removable.

3
Image Enhancement in the Frequency Domain

4
The 1D Continuous Fourier Transform
The continuous Fourier transform

The inverse continuous Fourier transform

5
The 1D Discrete Fourier Transform (DFT)
The 1D discrete Fourier transform

The inverse 1D discrete Fourier transform

6
The 1D Discrete Fourier Transform (DFT)

Each element from both sides has


an effect on all the elements7 of
the other side.
General rule of thumb: If the function width is large, its transform is small. The middle
position would be the Gaussian wave where its input is its output too. Another property
is duality, the input and output are linked in either transformation direction.

The 1D Discrete Fourier Transform (DFT)

8
The 1D Discrete Fourier Transform (DFT)

9
The 1D Discrete Fourier Transform (DFT)

Makes sense that output be an


impulse there. It's already a basis
function (has cosine and sine), so
obviously its value is just one value
in the frequency domain, at the
frequency of the cosine and sine.
10
The 1D Discrete Fourier Transform (DFT)

11
The 1D Discrete Fourier Transform (DFT)

13
The 2D Discrete Fourier Transform (DFT)
The 2D discrete Fourier transform

u: horizontal axis
v: vertical axis

The 2D inverse discrete Fourier transform

14
The 2D Discrete Fourier Transform (DFT)

Both are sized M*N

15
The 2D Discrete Fourier Transform (DFT)

16
Image Enhancement in the Frequency Domain

Relative to the image above,


this one is wider, hence its
transform will be less wide.
17
In the previous slide, when the wave was wide, its transform was thin, and vice versa...
Here, you have a 2D rectangle in the spatial domain. Its transform will thus also be a rectangle. As for the
dimensions, apply the same thinking: The wider dimension in spatial domain will be the thinner one in freq.

Image Enhancement in the Frequency Domain


Notice that the width of the horizontal
blocks is smaller than the vertical ones;
while the original image was wider
horizontally than vertically...

18

Note how the "y" and "v" axes are in the same direction (even though they are
Notice how the origin is
horizontal while they should be vertical but whatever) and the "x" and "u" too. centered in freq. domain.
Translation Eqn in the end.
Fourier Transform ‐ Examples
2D Image 2D Image - Rotated

Fourier Spectrum Fourier Spectrum

19
Fourier Transform ‐ Examples
Image Frequency
Domain Domain

23
Fourier Transform ‐ Examples
Image
Fourier spectrum

28
Image Enhancement in the Frequency Domain

Notice how everything above has a feedback


here, perpendicular to it. The most notable:
(1) El beta3a ely beyed8at biha di
(2) The thing that is being pressed
29
(3) The edges of the squared things under
The Fourier Image Plotting the log helps us see all the values better, cause
if naturally the difference between the very low and
very high values is big, the log reduces that difference.
This difference is usually large for real pictures naturally.

Fourier spectrum |F(u,v)| Fourier spectrum log(1 + |F(u,v)|)


Image f

30
Frequency Bands

Image Fourier Spectrum

Percentage of image power enclosed in circles (small to large) :

90%, 95%, 98%, 99%, 99.5%, 99.9%

31
Image Enhancement in the Frequency Domain

32
Image Enhancement in the Frequency Domain

This will have a global effect since as we


mentioned earlier each component has an
effect on all the other components, and
also as observed the central components
are usually the strongest... In fact, F(0, 0) is
the DC component of the transform! So,
setting it to 0 means everything will move
down greatly, some going negative,
meaning that we'll need to add some value 33
to the result image to be able to see it
(obv. though if we re-add the DC value it'd
be back to how it was lol)
Observe how LPF looks like smoothing,
and HPF looks like sharpening... 34
Image Enhancement in the Frequency Domain

35
Image Enhancement in the Frequency Domain

Mexican Hat

These curves at the bottom, the


fourier transforms of the HPF and
LPF above, make sense to be the
36
continuous versions of their
corresponding masks (specifically
the ones pointed at), so yeah...
LPF = Smoothen, HPF = Sharpen
Laplacian Filter in the Frequency Domain

37
Problem 4.27 The fact that he said "averages" means
he didn't need to tell you it'll be lowpass
Suppose that you form a lowpass spatial filter that averages
the four immediate neighbors of a point (x, y) but excludes
the point itself.

(a) Find the equivalent filter H(u, v) in the frequency


domain.

(b) Show that your result is a lowpass filter.


It has cosines, cosines look like a lowpass hull. Done.

38
Ideal Lowpass Filters

The hyper-parameter,
the cut-off frequency.

39
Ideal Lowpass Filters

40
Ideal Lowpass Filters

41
These filters perform compression, but the result should still look proper to be
acceptable... The ringing we saw previously was a violation of the rule that we
said earlier for averaging filters, where if an area is smooth, it must stay so.

Butterworth Lowpass Filters


The higher the n, the
more ideal it gets, the
more ringing that occurs

So now there are two hyper-parametrs, the


cut-off frequency D0 and the filter order n.

43
Butterworth Lowpass Filters

44
Butterworth Lowpass Filters

45
Gaussian Lowpass Filters

46
Image Enhancement in the Frequency Domain

47
Image Enhancement in the Frequency Domain

48
Doesn't seem like the output is different. The difference is
actually in performance. Going to frequency domain is an
overhead, but is the algorithm even more demanding?
Highpass Filters

49
Highpass Filters

50
Ideal Highpass Filters

51
Butterworth Highpass Filters

52
Gaussian Highpass Filters

53
Noise Removal

Noisy image

But how to know which


frequencies are noise
and which are original
image material?@
Fourier Spectrum Noise-cleaned image 54
Noise Removal

Noisy image Fourier Spectrum Noise-cleaned image

55

You might also like