00001 #ifndef vgl_h_matrix_3d_compute_linear_h_ 00002 #define vgl_h_matrix_3d_compute_linear_h_ 00003 //: 00004 // \file 00005 // \brief contains class vgl_h_matrix_3d_compute_linear 00006 // \author Ozge C. Ozcanli 00007 // \date June 24, 2010 00008 // 00009 // vgl_h_matrix_3d_compute_linear uses the linear algorithm in point to point constructor of vgl_h_matrix_3d 00010 // to calculate the homography which relates at least five 3D point correspondences. 00011 // no four of them should be co-planar 00012 // 00013 // NOTE: the constructor of vgl_h_matrix_3d should not be used in itself as it does not standardize the point sets before 00014 // constructing the design matrix (which is the matrix that is decomposed using SVD) 00015 // the following class standardize the point sets and adjusts H accordingly 00016 // 00017 // The returned $H$ is such that 00018 // $H [p_1 p_2 p_3 p_4 p_5] \sim [p'_1 p'_2 p'_3 p'_4 p_5']$ 00019 // where the $p_i$ are the homogeneous points in 3D, and the 00020 // $p'_i$ their images. 00021 // 00022 // \verbatim 00023 // Modifications 00024 // none 00025 // \endverbatim 00026 00027 #include <vgl/algo/vgl_h_matrix_3d_compute.h> 00028 00029 class vgl_h_matrix_3d_compute_linear : public vgl_h_matrix_3d_compute 00030 { 00031 protected: 00032 //: compute from matched points 00033 virtual 00034 bool compute_p(vcl_vector<vgl_homg_point_3d<double> > const& points1, 00035 vcl_vector<vgl_homg_point_3d<double> > const& points2, 00036 vgl_h_matrix_3d<double>& H); 00037 00038 //:Assumes all corresponding points have equal weight 00039 bool solve_linear_problem(vcl_vector<vgl_homg_point_3d<double> > const& p1, 00040 vcl_vector<vgl_homg_point_3d<double> > const& p2, 00041 vgl_h_matrix_3d<double>& H); 00042 00043 public: 00044 vgl_h_matrix_3d_compute_linear() {} 00045 int minimum_number_of_correspondences() const { return 5; } 00046 }; 00047 00048 #endif // vgl_h_matrix_3d_compute_linear_h_