00001 // This is core/vgl/algo/vgl_norm_trans_3d.h 00002 #ifndef vgl_norm_trans_3d_h_ 00003 #define vgl_norm_trans_3d_h_ 00004 //: 00005 // \file 00006 // \brief The similarity transform that normalizes a 3-d point set 00007 // 00008 // Algorithms to compute projective transformations require that 00009 // the data be conditioned by insuring that the center of gravity 00010 // of the point set is at the origin and the standard deviation 00011 // is isotropic and unity. 00012 // 00013 // \verbatim 00014 // Modifications 00015 // Created August 14, 2004 - J.L. Mundy 00016 // \endverbatim 00017 00018 #include <vnl/vnl_matrix_fixed.h> 00019 #include <vgl/vgl_homg_point_3d.h> 00020 #include <vcl_iosfwd.h> 00021 #include <vgl/algo/vgl_h_matrix_3d.h> 00022 00023 template <class T> 00024 class vgl_norm_trans_3d: public vgl_h_matrix_3d<T> 00025 { 00026 public: 00027 00028 // Constructors/Initializers/Destructors------------------------------------- 00029 00030 vgl_norm_trans_3d(); 00031 vgl_norm_trans_3d(const vgl_norm_trans_3d<T>& M); 00032 vgl_norm_trans_3d(vnl_matrix_fixed<T,4,4> const& M); 00033 vgl_norm_trans_3d(const T* t_matrix); 00034 vgl_norm_trans_3d(vcl_istream& s); 00035 vgl_norm_trans_3d(char const* filename); 00036 ~vgl_norm_trans_3d(); 00037 00038 // Operations---------------------------------------------------------------- 00039 00040 //: compute the normalizing transform 00041 bool compute_from_points(vcl_vector<vgl_homg_point_3d<T> > const& points); 00042 00043 protected : // --- Utility functions ----------------------------------------- 00044 00045 static bool scale_xyzroot2(vcl_vector<vgl_homg_point_3d<T> > const& in, 00046 T& radius); 00047 00048 static void center_of_mass(vcl_vector<vgl_homg_point_3d<T> > const& points, 00049 T& cx, T& cy, T& cz); 00050 }; 00051 00052 #define VGL_NORM_TRANS_3D_INSTANTIATE(T) extern "please include vgl/algo/vgl_norm_trans_3d.txx first" 00053 00054 #endif // vgl_norm_trans_3d_h_