34 #include "Geometry/HMatrixEstimation.hh"
35 #include "Base/Math/Random.hh"
41 int main(
int ,
char** )
44 HMatrix TheoH(MatrixIdentity), EstH(MatrixZero);
47 TheoH[0][0]=1.5; TheoH[0][1]= 0; TheoH[0][2]=10;
48 TheoH[1][0]= 0; TheoH[1][1]=2.1; TheoH[1][2]=100;
49 TheoH[2][0]= 0; TheoH[2][1]= 0; TheoH[2][2]=1;
51 std::vector<HomgPoint2D> points_src;
52 std::vector<HomgPoint2D> points_dest, points_dest_with_out;
55 const double noise = 0.3;
58 for (
int i = 0; i <100; i++){
61 for (
int k=0; k<2; k++)
63 point2d_im1[k]=1000.0*rand()/(RAND_MAX+1.0);
77 points_src.push_back(point2d_im1);
78 points_dest.push_back(point2d_im2);
86 if (fabs(EstH[2][2])>1e-50) EstH /= EstH[2][2];
88 cout <<
"H ground truth is " << TheoH << endl;
91 cout <<
"H Est is " << EstH << endl;
int ComputeAffine(const std::vector< BIAS::HomgPoint2D > &fromPoints, const std::vector< BIAS::HomgPoint2D > &toPoints, HMatrix &H)
Compute affine transformation between 2d points, i.e.
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
Estimate 3x3 matrix relating image coordinates with each other, i.e.
double GetNormalDistributed(const double mean, const double sigma)
on succesive calls return normal distributed random variable with mean and standard deviation sigma ...
class for producing random numbers from different distributions