Changeset 1184 for trunk/src/phys_XYZ.m
- Timestamp:
- Nov 6, 2025, 7:03:02 PM (4 weeks ago)
- File:
-
- 1 edited
-
trunk/src/phys_XYZ.m (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/phys_XYZ.m
r1127 r1184 1 1 %------------------------------------------------------------------------ 2 2 %'phys_XYZ':transforms image (px) to real world (phys) coordinates using geometric calibration parameters 3 % function [Xphys,Yphys,Zphys]=phys_XYZ(Calib, X,Y,Zindex)3 % function [Xphys,Yphys,Zphys]=phys_XYZ(Calib,Slice,X,Y,Zindex) 4 4 % 5 5 %OUTPUT: … … 7 7 %INPUT: 8 8 % Calib: Matlab structure containing the calibration parameters (pinhole camera model, see 9 % http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#GeometryCalib) and the 10 % parameters describing the illumination plane(s) 9 % http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#GeometryCalib) 11 10 % .Tx_Ty_Tz: translation (3 phys coordinates) defining the origine of the camera frame 12 11 % .R : rotation matrix from phys to camera frame 13 12 % .fx_fy: focal length along each direction of the image 13 % Slice: Matlab structure containing the parameters describing the position and inclination of the illumination plane 14 14 % X, Y: vectors of X and Y image coordinates 15 % ZIndex : index defining the current illumination plane in a volume scan15 % ZIndex (if needed): index defining the current illumination plane in a volume scan,=1 by default 16 16 17 17 %======================================================================= … … 37 37 testangle=0;% =1 if the illumination plane is tilted with respect to the horizontal plane Xphys Yphys 38 38 test_refraction=0;% =1 if the considered points are viewed through an horizontal interface (located at z=Calib.InterfaceCoord(3)') 39 if ~exist('X','var')||~exist('Y','var') 40 Xphys=[]; 41 Yphys=[];%default 42 return 43 end 39 44 Zphys=0; %default output 45 40 46 if isempty(Slice) 41 47 Slice=Calib;%old convention < 2022 48 elseif ~isfield(Slice,'SliceCoord')% bad input 49 Xphys=[]; 50 Yphys=[];% bad input 51 return 42 52 end 43 53 if exist('Zindex','var')&& isequal(Zindex,round(Zindex))&& Zindex>0 && isfield(Slice,'SliceCoord')&&size(Slice.SliceCoord,1)>=Zindex … … 59 69 Z0virt=0; 60 70 end 61 if ~exist('X','var')||~exist('Y','var') 62 Xphys=[]; 63 Yphys=[];%default 64 return 65 end 71 66 72 %coordinate transform 67 73 if ~isfield(Calib,'fx_fy')
Note: See TracChangeset
for help on using the changeset viewer.
