Changeset 1201 for trunk/src/px_XYZ.m


Ignore:
Timestamp:
Mar 23, 2026, 4:49:29 PM (3 hours ago)
Author:
sommeria
Message:

various improvements...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/px_XYZ.m

    r1127 r1201  
    1 %'px_XYZ': transform physical to image coordinates.
     1%'px_XYZ': transforms physical to image coordinates.
    22%------------------------------------------------------------------------
    3 %[X,Y]=px_XYZ(Calib,Xphys,Yphys,Zphys)
     3%[X,Y]=px_XYZ(Calib,Slice,Xphys,Yphys,Zphys)
    44%------------------------------------------------------------------------           
    55% OUTPUT:
     
    88% INPUT:
    99% Calib: structure containing calibration parameters
     10% Slice: structure indicating the plane cut position
    1011% Xphys,Yphys,Zphys; vectors of physical coordinates for a set of points
    1112
     
    4142%%%%%%%%%%%%%
    4243if isempty(Slice)
    43     Slice=Calib;
     44    Slice=Calib;% old convention (< 2022)
    4445end
    4546% general case
     
    5152        if H>Zphys
    5253            Zphys=H-(H-Zphys)/Slice.RefractionIndex; %corrected z (virtual object)Calib
    53            
    54           %  test_refraction=1;
    5554        end
    5655    end
    5756   
    5857    %camera coordinates
    59     Zphys=Zphys;%flip z coordinates
    6058    xc=R(1)*Xphys+R(2)*Yphys+R(3)*Zphys+Calib.Tx_Ty_Tz(1);
    6159    yc=R(4)*Xphys+R(5)*Yphys+R(6)*Zphys+Calib.Tx_Ty_Tz(2);
     
    6967    if ~isfield(Calib,'kc')
    7068        r2=1; %no quadratic distortion
    71     elseif numel(Calib.kc)==1
     69    elseif isscalar(Calib.kc)
    7270        r2=1+Calib.kc*(Xu.*Xu+Yu.*Yu);
    7371    else
Note: See TracChangeset for help on using the changeset viewer.