vgl_h_matrix_1d_compute_linear.cxx
Go to the documentation of this file.
1 // This is core/vgl/algo/vgl_h_matrix_1d_compute_linear.cxx
3 #include <cassert>
4 #ifdef _MSC_VER
5 # include <vcl_msvc_warnings.h>
6 #endif
7 #include <vnl/algo/vnl_svd.h>
8 
9 //********************************************************************************
10 //
11 //
12 //
13 //********************************************************************************
14 
17  const std::vector<vgl_homg_point_1d<double> >&Q,
19 {
20  unsigned N=P.size(); assert(N==Q.size());
21  vnl_matrix<double> D(N,4);
22  for (unsigned i=0;i<N;i++) {
23  D(i,0)=P[i].x()*Q[i].w();
24  D(i,1)=P[i].w()*Q[i].w();
25  D(i,2)=-P[i].x()*Q[i].x();
26  D(i,3)=-P[i].w()*Q[i].x();
27  }
28  vnl_svd<double> svd(D);
29  M.set(svd.nullvector().data_block());
30  return true;
31 }
A class to hold a line-to-line projective transformation matrix and to perform common operations usin...
Definition: vgl_algo_fwd.h:10
bool compute_cool_homg(const std::vector< vgl_homg_point_1d< double > > &points1, const std::vector< vgl_homg_point_1d< double > > &points2, vgl_h_matrix_1d< double > &H) override
vgl_h_matrix_1d & set(T const *M)
Set to 2x2 row-stored matrix.
find line-to-line projectivity from a set of matched points using SVD
Represents a homogeneous 1-D point, i.e., a homogeneous pair (x,w).
Definition: vgl_fwd.h:7