% Viewing direction from P of perspective camera Usage: d = calc_viewing_direction(P) P - 4 x 3-projection matrix P = K*R*[I|-Z] d - 3x1 vector viewing direction, not normalized Wolfgang Förstner 4/2013 wfoerstn@uni-bonn.de See also calc_P_from_KRZ, calc_KRZ_from_P, calc_Q_from_P
0001 %% Viewing direction from P of perspective camera 0002 % 0003 % Usage: 0004 % d = calc_viewing_direction(P) 0005 % 0006 % P - 4 x 3-projection matrix P = K*R*[I|-Z] 0007 % 0008 % d - 3x1 vector viewing direction, not normalized 0009 % 0010 % Wolfgang Förstner 4/2013 0011 % wfoerstn@uni-bonn.de 0012 % 0013 % See also calc_P_from_KRZ, calc_KRZ_from_P, calc_Q_from_P 0014 0015 function d = calc_viewing_direction(P) 0016 0017 d = -P(3,1:3)'*det(P(:,1:3));