% FFT demo for image compression % % for Octave: you will need to modify this file % load and display cat I=imread('cheezburger.jpg'); X=im2double(rgb2gray(I)); % make grayscale and floating point figure(1); imagesc(X); colorbar; colormap gray; % analyze frequencies with FFT in 2D F = fft2(X); % display spectrum with 0 frequency at origin figure(2); imagesc(log10(abs(fftshift(F)))); colorbar; colormap gray; % drop all coefficients below a threshold threshold = 1e2; ii=find(abs(F)=threshold))/length(F(:)))