Go to the documentation of this file.00001
00002 #include "rrel_homography2d_est_aff.h"
00003
00004
00005 #include <vnl/vnl_matrix.h>
00006 #include <vnl/vnl_vector.h>
00007 #include <vgl/vgl_homg_point_2d.h>
00008
00009
00010 rrel_homography2d_est_aff :: rrel_homography2d_est_aff( const vcl_vector< vgl_homg_point_2d<double> > & from_pts,
00011 const vcl_vector< vgl_homg_point_2d<double> > & to_pts )
00012 : rrel_homography2d_est( from_pts, to_pts, 6)
00013 {
00014
00015 }
00016
00017 rrel_homography2d_est_aff :: rrel_homography2d_est_aff( const vcl_vector< vnl_vector<double> > & from_pts,
00018 const vcl_vector< vnl_vector<double> > & to_pts )
00019 : rrel_homography2d_est( from_pts, to_pts, 6)
00020 {
00021
00022 }
00023
00024 rrel_homography2d_est_aff::~rrel_homography2d_est_aff()
00025 {
00026
00027 }
00028
00029 void
00030 rrel_homography2d_est_aff :: homography_to_parameters(const vnl_matrix<double>& m,
00031 vnl_vector<double>& p) const
00032 {
00033 p(0) = m(0, 0) / m(2, 2);
00034 p(1) = m(0, 1) / m(2, 2);
00035 p(2) = m(0, 2) / m(2, 2);
00036 p(3) = m(1, 0) / m(2, 2);
00037 p(4) = m(1, 1) / m(2, 2);
00038 p(5) = m(1, 2) / m(2, 2);
00039 p(6) = 0.0;
00040 p(7) = 0.0;
00041 p(8) = 1.0;
00042 }
00043
00044 void
00045 rrel_homography2d_est_aff :: parameters_to_homography(const vnl_vector<double>& p,
00046 vnl_matrix<double>& m) const
00047 {
00048 m(0, 0) = p(0) / p(8);
00049 m(0, 1) = p(1) / p(8);
00050 m(0, 2) = p(2) / p(8);
00051 m(1, 0) = p(3) / p(8);
00052 m(1, 1) = p(4) / p(8);
00053 m(1, 2) = p(5) / p(8);
00054 m(2, 0) = 0.0;
00055 m(2, 1) = 0.0;
00056 m(2, 2) = 1.0;
00057 }