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

1 view (last 30 days)
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!

Answers (1)

Thorsten
Thorsten on 10 Jan 2013
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!