필터 지우기
필터 지우기

cycles/pixel to cycels/degree

조회 수: 7 (최근 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?

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by