source: trunk/src/px_XYZ.m @ 58

Last change on this file since 58 was 40, checked in by sommeria, 14 years ago

-relabel_i_j added to the svn (relabel an image series with two indices)
-Menu projection Object added to uvmat, rationalizes the call of projection objects (to improve yet)
-get_plot_handles: modified in relationwith the Menu projection object
-mouse_down: corrected in relation with previous change in field transforms
-transform_field functions added to the svn
-set_object and keyboard_callback: cleaning

File size: 994 bytes
Line 
1
2function [X,Y]=px_XYZ(Calib,Xphys,Yphys,Zphys)
3X=[];%default
4Y=[];
5% if exist('Z','var')& isequal(Z,round(Z))& Z>0 & isfield(Calib,'PlanePos')&length(Calib.PlanePos)>=Z
6%     Zindex=Z;
7%     planepos=Calib.PlanePos{Zindex};
8%     zphys=planepos(3);%A GENERALISER CAS AVEC ANGLE
9% else
10%     zphys=0;
11% end
12if ~exist('Zphys','var')
13    Zphys=0;
14end
15
16%%%%%%%%%%%%%
17if isfield(Calib,'R')
18    R=(Calib.R)';
19    xc=R(1)*Xphys+R(2)*Yphys+R(3)*Zphys+Calib.Tx;
20    yc=R(4)*Xphys+R(5)*Yphys+R(6)*Zphys+Calib.Ty;
21    zc=R(7)*Xphys+R(8)*Yphys+R(9)*Zphys+Calib.Tz;
22%undistorted image coordinates
23    Xu=Calib.f*xc./zc;
24    Yu=Calib.f*yc./zc;
25%distorted image coordinates
26    distortion=(Calib.kappa1)*(Xu.*Xu+Yu.*Yu)+1; %A REVOIR
27% distortion=1;
28    Xd=Xu./distortion;
29    Yd=Yu./distortion;
30%pixel coordinates
31    X=Xd*Calib.sx/Calib.dpx+Calib.Cx;
32    Y=Yd/Calib.dpy+Calib.Cy;
33
34elseif isfield(Calib,'Pxcmx')&isfield(Calib,'Pxcmy')%old calib 
35        X=Xphys*Calib.Pxcmx;
36        Y=Yphys*Calib.Pxcmy;
37end
Note: See TracBrowser for help on using the repository browser.