31 #include <Geometry/HMatrixEstimation.hh>
38 int main(
int argc,
char *argv[])
41 const int num_points=4;
42 vector<HomgPoint2D> frompoints(4), topoints(4);
43 const int num_fields = 22;
44 frompoints[0].Set(0.0, 0.0, 1.0);
45 frompoints[1].Set((
double)(num_fields), 0.0, 1.0);
46 frompoints[2].Set((
double)(num_fields), (
double)(num_fields), 1.0);
47 frompoints[3].Set(0.0, (
double)(num_fields), 1.0);
48 topoints[0].Set(521.8942308, 64.35576923, 1.);
49 topoints[1].Set(527., 280., 1.);
50 topoints[2].Set(310.96, 282.0, 1.);
51 topoints[3].Set(309., 62., 1.);
54 int res = Hest.
Compute(frompoints, topoints, H);
56 BIASERR(
"error computing H: "<<res);
60 for (
int i=0; i<num_points; i++){
61 hfrom = H * frompoints[i];
64 cout <<
" from = "<<frompoints[i]
65 <<
"\nH * from = "<<hfrom
66 <<
"\n to = "<<topoints[i]<<
"\n--------\n";
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
a 3x3 Matrix describing projective transformations between planes
HomgPoint2D & Homogenize()
homogenize class data member elements to W==1 by divison by W
bool IsAtInfinity() const
int Compute(const std::vector< BIAS::HomgPoint2D > &fromPoints, const std::vector< BIAS::HomgPoint2D > &toPoints, HMatrix &H)
Calculate homography between 2d points using the DLT.
Estimate 3x3 matrix relating image coordinates with each other, i.e.