Go to the documentation of this file.00001 #ifndef vgl_h_matrix_1d_compute_h_
00002 #define vgl_h_matrix_1d_compute_h_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <vgl/vgl_homg_point_1d.h>
00022 #include <vgl/algo/vgl_h_matrix_1d.h>
00023 #include <vcl_vector.h>
00024
00025 class vgl_h_matrix_1d_compute
00026 {
00027 public:
00028
00029 vgl_h_matrix_1d_compute() : verbose_(false) {}
00030 virtual ~vgl_h_matrix_1d_compute() {}
00031
00032
00033 void verbose(bool v) { verbose_=v; }
00034
00035
00036
00037
00038
00039
00040 bool compute(const vcl_vector<vgl_homg_point_1d<double> >& p1,
00041 const vcl_vector<vgl_homg_point_1d<double> >& p2,
00042 vgl_h_matrix_1d<double>& H)
00043 { return compute_cool_homg(p1,p2,H); }
00044
00045
00046 bool compute(const double p1[],
00047 const double p2[],
00048 unsigned int length,
00049 vgl_h_matrix_1d<double>& H)
00050 { return compute_array_dbl(p1,p2,length,H); }
00051
00052
00053 vgl_h_matrix_1d<double>
00054 compute(vcl_vector<vgl_homg_point_1d<double> > const& p1,
00055 vcl_vector<vgl_homg_point_1d<double> > const& p2)
00056 { vgl_h_matrix_1d<double> H; compute(p1, p2, H); return H; }
00057
00058 protected:
00059 bool verbose_;
00060
00061 virtual bool compute_cool_homg(const vcl_vector<vgl_homg_point_1d<double> > &,
00062 const vcl_vector<vgl_homg_point_1d<double> > &,
00063 vgl_h_matrix_1d<double>& H) = 0;
00064
00065 bool compute_array_dbl(const double p1[], const double p2[], unsigned int length,
00066 vgl_h_matrix_1d<double>& H)
00067 {
00068 vcl_vector<vgl_homg_point_1d<double> > pt1; pt1.reserve(length);
00069 vcl_vector<vgl_homg_point_1d<double> > pt2; pt2.reserve(length);
00070 for (unsigned int i=0;i<length; ++i) {
00071 pt1.push_back(vgl_homg_point_1d<double>(p1[i],1.0));
00072 pt2.push_back(vgl_homg_point_1d<double>(p2[i],1.0));
00073 }
00074 return compute_cool_homg(pt1,pt2,H);
00075 }
00076 };
00077
00078 #endif // vgl_h_matrix_1d_compute_h_