0
$\begingroup$

I got the frequency spectrum of a grayscale image using

img_shft = fftshift(img_fft);
final_spectrum = im2uint8(mat2gray(log(abs(img_shft)+1)));

imagesc(final_spectrum);
plot(final_spectrum);

My output for imagesc is as below. What is represented by the axes? Are x-axis frequency and y-axis amplitude?

enter image description here

This is my output for plot(). Why are there so many lines of different colors? (I converted my RGB image to grayscale before getting fft2) What are axes?

enter image description here

Why can't we get clear and easily interpretable frequency plots as we get when we take fft of signals? (I'm sorry but I'm new to signal processing)

Any advice is much appreciated.

$\endgroup$
1
0
$\begingroup$
% Assume your data sequence is stored on a 2D MATLAB matrix as follows:
%
% X = [ 1, 2, 3 ]
%     [ 4, 5, 6 ]    X(i,j) is the i-th row ,j-th column.
%     [ 7, 8, 9 ]
%     [10, 11,12]
% 
% MATLAB treats the i-rows as the first dimension, n1; whereas the 
% j-columns as the second dimension, n2. And Top-Left is the first
% element (origin of n1-n2 axes).
%
% Then F = fft2(X) will be another matrix of the same size:
%
% F = [ F11, F12, F13 ]
%     [ F21, F22, F23 ]    F(i,j) is the i-th row ,j-th column.
%     [ F31, F32, F33 ]    i-rows is the 1st dim k1
%     [ F42, F42, F43 ]    j-cols is the 2nd dim k2
%
%
% To display the 2D spectrum magnitude |F| of X, you can use imshow() 
% function, which maps matrix elements to display pixels in an order 
% preserving manner; i.e., top left matrix element |F11| is displayed
% on the top-left pixel of the image window...
%
% The dimensions k1,k2 of F are the w1 and w2 frequency axes of 
% the DTFT respectively. The value of the element at (k1,k2) is the
% value of the 2D DFT/FFT F(k1,k2). 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.