39 TCamera() : ncols(640), nrows(480), focalLengthMeters(0)
41 intrinsicParams.set_unsafe(0,0,507.808);
42 intrinsicParams.set_unsafe(1,1,507.808);
43 intrinsicParams.set_unsafe(0,2,356.2368);
44 intrinsicParams.set_unsafe(1,2,252.9216);
45 intrinsicParams.set_unsafe(2,2,1);
46 for (
size_t i=0;i<dist.SizeAtCompileTime ;i++)
62 void scaleToResolution(
unsigned int new_ncols,
unsigned int new_nrows);
104 intrinsicParams.set_unsafe( 0, 0, fx );
105 intrinsicParams.set_unsafe( 1, 1, fy );
106 intrinsicParams.set_unsafe( 0, 2, cx );
107 intrinsicParams.set_unsafe( 1, 2, cy );
113 for (
size_t i=0;i<5;i++)
114 distParVector.set_unsafe(0,i, dist[i]);
119 std::vector<double>
v(5);
120 for (
size_t i=0;i<5;i++)
128 for (
size_t i=0;i<5;i++)
129 dist[i] = distParVector.get_unsafe(0,i);
133 template <
class VECTORLIKE>
136 size_t N =
static_cast<size_t>(distParVector.size());
139 for (
size_t i=0;i<N;i++) dist[i] = distParVector[i];
154 inline double cx()
const {
return intrinsicParams(0,2); }
156 inline double cy()
const {
return intrinsicParams(1,2); }
158 inline double fx()
const {
return intrinsicParams(0,0); }
160 inline double fy()
const {
return intrinsicParams(1,1); }
163 inline void cx(
double val) { intrinsicParams(0,2)=
val; }
165 inline void cy(
double val) { intrinsicParams(1,2)=
val; }
167 inline void fx(
double val) { intrinsicParams(0,0)=
val; }
169 inline void fy(
double val) { intrinsicParams(1,1)=
val; }
172 inline double k1()
const {
return dist[0]; }
174 inline double k2()
const {
return dist[1]; }
176 inline double p1()
const {
return dist[2]; }
178 inline double p2()
const {
return dist[3]; }
180 inline double k3()
const {
return dist[4]; }
bool operator!=(const CArray< T, N > &x, const CArray< T, N > &y)
void k1(double val)
Get the value of the k1 distortion parameter.
void p1(double val)
Get the value of the p1 distortion parameter.
double focalLengthMeters
The focal length of the camera, in meters (can be used among 'intrinsicParams' to determine the pixel...
double p1() const
Get the value of the p1 distortion parameter.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
#define DECLARE_MEXPLUS_FROM(complete_type)
This must be inserted if a custom conversion method for MEX API is implemented in the class...
double cy() const
Get the value of the principal point y-coordinate (in pixels).
void setDistortionParamsVector(const VECTORLIKE &distParVector)
Set the whole vector of distortion params of the camera from a 4 or 5-vector.
This class allows loading and storing values and vectors of different types from a configuration text...
double fx() const
Get the value of the focal length x-value (in pixels).
double fy() const
Get the value of the focal length y-value (in pixels).
double k1() const
Get the value of the k1 distortion parameter.
#define DECLARE_MEX_CONVERSION
This must be inserted if a custom conversion method for MEX API is implemented in the class...
double p2() const
Get the value of the p2 distortion parameter.
void setDistortionParamsVector(const mrpt::math::CMatrixDouble15 &distParVector)
Set the whole vector of distortion params of the camera.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &cfg, const std::string §ion)
overload This signature is consistent with the rest of MRPT APIs
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
void fy(double val)
Set the value of the focal length y-value (in pixels).
GLsizei const GLchar ** string
double cx() const
Get the value of the principal point x-coordinate (in pixels).
mrpt::math::CMatrixDouble33 intrinsicParams
Matrix of intrinsic parameters (containing the focal length and principal point coordinates) ...
void p2(double val)
Get the value of the p2 distortion parameter.
std::vector< double > getDistortionParamsAsVector() const
Get a vector with the distortion params of the camera.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void k3(double val)
Get the value of the k3 distortion parameter.
double k3() const
Get the value of the k3 distortion parameter.
mrpt::math::CArrayDouble< 5 > dist
[k1 k2 t1 t2 k3] -> k_i: parameters of radial distortion, t_i: parameters of tangential distortion (d...
void k2(double val)
Get the value of the k2 distortion parameter.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
uint32_t nrows
Camera resolution.
void cx(double val)
Set the value of the principal point x-coordinate (in pixels).
bool operator==(const CArray< T, N > &x, const CArray< T, N > &y)
void fx(double val)
Set the value of the focal length x-value (in pixels).
void setDistortionParamsFromValues(double k1, double k2, double p1, double p2, double k3=0)
Set the vector of distortion params of the camera from the individual values of the distortion coeffi...
double k2() const
Get the value of the k2 distortion parameter.
void cy(double val)
Set the value of the principal point y-coordinate (in pixels).
unsigned __int32 uint32_t
GLubyte GLubyte GLubyte a
void setIntrinsicParamsFromValues(double fx, double fy, double cx, double cy)
Set the matrix of intrinsic params of the camera from the individual values of focal length and princ...
void getDistortionParamsVector(mrpt::math::CMatrixDouble15 &distParVector) const
Get the vector of distortion params of the camera.
Structure to hold the parameters of a pinhole camera model.