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

3 次查看(过去 30 天)
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 个)

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?

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by