% get depth for central camera and normalized image image directions Usage: d = calc_depth_central_xs(X,P,xs) X - 4-vector of 3D point P - 3x4 projection matrix xs - 3x1-vector of direction of camera, normalized d - depth, is positive if point is in front of camera (similar direction as xs) Wolfgang Förstner 4/2013 wfoerstn@uni-bonn.de See also calc_depth_central_x, calc_depth_central_xs_RZ, calc_depth_perspective
0001 %% get depth for central camera and normalized image image directions 0002 % 0003 % Usage: 0004 % d = calc_depth_central_xs(X,P,xs) 0005 % 0006 % X - 4-vector of 3D point 0007 % P - 3x4 projection matrix 0008 % xs - 3x1-vector of direction of camera, normalized 0009 % 0010 % d - depth, is positive if point is in front of camera 0011 % (similar direction as xs) 0012 % 0013 % Wolfgang Förstner 4/2013 0014 % wfoerstn@uni-bonn.de 0015 % 0016 % See also calc_depth_central_x, calc_depth_central_xs_RZ, calc_depth_perspective 0017 0018 function d = calc_depth_central_xs(X,P,xs) 0019 0020 [~,R,Z] = calc_KRZ_from_P(P,1); 0021 0022 d = xs'*R*(X(1:3)/X(4)-Z);