-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlab2_1.m
69 lines (51 loc) · 1.04 KB
/
lab2_1.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
function lab2_1( u, v, sz)
%LAB2_2 Display inverse fourier transform of a basis vector
% u, v is the basis vector to be displayed
if (nargin < 2)
error('Need 2 or 3 arguments');
end
if (nargin == 2)
sz = 128;
end
Fhat = zeros(sz);
Fhat(u,v) = 1;
F = ifft2(Fhat);
Fabsmax = max(abs(F(:)));
%F2 = fft2(F);
% center the input image
if (u <= sz/2)
uc = u - 1;
else
uc = u - 1 - sz;
end
if (v <= sz/2)
vc = v - 1;
else
vc = v - 1 - sz;
end
Fabsmax
wavelength = 0.0; % TODO
amplitude = 1.0/sz % TODO
Fabsmax
subplot(2,3,1)
showgrey(Fhat);
title(sprintf('Fhat (u=%d v=%d)',u,v))
subplot(2,3,4)
showgrey(fftshift(Fhat));
title(sprintf('centered Fhat (uc=%d vu=%d)',uc,vc))
% subplot(2,3,4)
% showgrey(F2);
% title(sprintf('F2 (p=%d q=%d)',p,q))
subplot(2,3,2)
showgrey(real(F), 64, -Fabsmax, Fabsmax)
title('real(F)')
subplot(2,3,3)
showgrey(imag(F), 64, -Fabsmax, Fabsmax)
title('imag(F)')
subplot(2,3,5)
showgrey(abs(F), 64, -Fabsmax, Fabsmax)
title('abs(F)')
subplot(2,3,6)
showgrey(angle(F), 64, -pi, pi)
title('angle(F)')
end