Image Power Spectrum

I started (a small project) to calculate the image power spectrum in the frequency domain.

So, I still have the following:

%// close all; clear all; %// not generally appreciated
img   = imread('ajw_pic.jpg','jpg'); % it is a color image
img = rgb2gray(img); %// change to gray
psd = 10*log10(abs(fftshift(fft2(img))).^2 );
figure(2); clf
mesh(psd)

So far it looks good; I get a net plot that resembles the spectra that I see in various scientific articles.

However, what I'm looking for is a graph of the graph of these power spectra versus frequency, and I'm not quite sure how to get this frequency vector. I could do for example:

N=400;        %// the image is 400 x 400
f=-N/2:N/2-1; %// possible frequencies?

but I’m not sure that this is absolutely correct, as it leads to negative frequencies.

I would really appreciate it if someone could point me in the right direction to build a log frequency depending on the power spectrum.

+4
source share
3

fft "" "", , , - . , :

Y = fft(X,N); %  (1D case)

, fft- Y(1:N/2+1), :

f = [fs/2*linspace(0,1,N/2+1)]; % where fs is your sampling frequency

Y . , , , , . : https://dsp.stackexchange.com/questions/431/what-is-the-physical-significance-of-negative-frequencies/449#449.

2D-:

  • fftshift, 0- , , , 1D. , f = fs/2 * linspace(-1,1,N) ( , )

  • - . [ ^ -1], ( ). , , [pixels ^ -1], .

+2

1 , fs = 1. (-N/2:N/2-1)/N, N - ( x y). , 1/N, 1/2 N > 2, .

0

All Articles