source: trunk/src/pxcm_tsai.m @ 35

Last change on this file since 35 was 19, checked in by gostiaux, 15 years ago

the private files have been moved down to the root folder

File size: 2.4 KB
Line 
1%'pxcm_tsai': find differentials of the Tsai calibration
2%
3function [A11,A12,A13,A21,A22,A23]=pxcm_tsai(a,var_phys)
4a_read=a;
5
6R=(a.R)';
7
8x=var_phys(:,1);
9y=var_phys(:,2);
10
11if isfield(a,'PlanePos')
12    prompt={'Plane 1 Index','Plane 2 Index'};
13    Rep=inputdlg(prompt,'Target displacement test');
14    Z1=str2double(Rep(1));
15    Z2=str2double(Rep(2));
16    z=(a.PlanePos(Z2,3)+a.PlanePos(Z1,3))/2
17else
18    z=0;
19end
20
21%transform coeff for differentiels
22a.C11=R(1)*R(8)-R(2)*R(7);
23a.C12=R(2)*R(7)-R(1)*R(8);
24a.C21=R(4)*R(8)-R(5)*R(7);
25a.C22=R(5)*R(7)-R(4)*R(8);
26a.C1x=R(3)*R(7)-R(9)*R(1);
27a.C1y=R(3)*R(8)-R(9)*R(2);
28a.C2x=R(6)*R(7)-R(9)*R(4);
29a.C2y=R(6)*R(8)-R(9)*R(5);
30
31
32%dependence in x,y
33denom=(R(7)*x+R(8)*y+R(9)*z+a.Tz).*(R(7)*x+R(8)*y+R(9)*z+a.Tz);
34A11=(a.f*a.sx*(a.C11*y-a.C1x*z+R(1)*a.Tz-R(7)*a.Tx)./denom)/a.dpx;
35A12=(a.f*a.sx*(a.C12*x-a.C1y*z+R(2)*a.Tz-R(8)*a.Tx)./denom)/a.dpx;
36A21=(a.f*a.sx*(a.C21*y-a.C2x*z+R(4)*a.Tz-R(7)*a.Ty)./denom)/a.dpy;
37A22=(a.f*(a.C22*x-a.C2y*z+R(5)*a.Tz-R(8)*a.Ty)./denom)/a.dpy;
38A13=(a.f*(a.C1x*x+a.C1y*y+R(3)*a.Tz-R(9)*a.Tx)./denom)/a.dpx;
39A23=(a.f*(a.C2x*x+a.C2y*y+R(6)*a.Tz-R(9)*a.Ty)./denom)/a.dpy;
40
41%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42%Old Version for z=0
43%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44% %'camera' coordinates
45% xc=R(1)*x+R(2)*y+a.Tx;
46% yc=R(4)*x+R(5)*y+a.Ty;
47% zc=R(7)*x+R(8)*y+a.Tz;
48% %undistorted image coordinates
49% Xu=a.f*xc./zc;
50% Yu=a.f*yc./zc;
51% %distorted image coordinates
52% distortion=(a.kappa1)*(Xu.*Xu+Yu.*Yu)+1; %!! intégrer derivation kappa
53% % distortion=1;
54% Xd=Xu./distortion;
55% Yd=Yu./distortion;
56% %pixel coordinates
57% X=Xd*a.sx/a.dpx+a.Cx;
58% Y=Yd/a.dpy+a.Cy;
59%
60% %transform coeff for differentiels
61% a.C11=R(1)*R(8)-R(2)*R(7);
62% a.C12=R(2)*R(7)-R(1)*R(8);
63% a.C21=R(4)*R(8)-R(5)*R(7);
64% a.C22=R(5)*R(7)-R(4)*R(8);
65% a.C1x=R(3)*R(7)-R(9)*R(1);
66% a.C1y=R(3)*R(8)-R(9)*R(2);
67% a.C2x=R(6)*R(7)-R(9)*R(4);
68% a.C2y=R(6)*R(8)-R(9)*R(5);
69%
70%
71% %dependence in x,y
72% denom=(R(7)*x+R(8)*y+a.Tz).*(R(7)*x+R(8)*y+a.Tz);
73% A11=(a.f*a.sx*(a.C11*y+R(1)*a.Tz-R(7)*a.Tx)./denom)/a.dpx;
74% A12=(a.f*a.sx*(a.C12*x+R(2)*a.Tz-R(8)*a.Tx)./denom)/a.dpx;
75% A21=(a.f*a.sx*(a.C21*y+R(4)*a.Tz-R(7)*a.Ty)./denom)/a.dpy;
76% A22=(a.f*(a.C22*x+R(5)*a.Tz-R(8)*a.Ty)./denom)/a.dpy;
77% A13=(a.f*(a.C1x*x+a.C1y*y+R(3)*a.Tz-R(9)*a.Tx)./denom)/a.dpx;
78% A23=(a.f*(a.C2x*x+a.C2y*y+R(6)*a.Tz-R(9)*a.Ty)./denom)/a.dpy;
79%
Note: See TracBrowser for help on using the repository browser.