32 #include <Base/Common/CompareFloatingPoint.hh>
34 #include <Geometry/ProjectionParametersOrthographic.hh>
35 #include <Base/Math/Random.hh>
47 int main(
int argc,
char *argv[]){
48 const unsigned int width = 800;
49 const unsigned int height = 600;
53 PPO ppo(rayDir, width, height, dX, dY);
54 ppo.SetPrincipal(561.5692167, 348.5405689);
66 double sumError = 0.0;
67 double sumSqError = 0.0;
69 unsigned int numCams = 100;
70 unsigned int numPoints = 100;
75 double maxError = 0.0;
79 for(
unsigned int cams=0; cams < numCams; cams++){
82 for(
unsigned int points=0; points < numPoints; points++){
85 p2d[0] = p2d[1] = 0.0;
96 p3d = ppo.UnProjectToPoint(p2d, dist,
true);
97 p2d_p = ppo.Project(p3d,
true);
99 cout<<
"point: "<<p2d<<
" proj_point: "<<p2d_p<<
" error: "<<error<<endl;
103 if(maxError < error){
107 sumSqError += error*error;
112 int pr = int(100.0*
double(cams)/numCams);
114 while(percent < pr) {
118 cout<<
" "<<percent<<
"% ";
122 double meanError = sumError / (double)countAll;
123 double stdError = sqrt(sumSqError / (
double)countAll - meanError*meanError);
125 cout<<
"\n\n----------------------------------------------------------\n"
126 <<
" count of errors > "<<EPSILON<<
" : "<<countError
127 <<
" ("<<100.0*(double)countError/(
double)countAll<<
"%)\n"
128 <<
" average error : "<<meanError<<
" +- "<<stdError<<endl
129 <<
" max. error : "<<maxError<<endl
130 <<
"----------------------------------------------------------\n\n";
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
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 ...
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
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