function [fig] = draw_fft(image_fft, fig_id)
% [fig] = draw_fft(image_fft, fig_id)
% Draw the FFT spectrum stored in var image_fft into given frame by its index fig_id


% if 'fig_id' doesn't exists, assign random id
if (exist('fig_id'))
    fig = figure(fig_id);
else
    fig = figure;
end;

% draw centered Fourier spectrum (log of power)
base_log = 1e-2;
image_fftlog = log(base_log + abs(image_fft).^2)-log(base_log);
fftim_sz1 = size(image_fft,1);
fftim_sz2 = size(image_fft,2);
fft_range1 = (-fftim_sz1/2):(fftim_sz1-fftim_sz1/2);
fft_range2 = (-fftim_sz2/2):(fftim_sz2-fftim_sz2/2);
imagesc(fft_range1,fft_range2, fftshift(image_fftlog));

% create colormap
gray_log = (log(base_log + gray.^2) - log(base_log));
%gray_log = gray_log ./ (max(gray_log(:)));
gray_log = gray_log ./ (log(base_log + 1) - log(base_log));
colormap(gray_log);
colorbar;
