Hw4 Solution
Hw4 Solution
CH. 4
Problem 22.
Unless all borders on of an image are black, padding the image with zeros introduces significant
discontinuities (edges) at one or more borders of the image. These can be strong horizontal and
vertical edges. These sharp transitions in the spatial domain introduce high-frequency
components along the vertical and horizontal axes of the spectrum.
Problem 23.
1
(a) 𝑓(̅ 𝑥, 𝑦) = 𝑀𝑁 ∑𝑀−1 𝑛−1
𝑥=0 ∑𝑦=0 𝑓(𝑥, 𝑦)
1 𝑄−1
𝑓̅𝑝 (𝑥, 𝑦) = 𝑃𝑄 ∑𝑃−1
𝑥=0 ∑𝑦=0 𝑓𝑝 (𝑥, 𝑦) ∵ Image is padded with zeros
1 𝑄−1
= 𝑃𝑄 ∑𝑃−1
𝑥=0 ∑𝑦=0 𝑓(𝑥, 𝑦)
1
= 𝑃𝑄 ∙ 𝑀𝑁 ∙ 𝑓 (̅ 𝑥, 𝑦)
𝑓̅ (𝑥,𝑦) 𝑃𝑄
∴ The ratio of average values of the original and padded images = ̅̅̅
= 𝑀𝑁
𝑓𝑝 (𝑥,𝑦)
(b) Yes
𝐹(0,0) = 𝑀𝑁𝑓 (̅ 𝑥, 𝑦), 𝐹𝑝 (0,0) = 𝑃𝑄𝑓̅𝑝 (𝑥, 𝑦)
𝑀𝑁
From (a), 𝑓̅𝑝 (𝑥, 𝑦) = 𝑃𝑄 𝑓 (̅ 𝑥, 𝑦)
𝐹𝑝 (0,0) 𝑀𝑁 𝐹(0,0)
→ =
𝑃𝑄 𝑃𝑄 𝑀𝑁
∴ 𝐹𝑝 (0,0) = 𝐹(0,0)
Problem 26.
𝜕2 𝑓(𝑡,𝑧) 𝜕2 𝑓(𝑡,𝑧)
(a) ∇2 𝑓(𝑡, 𝑧) = +
𝜕𝑡 2 𝜕𝑧 2
𝑑𝑔(𝑧)
𝐹[ ] = (𝑗2𝜋𝜈)𝐺(𝜈)
𝑑𝑧
𝑑𝑓(𝑧)
→ 𝑔(𝑧) = → 𝐺(𝜈) = (𝑗2𝜋𝜈)𝐹(𝜈)
𝑑𝑧
𝑑2 𝐹(𝑧)
∴ 𝐹[ ] = (𝑗2𝜋𝜈)2 𝐹(𝜈)
𝑑𝑧 2
Consider 2D derivative.
𝜕2 𝑓(𝑡,𝑧)
𝐹[ ] = (𝑗2𝜋𝜇)2 𝐹(𝜇, 𝜈)
𝑑𝑡 2
𝜕2 𝑓(𝑡,𝑧)
𝐹[ ] = (𝑗2𝜋𝜈)2 𝐹(𝜇, 𝜈)
𝑑𝑧 2
𝜕2 𝑓(𝑡,𝑧) 𝜕2 𝑓(𝑡,𝑧)
→ 𝐹[∇2 𝑓(𝑡, 𝑧)] = 𝐹 [ ]+ 𝐹[ ]
𝑑𝑡 2 𝑑𝑧 2
= (𝑗2𝜋𝜇)2 𝐹(𝜇, 𝜈) + (𝑗2𝜋𝜈)2 𝐹(𝜇, 𝜈)
= −4𝜋 2 (𝜇 2 + 𝜈 2 )𝐹(𝜇, 𝜈)
(b) We can generate a filter for using with the DFT simply by sampling
𝐻(𝑢, 𝑣) = −4𝜋 2 (𝑢2 + 𝜈 2 )
𝑀 2 𝑁 2
→ 𝐻(𝑢, 𝑣) = −4𝜋 2 ([𝑢 − 2 ] + [𝜈 − 2 ] )
We have the following Fourier transform pair relating the Laplacian in the spatial and
frequency domains:
𝑀 2 𝑁 2
𝛻 2 𝑓(𝑥, 𝑦) ⇔ −4𝜋 2 ([𝑢 − 2 ] + [𝜈 − 2 ] ) 𝐹(𝑢, 𝜈)
2𝜋(𝑢−𝑀/2)
As u ranges from 0 to M, the value of cos [ ] starts at -1, peak at 1 when 𝑢 =
𝑀
𝑀/2 (the center), and then again decreases to -1 when 𝑢 = 𝑀.
Thus, the amplitude response of the filter decreases as a function of the distance from the
origin of the centered filter, which is nothing but a low-pass filter.
Problem 37.
2 (𝑢,𝑣)/2𝐷2
(a) One application of the filter gives: 𝐺(𝑢, 𝜈) = 𝐻(𝑢, 𝜈)𝐹(𝑢, 𝜈) = 𝑒 −𝐷 0 ∙ 𝐹(𝑢, 𝜈)
2 (𝑢,𝑣)/2𝐷2
Similarly, k applications of the filter would give: 𝐺𝑘 (𝑢, 𝜈) = 𝑒 −𝑘𝐷 0 ∙ 𝐹(𝑢, 𝜈)
The inverse DFT of the 𝐺𝑘 (𝑢, 𝜈) would give the image resulting from k passes of the
Gaussian filter. If k is “large enough”, the Gaussian LPF will become a notch pass filter,
passing only 𝐹(0,0). We know that this term is equal to the average value of the image. So,
there is a value of k after which the result of repeated low-pass filtering will simply produce
a constant image. The value of all pixels on this image will be equal to the value of the
original image. Note that the answer applies even as k approaches infinity. In this case, the
filter will approach an impulse at the origin, and this would still give us 𝐹(0,0) as the result
of filtering.
CH. 5
Problem 1.
Problem 2.
Problem 10.
(a) Geometric mean is 0 whenever any pixel is 0.
The geometric mean will give only values of 0 and 1, whereas the arithmetic mean will give
intermedia values (blurred).
(b) Black is 0, so the geometric mean will return values of 0 as long as at least one pixel in the
window is black. Because the center of the mask can be outside the original black area
when this happens, the figure will be thickened.
Problem 16.
∞
𝑔(𝑥, 𝑦) = ∭ 𝑓(𝛼, 𝛽)ℎ(𝑥 − 𝛼, 𝑦 − 𝛽)𝑑𝛼𝑑𝛽
−∞
Problem 17.
The components of motion are as follows:
𝑎𝑡
0 ≤ 𝑡 ≤ 𝑇1
𝑥0 (𝑡) = { 𝑇1
𝑎 𝑇1 ≤ 𝑡 ≤ 𝑇1 + 𝑇2
and
0 0 ≤ 𝑡 ≤ 𝑇1
𝑦0 (𝑡) = {𝑏(𝑡 − 𝑇1 )
𝑇1 ≤ 𝑡 ≤ 𝑇1 + 𝑇2
𝑇1
𝑇1 𝑇1 +𝑇2
𝐻(𝑢, 𝑣) = ∫ 𝑒 −𝑗2𝜋[𝑢𝑎𝑡/𝑇1] 𝑑𝑡 + ∫ 𝑒 −𝑗2𝜋[𝑢𝑎+𝑣𝑏(𝑡−𝑇1)/𝑇2] 𝑑𝑡
0 𝑇1
𝑇1 +𝑇2
𝑇1
= sin(𝜋𝑢𝑎) 𝑒 −𝑗𝜋𝑢𝑎 + 𝑒 −𝑗2𝜋𝑢𝑎 ∫ 𝑒 −𝑗2𝜋𝑣𝑏(𝑡−𝑇1)/𝑇2 𝑑𝑡
𝜋𝑢𝑎 𝑇1
𝑇2
𝑇1 −𝑗𝜋𝑢𝑎 −𝑗2𝜋𝑢𝑎
= sin(𝜋𝑢𝑎) 𝑒 +𝑒 ∫ 𝑒 −𝑗2𝜋𝑣𝑏𝜏/𝑇2 𝑑𝜏
𝜋𝑢𝑎 0
𝑇1 𝑇2
= sin(𝜋𝑢𝑎) 𝑒 −𝑗𝜋𝑢𝑎 + 𝑒 −𝑗2𝜋𝑢𝑎 sin (𝜋𝑣𝑏)𝑒 −𝑗𝜋𝑣𝑏
𝜋𝑢𝑎 𝜋𝑣𝑏
MATLAB task
clear; close all;
load hw4.mat;
<Adaptive mean filtering with d=4> <Adaptive mean filtering with d=6>