41 #ifndef _vpCameraParameters_h_
42 #define _vpCameraParameters_h_
46 #include <visp3/core/vpColVector.h>
47 #include <visp3/core/vpConfig.h>
48 #include <visp3/core/vpDebug.h>
49 #include <visp3/core/vpMatrix.h>
51 #ifdef VISP_HAVE_NLOHMANN_JSON
52 #include<nlohmann/json.hpp>
313 ProjWithKannalaBrandtDistortion
314 } vpCameraParametersProjType;
320 vpCameraParameters(
double px,
double py,
double u0,
double v0,
double kud,
double kdu);
321 vpCameraParameters(
double px,
double py,
double u0,
double v0,
const std::vector<double> &distortion_coefficients);
330 void initFromCalibrationMatrix(
const vpMatrix &_K);
331 void initFromFov(
const unsigned int &w,
const unsigned int &h,
const double &hfov,
const double &vfov);
332 void initPersProjWithoutDistortion(
double px,
double py,
double u0,
double v0);
333 void initPersProjWithDistortion(
double px,
double py,
double u0,
double v0,
double kud,
double kdu);
334 void initProjWithKannalaBrandtDistortion(
double px,
double py,
double u0,
double v0,
335 const std::vector<double> &distortion_coefficients);
346 void computeFov(
const unsigned int &w,
const unsigned int &h);
358 vpTRACE(
"Warning: The FOV is not computed, getHorizontalFovAngle() "
359 "won't be significant.");
374 vpTRACE(
"Warning: The FOV is not computed, getVerticalFovAngle() won't "
395 vpTRACE(
"Warning: The FOV is not computed, getFovNormals() won't be "
401 inline double get_px()
const {
return px; }
404 inline double get_py()
const {
return py; }
405 inline double get_u0()
const {
return u0; }
406 inline double get_v0()
const {
return v0; }
416 void printParameters();
417 friend VISP_EXPORT std::ostream &operator<<(std::ostream &os,
const vpCameraParameters &cam);
420 static const double DEFAULT_U0_PARAMETER;
421 static const double DEFAULT_V0_PARAMETER;
422 static const double DEFAULT_PX_PARAMETER;
423 static const double DEFAULT_PY_PARAMETER;
424 static const double DEFAULT_KUD_PARAMETER;
425 static const double DEFAULT_KDU_PARAMETER;
426 static const vpCameraParametersProjType DEFAULT_PROJ_TYPE;
432 std::vector<double> m_dist_coefs;
439 std::vector<vpColVector> fovNormals;
441 double inv_px, inv_py;
443 vpCameraParametersProjType projModel;
444 #ifdef VISP_HAVE_NLOHMANN_JSON
450 #ifdef VISP_HAVE_NLOHMANN_JSON
451 #include<nlohmann/json.hpp>
470 j[
"model"] = cam.projModel;
472 switch (cam.projModel) {
481 j[
"dist_coeffs"] = cam.m_dist_coefs;
519 const double px = j.at(
"px").get<
double>();
520 const double py = j.at(
"py").get<
double>();
521 const double u0 = j.at(
"u0").get<
double>();
522 const double v0 = j.at(
"v0").get<
double>();
533 const double kud = j.at(
"kud").get<
double>();
534 const double kdu = j.at(
"kdu").get<
double>();
540 const std::vector<double> coeffs = j.at(
"dist_coeffs").get<std::vector<double>>();
Generic class defining intrinsic camera parameters.
void initPersProjWithoutDistortion(double px, double py, double u0, double v0)
std::vector< double > getKannalaBrandtDistortionCoefficients() const
bool isFovComputed() const
vpCameraParametersProjType
@ perspectiveProjWithDistortion
Perspective projection with distortion model.
@ ProjWithKannalaBrandtDistortion
Projection with Kannala-Brandt distortion model.
@ perspectiveProjWithoutDistortion
Perspective projection without distortion model.
std::vector< vpColVector > getFovNormals() const
void initPersProjWithDistortion(double px, double py, double u0, double v0, double kud, double kdu)
double getHorizontalFovAngle() const
double getVerticalFovAngle() const
double get_px_inverse() const
double get_py_inverse() const
vpCameraParametersProjType get_projModel() const
void initProjWithKannalaBrandtDistortion(double px, double py, double u0, double v0, const std::vector< double > &distortion_coefficients)
Implementation of a matrix and operations on matrices.