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