function p2d = project( p3d, cam, align_mat ) p2d = []; ncams = length( cam ); for c = 1:ncams % Project to 3D video referent xyz = inv( align_mat ) * p3d; % Euclidian projection new_x = cam( c ).Pmat * xyz; new_x = new_x ./ repmat( new_x( 3,:), 3, 1 ) ; % Apply radial distortion new_xd = doradial( new_x, cam(c).K, cam(c).kc, cam(c).alpha_c ); p2d = [ p2d; new_xd ]; end