32 #include <Base/Common/CompareFloatingPoint.hh>
34 #include <Geometry/ProjectionParametersPerspective.hh>
35 #include <Base/Math/Random.hh>
47 int main(
int argc,
char *argv[])
59 const unsigned int width = 1024;
60 const unsigned int height = 768;
62 ppp.SetUndistortionInverseRad(-0.2696871916, 0.1517598534, 0.002169664669, 0.001128644153);
63 ppp.SetFocalLengthAndAspect(1129.290664, 0.9905520182);
64 ppp.SetPrincipal(561.5692167, 348.5405689);
74 int countError = 0, countAll = 0;
75 double sumError = 0.0, sumSqError = 0.0;
80 unsigned int numCams = 100;
81 unsigned int numPoints = 100;
85 double maxError = 0.0;
86 double dist=0, error=0;
88 for (
unsigned int cams=0; cams < numCams; cams++)
98 for (
unsigned int points=0; points < numPoints; points++)
102 p2d[0] = p2d[1] = 0.0;
113 p3d = ppp.UnProjectToPoint(p2d, dist);
114 p2d_p = ppp.Project(p3d);
116 cout <<
"point " << p2d <<
" error " << error << endl;
126 if(maxError < error){
130 sumSqError += error*error;
137 int pr = int(100.0*
double(cams)/numCams);
139 while(percent < pr) {
143 cout <<
" " << percent <<
"% ";
147 double meanError = sumError / (double)countAll;
148 double stdError = sqrt(sumSqError / (
double)countAll - meanError*meanError);
150 cout <<
"\n\n----------------------------------------------------------\n"
151 <<
" count of errors > " << EPSILON <<
" : " << countError
152 <<
" (" << 100.0*(double)countError/(
double)countAll <<
"%)\n"
153 <<
" average error : " << meanError <<
" +- " << stdError << endl
154 <<
" max. error : " << maxError << endl
155 <<
"----------------------------------------------------------\n\n";
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
void GetEuclidean(Vector2< HOMGPOINT2D_TYPE > &dest) const
calculate affine coordinates of this and write them to dest affine coordinates are projective coordin...
double GetUniformDistributed(const double min, const double max)
on succesive calls return uniform distributed random variable between min and max ...
bool Greater(const T left, const T right, const T eps=std::numeric_limits< T >::epsilon())
comparison function for floating point values
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
class for producing random numbers from different distributions