Assignment 5
Assignment 5
Austin Miller
101145683
Questions 1 – 2.
f = im2double(imread('Q2.tif')); % Reading the initial image
figure, imshow(f), title("Question 2ba");
% Question 2b
% Question 2bb
g = filter(f, 1, [0, 1], "Laplacian"); % Applying the blurring filter
figure, imshow(g), title("Question 2bb");
% Question 2bc
g = filter(f, -1, [0, 1], "Laplacian sharpen"); % Applying the blurring filter
figure, imshow(g), title("Question 2bc");
% Question 2bd
g = filter(f, -1, [0, 1], "Laplacian sharpen 2"); % Applying the blurring
filter
figure, imshow(g), title("Question 2bd");
% Question 2b
function g = filter(f, c, scaling, type)
switch type
case "Laplacian"
w2 = [0, 1, 0; ...
1, -4, 1; ...
0, 1, 0];
w = c*w2;
case "Laplacian sharpen"
w1 = [0, 0, 0;
0, 1, 0;
0, 0, 0];
w2 = [0, 1, 0; ...
1, -4, 1; ...
0, 1, 0];
w = w1 + c*w2;
case "Laplacian sharpen 2"
w1 = [0, 0, 0;
0, 1, 0;
0, 0, 0];
w2 = [1, 1, 1; ...
1, -8, 1; ...
1, 1, 1];
w = w1 + c*w2;
otherwise
print("A filter was not selected...");
end
f = mat2gray(f, scaling);
g = conv2(f, w);
end
Question 3.
r
s=T ( r )= ( L−1 )∫ pr ( r ) dr
0
r
2r
T ( r )=( L−1 )∫ dr
0 ( L−1 )2
r
2 ( L−1 )
T ( r )=
( L−1 )2 0
∫ rdr
( )
2
2 r 0
T ( r )= −
( L−1 ) 2 2
2
( ) r
T r=
L−1
Question 4.
a)
F {e }=δ ( μ−t0 )
j2πt0t
−∞
−∞
% Question 4 a
t0 = 1;
z0 = 1;
t = linspace(-2*pi, 2*pi, 10000);
f = exp(-1i*2*pi*t0*t);
F = fft(f);
figure, plot(t, f), title("Function");
figure, plot(t, F), title("Fourier transform");
b)
∞ ∞
−∞ −∞
∞ ∞
∫ δ ( μ−t 0 ) e− j 2 πμ
dt ∫ δ ( z −z 0) e
− j 2 πtν
dt =e
− j 2 π ( t 0 μ +z0 ν )
−∞ −∞
− j2 π ( t 0 μ ) − j 2 π ( z0 ν ) − j 2 π (t 0 μ+ z0 ν )
e e =e