53 #define GETOPTARGS "h"
55 #include <visp/vpMath.h>
56 #include <visp/vpDebug.h>
57 #include <visp/vpParseArgv.h>
58 #include <visp/vpCameraParameters.h>
59 #include <visp/vpMeterPixelConversion.h>
60 #include <visp/vpPixelMeterConversion.h>
61 #include <visp/vpMath.h>
65 void usage(
const char *name,
const char *badparam);
66 bool getOptions(
int argc,
const char **argv);
73 void usage(
const char *name,
const char *badparam)
76 Performs various tests on the vpPixelMeterConversion and\n\
77 vpPixelMeterConversion class.\n\
88 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
97 bool getOptions(
int argc,
const char **argv)
104 case 'h': usage(argv[0], NULL);
return false;
break;
107 usage(argv[0], optarg_);
112 if ((c == 1) || (c == -1)) {
114 usage(argv[0], NULL);
115 std::cerr <<
"ERROR: " << std::endl;
116 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
125 main(
int argc,
const char ** argv)
129 if (getOptions(argc, argv) ==
false) {
140 double px_dist,py_dist,u0_dist,v0_dist,kud_dist,kdu_dist;
141 px_dist = 1624.824731;
142 py_dist = 1625.263641;
143 u0_dist = 324.0923411;
144 v0_dist = 245.2421388;
145 kud_dist = -0.1741532338;
146 kdu_dist = 0.1771165148;
154 double x1 = 0, y1 = 0;
155 double u2 = 0, v2 = 0;
159 vpTRACE(
"Error in convertPoint without distortion:\n"
161 "v1 = %f, v2 = %f\n",u1,u2,v1,v2);
164 vpTRACE(
"convertPoint without distortion :\n"
166 "v1 - v2 = %.20f\n",u1 - u2,v1 - v2);
171 vpTRACE(
"Error in convertPoint with distortion :\n"
173 "v1 = %f, v2 = %f\n",u1,u2,v1,v2);
176 vpTRACE(
"convertPoint with distortion :\n"
178 "v1 - v2 = %.20f\n",u1 - u2,v1 - v2);
182 std::cout <<
"Catch an exception: " << e << std::endl;
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
static bool equal(double x, double y, double s=0.001)
error that can be emited by ViSP classes.
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
Point coordinates conversion from pixel coordinates to normalized coordinates in meter...
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
Generic class defining intrinsic camera parameters.
void initPersProjWithDistortion(const double px, const double py, const double u0, const double v0, const double kud, const double kdu)