power spectrum plot of an image

조회 수: 59 (최근 30일)
Dsp
Dsp 2013년 12월 10일
편집: Prasobhkumar P. P. 2020년 3월 10일
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'); % it is a color image 400px x 400px
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 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:
N=400; % the image is 400 x 400
f=-N/2:N/2-1; % possible frequencies?
.. 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
Jan
Jan 2013년 12월 11일
I would agree to your suggestion. The notion of spatial frequencies in image is at a first glance not quite as intuitive as in other digital signal processing applications. However, in my opinion a spatial frequency in an image depends on the geometry of the optics (recording distance, pixel size, pixel pitch etc.) in much the same way as a frequency in a one dimensional signal depends on the sampling rate. Yet I would appreciate an input of more experienced forum members on this point.

댓글을 달려면 로그인하십시오.

답변 (1개)

Prasobhkumar P. P.
Prasobhkumar P. P. 2020년 3월 4일
편집: Prasobhkumar P. P. 2020년 3월 10일

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by