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
|
% function showim(f,cmap) display real or complex image.
% When it is complex, the real part and imaginary part
% are displayed as [real,imag] in one image.
% cmap is the colormap. default = gray, -1 = inverted gray.
% Stella X. Yu, 2000.
function showim(f,cmap,ishori)
if not(isreal(f)),
i = [real(f(:)); imag(f(:))];
j = [min(i), max(i)];
[nr,nc] = size(f);
if nargin<3 | isempty(ishori),
ishori = nr>nc;
end
if ishori,
i = zeros(nr,1);
f = [real(f), [i+j(1),i+j(2)], imag(f)];
else
i = zeros(1,nc);
f = [real(f); [i+j(1);i+j(2)]; imag(f)];
end
end
imagesc(f); axis off; axis image;
if nargin<2 | isempty(cmap),
return;
end
if cmap==1,
cmap = gray;
elseif cmap==-1,
cmap = flipud(gray);
end
colormap(cmap);
|