How To Find The X & Y Shift Of An Image
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I need some help regarding the following code:
fx = 3.5:3.5:56;
fy = 2;
a=128;
b=128;
c=512;
[x1,y1]=meshgrid(-1:2/511:+1,-1:2/511:+1);
circ1=sqrt(x1.^1+y1.^1)<1;
% Aberration
z8=sqrt(8).*(3.*(x1.^2+y1.^2)-2).*x1;
% Generation Of Holograms
[x,y] = meshgrid(-1:2/127:+1,-1:2/127:+1);
circ=sqrt(x.^2+y.^2)<1;
for j1 = numel(fx):-1:1
h{j1} = circ.*cos(pi*(x*fx(j1) + y*fy));
end
% An Array Of 4x4 Holograms(Concatenation)
M = cell(c/a);
M(:) = h;
M = cell2mat(M');
%figure(1)
imagesc(M),colormap gray; axis image; axis off
title('Array Of 4x4 Holograms');
%Fourier Transform Before Adding Aberration
z1=fftshift(fft2(M,512,512));
q1=abs(z1);
figure(2)
imagesc(q1); colormap gray; axis image; axis off
title('Focal Spots Of Grating Array');
%Fourier Transform After Adding Aberration
N=exp(sqrt(-1).*(M+z8));
z2=fftshift(fft2(N,512,512));
q2=abs(z2);
figure(3)
imagesc(q2); colormap gray; axis image; axis off
title('Focal Spots Of Grating Array Shifted');
******* If you run the above code, you will get two figures: fig(2) & fig(3). In fig(3), the spots gets shifted from the ideal position in fig(2) due to aberration added. So, can anyone help me how to calculate both the horizontal and vertical shift (slope) of each spot in fig(3) with respect to fig(2) using Matlab coding. It will be a great help for me.
Thanking You!
[EDITED, Code formatted, Jan S]
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!