51 #include <visp/vpCameraParameters.h>
52 #include <visp/vpDebug.h>
53 #include <visp/vpException.h>
57 const double vpCameraParameters::DEFAULT_PX_PARAMETER = 600.0;
58 const double vpCameraParameters::DEFAULT_PY_PARAMETER = 600.0;
59 const double vpCameraParameters::DEFAULT_U0_PARAMETER = 192.0;
60 const double vpCameraParameters::DEFAULT_V0_PARAMETER = 144.0;
61 const double vpCameraParameters::DEFAULT_KUD_PARAMETER = 0.0;
62 const double vpCameraParameters::DEFAULT_KDU_PARAMETER = 0.0;
64 vpCameraParameters::DEFAULT_PROJ_TYPE =
94 const double u0,
const double v0)
109 const double u0,
const double v0,
110 const double kud,
const double kdu)
121 this->projModel = DEFAULT_PROJ_TYPE ;
123 this->px = DEFAULT_PX_PARAMETER ;
124 this->py = DEFAULT_PY_PARAMETER ;
125 this->u0 = DEFAULT_U0_PARAMETER ;
126 this->v0 = DEFAULT_V0_PARAMETER ;
127 this->kud = DEFAULT_KUD_PARAMETER ;
128 this->kdu = DEFAULT_KDU_PARAMETER ;
130 if (fabs(this->px)<1e-6)
134 "Camera parameter px = 0")) ;
136 if (fabs(this->py)<1e-6)
140 "Camera parameter px = 0")) ;
142 this->inv_px = 1./this->px;
143 this->inv_py = 1./this->py;
154 const double py,
const double u0,
const double v0)
169 "Camera parameter px = 0")) ;
175 "Camera parameter px = 0")) ;
177 this->inv_px = 1./px;
178 this->inv_py = 1./py;
191 const double u0,
const double v0,
192 const double kud,
const double kdu)
207 "Camera parameter px = 0")) ;
213 "Camera parameter px = 0")) ;
215 this->inv_px = 1./px;
216 this->inv_py = 1./py;
258 if( std::fabs(_K[2][2] - 1.0) > std::numeric_limits<double>::epsilon()){
271 projModel = cam.projModel ;
316 vpERROR_TRACE(
"\n\t getting K matrix in the case of projection \
317 with distortion has no sense");
319 "\n\t getting K matrix in the case of projection \
320 with distortion has no sense"));
348 K_inv[0][0] = inv_px ;
349 K_inv[1][1] = inv_py ;
350 K_inv[0][2] = -u0*inv_px ;
351 K_inv[1][2] = -v0*inv_py ;
356 vpERROR_TRACE(
"\n\t getting K^-1 matrix in the case of projection \
357 with distortion has no sense");
359 "\n\t getting K matrix in the case of projection \
360 with distortion has no sense"));
376 std::cout.precision(10);
377 std::cout <<
"Camera parameters for perspective projection without distortion:"
379 std::cout <<
" px = " << px <<
"\t py = "<< py << std::endl ;
380 std::cout <<
" u0 = " << u0 <<
"\t v0 = "<< v0 << std::endl ;
383 std::cout.precision(10);
384 std::cout <<
"Camera parameters for perspective projection with distortion:"
386 std::cout <<
" px = " << px <<
"\t py = "<< py << std::endl ;
387 std::cout <<
" u0 = " << u0 <<
"\t v0 = "<< v0 << std::endl ;
388 std::cout <<
" kud = " << kud << std::endl ;
389 std::cout <<
" kdu = " << kdu << std::endl ;
405 os <<
"Camera parameters for perspective projection without distortion:"
407 os <<
" px = " << cam.
get_px() <<
"\t py = "<< cam.
get_py()
409 os <<
" u0 = " << cam.
get_u0() <<
"\t v0 = "<< cam.
get_v0()
414 os <<
"Camera parameters for perspective projection with distortion:"
416 os <<
" px = " << cam.
get_px() <<
"\t py = "<< cam.
get_py()
418 os <<
" u0 = " << cam.
get_u0() <<
"\t v0 = "<< cam.
get_v0()
420 os <<
" kud = " << cam.
get_kud() << std::endl ;
421 os <<
" kdu = " << cam.
get_kdu() << std::endl ;
vpMatrix get_K_inverse() const
Definition of the vpMatrix class.
void initFromCalibrationMatrix(const vpMatrix &_K)
void init()
basic initialization with the default parameters
void resize(const unsigned int nrows, const unsigned int ncols, const bool nullify=true)
Perspective projection without distortion model.
error that can be emited by ViSP classes.
virtual ~vpCameraParameters()
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
vpCameraParametersProjType
Generic class defining intrinsic camera parameters.
VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpImagePoint &ip)
Perspective projection with distortion model.
vpCameraParametersProjType get_projModel() const
unsigned int getCols() const
Return the number of columns of the matrix.
unsigned int getRows() const
Return the number of rows of the matrix.
vpCameraParameters & operator=(const vpCameraParameters &c)
void initPersProjWithDistortion(const double px, const double py, const double u0, const double v0, const double kud, const double kdu)