Changeset 1184 for trunk/src/phys_XYZ.m


Ignore:
Timestamp:
Nov 6, 2025, 7:03:02 PM (4 weeks ago)
Author:
sommeria
Message:

bed-scan updated and many updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/phys_XYZ.m

    r1127 r1184  
    11%------------------------------------------------------------------------
    22%'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)
    44%
    55%OUTPUT:
     
    77%INPUT:
    88% 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)
    1110%    .Tx_Ty_Tz: translation (3 phys coordinates) defining the origine of the camera frame
    1211%    .R : rotation matrix from phys to camera frame
    1312%    .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
    1414% X, Y: vectors of X and Y image coordinates
    15 % ZIndex: index defining the current illumination plane in a volume scan
     15% ZIndex (if needed): index defining the current illumination plane in a volume scan,=1 by default
    1616
    1717%=======================================================================
     
    3737testangle=0;% =1 if the illumination plane is tilted with respect to the horizontal plane Xphys Yphys
    3838test_refraction=0;% =1 if the considered points are viewed through an horizontal interface (located at z=Calib.InterfaceCoord(3)')
     39if ~exist('X','var')||~exist('Y','var')
     40    Xphys=[];
     41    Yphys=[];%default
     42    return
     43end
    3944Zphys=0; %default output
     45
    4046if isempty(Slice)
    4147    Slice=Calib;%old convention < 2022
     48elseif ~isfield(Slice,'SliceCoord')% bad input
     49    Xphys=[];
     50    Yphys=[];% bad input
     51    return
    4252end
    4353if exist('Zindex','var')&& isequal(Zindex,round(Zindex))&& Zindex>0 && isfield(Slice,'SliceCoord')&&size(Slice.SliceCoord,1)>=Zindex
     
    5969    Z0virt=0;
    6070end
    61 if ~exist('X','var')||~exist('Y','var')
    62     Xphys=[];
    63     Yphys=[];%default
    64     return
    65 end
     71
    6672%coordinate transform
    6773if ~isfield(Calib,'fx_fy')
Note: See TracChangeset for help on using the changeset viewer.