I am quite new to signal processing and matlab, and I have begun (a small project) to calculate the power spectrum of an image in the frequency domain - and plot this against the frequency.
So, what I have till now is the following:
close all; clear all;
img = imread('my_pic.jpg','jpg');
img = rgb2gray(img);
psd = 10*log10(abs(fftshift(fft2(img))).^2 );
figure(2); clf
mesh(psd)
So far it looks good - I get the mesh plot which resembles the spectra I see in various academic papers.
However, what I am looking for is a graph plot of this power spectra Vs. the frequency - and I am not entirely sure how to get this frequency vector for the image. I could do say:
.. but I am not convinced this is entirely correct.... I'd really appreciate if someone could point me in the right direction to plot log frequency Vs. the power spectrum.
1 Comment
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/109246-power-spectrum-plot-of-an-image#comment_184759
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/109246-power-spectrum-plot-of-an-image#comment_184759
Sign in to comment.