cycles/pixel to cycels/degree

6 ビュー (過去 30 日間)
Rachel
Rachel 2012 年 6 月 19 日
Hi everyone,
I'm a new Matlab user looking for code to change my images from cycles/pixels to cycles/degree. Any suggestions?
Thanks! Rachel

回答 (1 件)

Dr. Seis
Dr. Seis 2012 年 6 月 19 日
See this link:
About half way down:
F = fft2(image);
nx = size(F, 2);
ny = size(F, 1);
cxrange = [0:nx/2, -nx/2+1:-1]; % cycles across the image
cyrange = [0:ny/2, -ny/2+1:-1];
[cx, cy] = meshgrid(cxrange, cyrange);
fxrange = cxrange * 2*pi/nx; % radians per pixel
fyrange = cyrange * 2*pi/ny;
[fx, fy] = meshgrid(fxrange, fyrange);
Is this what you want instead?
  1 件のコメント
Rachel
Rachel 2012 年 6 月 19 日
Thanks for responding Elige. Part of the problem is that I'm such a newbie I'm not sure what code I need. I'm a vision researcher (with no programming background) interested in analyzing the spatial frequency content of a .pbm image depicting a man-made scene (i.e., a cityscape). I'm using the following Matlab FFT code:
I = imread('image.pbm');
F = fft2(double(I));
A = fftshift(F);
L = log2(S);
A = abs(L);
imagesc(A)
Since my last posting I've figured out that when I histogram my 2D power specturm of A I'm actually getting the average spatial frequency of the image in cycles/degree. From here all I want to do is add on code that will then take this information and convert it to cycles/degree. So for example, if my city image is on average 10 cycles/pixels, how do I figure out what this is in cycles/degree?

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by