contrib/mul/m23d/m23d_scaled_ortho_projection.cxx
Go to the documentation of this file.
00001 #include "m23d_scaled_ortho_projection.h"
00002 //:
00003 // \file
00004 // \author Tim Cootes
00005 // \brief Extracts scaled rotation/projection component of 2x3 projection matrix P
00006 
00007 #include <vnl/algo/vnl_svd.h>
00008 
00009 //: Extracts scaled rotation/projection component of 2x3 projection matrix P
00010 // Resulting 2x3 is of the form s*(I|0)*R
00011 vnl_matrix<double> m23d_scaled_ortho_projection(const vnl_matrix<double>& P)
00012 {
00013   vnl_svd<double> svd(P.transpose());
00014   double k=0.5*(svd.W(0)+svd.W(1));
00015   return k*svd.V()*svd.U().transpose();
00016 }