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 ;
314 vpERROR_TRACE(
"\n\t getting K matrix in the case of projection \
315 with distortion has no sense");
317 "\n\t getting K matrix in the case of projection \
318 with distortion has no sense"));
334 std::cout.precision(10);
335 std::cout <<
"Camera parameters for perspective projection without distortion:"
337 std::cout <<
" px = " << px <<
"\t py = "<< py << std::endl ;
338 std::cout <<
" u0 = " << u0 <<
"\t v0 = "<< v0 << std::endl ;
341 std::cout.precision(10);
342 std::cout <<
"Camera parameters for perspective projection with distortion:"
344 std::cout <<
" px = " << px <<
"\t py = "<< py << std::endl ;
345 std::cout <<
" u0 = " << u0 <<
"\t v0 = "<< v0 << std::endl ;
346 std::cout <<
" kud = " << kud << std::endl ;
347 std::cout <<
" kdu = " << kdu << std::endl ;
363 os <<
"Camera parameters for perspective projection without distortion:"
365 os <<
" px = " << cam.
get_px() <<
"\t py = "<< cam.
get_py()
367 os <<
" u0 = " << cam.
get_u0() <<
"\t v0 = "<< cam.
get_v0()
372 os <<
"Camera parameters for perspective projection with distortion:"
374 os <<
" px = " << cam.
get_px() <<
"\t py = "<< cam.
get_py()
376 os <<
" u0 = " << cam.
get_u0() <<
"\t v0 = "<< cam.
get_v0()
378 os <<
" kud = " << cam.
get_kud() << std::endl ;
379 os <<
" kdu = " << cam.
get_kdu() << std::endl ;
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.
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)