How to select a particular portion of an image and take Fourier transform

1 回表示 (過去 30 日間)
Pranjal Pathak
Pranjal Pathak 2013 年 1 月 9 日
Hi,
I have a problem in the following code:
% Binary Hologram & Its Corresponding FT
mx=20; my=0;
[x,y]=meshgrid(-1:2/127:1, -1:2/127:1); circ=sqrt(x.^2+y.^2)<1; H=circ.*(cos((x*pi*mx)+(y*pi*my)))>0;
figure(1) imagesc(H); colormap gray; axis image; axis off
%Fourier Transform z=fft2(H, 512,512); m=fftshift(z); q=abs(m);
figure(2) imagesc(q); colormap gray; axis image; axis off title('Focal Spots Of Grating Array'); ******* If we run the above code, the figure 2 gives an array of focal spots( i.e. the white spots). I need to select only one white spot ( which is to the right of central one) and then take the inverse Fourier transform of the selected focal (i.e. white) spot using matlab code. Can any one help me in this regard.
Thanking You!
  1 件のコメント
Image Analyst
Image Analyst 2013 年 1 月 9 日
Edit your post. Highlight your code. Click {}Code icon above. This will format it so it looks nice.

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

回答 (1 件)

Thorsten
Thorsten 2013 年 1 月 10 日
Select the white spot
znew = zeros(size(z));
znew(244:270, 325:350) = z(244:270, 325:350);
Take the inverse FFT
Hnew = real(ifft2(znew));
imagesc(H)
This does what you asked for... Does you really want this result?

Community Treasure Hunt

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

Start Hunting!

Translated by