Last change
on this file since 85 was
84,
checked in by sommeria, 14 years ago

update_imadoc: copy the timing information of the movie file avi in the new xml file when a geometry_calibration is performed
set_grid: modified to produce grids in px coordiantes and to display the produced grid
geometry_calib: display the point with max error
civ: bug corrected for copying avi movies to png files
uvmat: small bug fixes
px_XYZ: introduce default values for Calib parameters

File size:
1.3 KB

Line  

1  

2  function [X,Y]=px_XYZ(Calib,Xphys,Yphys,Zphys) 

3  X=[];%default 

4  Y=[]; 

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 

12  if ~exist('Zphys','var') 

13  Zphys=0; 

14  end 

15  if ~isfield(Calib,'f') 

16  Calib.f=1; 

17  end 

18  if ~isfield(Calib,'kappa1') 

19  Calib.kappa1=0; 

20  end 

21  if ~isfield(Calib,'sx') 

22  Calib.sx=1; 

23  end 

24  if ~isfield(Calib,'dpx') 

25  Calib.dpx=1; 

26  end 

27  if ~isfield(Calib,'dpy') 

28  Calib.dpy=1; 

29  end 

30  if ~isfield(Calib,'Cx') 

31  Calib.Cx=0; 

32  end 

33  if ~isfield(Calib,'Cy') 

34  Calib.Cy=0; 

35  end 

36  %%%%%%%%%%%%% 

37  if isfield(Calib,'R') 

38  R=(Calib.R)'; 

39  xc=R(1)*Xphys+R(2)*Yphys+R(3)*Zphys+Calib.Tx; 

40  yc=R(4)*Xphys+R(5)*Yphys+R(6)*Zphys+Calib.Ty; 

41  zc=R(7)*Xphys+R(8)*Yphys+R(9)*Zphys+Calib.Tz; 

42  %undistorted image coordinates 

43  Xu=Calib.f*xc./zc; 

44  Yu=Calib.f*yc./zc; 

45  %distorted image coordinates 

46  distortion=(Calib.kappa1)*(Xu.*Xu+Yu.*Yu)+1; %A REVOIR 

47  % distortion=1; 

48  Xd=Xu./distortion; 

49  Yd=Yu./distortion; 

50  %pixel coordinates 

51  X=Xd*Calib.sx/Calib.dpx+Calib.Cx; 

52  Y=Yd/Calib.dpy+Calib.Cy; 

53  

54  elseif isfield(Calib,'Pxcmx')&isfield(Calib,'Pxcmy')%old calib 

55  X=Xphys*Calib.Pxcmx; 

56  Y=Yphys*Calib.Pxcmy; 

57  end 

Note: See
TracBrowser
for help on using the repository browser.