36 TCamera() : ncols(640), nrows(480), focalLengthMeters(0)
38 intrinsicParams.set_unsafe(0,0,507.808);
39 intrinsicParams.set_unsafe(1,1,507.808);
40 intrinsicParams.set_unsafe(0,2,356.2368);
41 intrinsicParams.set_unsafe(1,2,252.9216);
42 intrinsicParams.set_unsafe(2,2,1);
43 for (
size_t i=0;i<dist.SizeAtCompileTime ;i++)
59 void scaleToResolution(
unsigned int new_ncols,
unsigned int new_nrows);
92 std::string dumpAsText()
const;
99 intrinsicParams.set_unsafe( 0, 0, fx );
100 intrinsicParams.set_unsafe( 1, 1, fy );
101 intrinsicParams.set_unsafe( 0, 2, cx );
102 intrinsicParams.set_unsafe( 1, 2, cy );
108 for (
size_t i=0;i<5;i++)
109 distParVector.set_unsafe(0,i, dist[i]);
114 std::vector<double> v(5);
115 for (
size_t i=0;i<5;i++)
123 for (
size_t i=0;i<5;i++)
124 dist[i] = distParVector.get_unsafe(0,i);
128 template <
class VECTORLIKE>
131 size_t N =
static_cast<size_t>(distParVector.size());
134 for (
size_t i=0;i<N;i++) dist[i] = distParVector[i];
149 inline double cx()
const {
return intrinsicParams(0,2); }
151 inline double cy()
const {
return intrinsicParams(1,2); }
153 inline double fx()
const {
return intrinsicParams(0,0); }
155 inline double fy()
const {
return intrinsicParams(1,1); }
158 inline void cx(
double val) { intrinsicParams(0,2)=val; }
160 inline void cy(
double val) { intrinsicParams(1,2)=val; }
162 inline void fx(
double val) { intrinsicParams(0,0)=val; }
164 inline void fy(
double val) { intrinsicParams(1,1)=val; }
167 inline double k1()
const {
return dist[0]; }
169 inline double k2()
const {
return dist[1]; }
171 inline double p1()
const {
return dist[2]; }
173 inline double p2()
const {
return dist[3]; }
175 inline double k3()
const {
return dist[4]; }
178 inline void k1(
double val) { dist[0]=val; }
180 inline void k2(
double val) { dist[1]=val; }
182 inline void p1(
double val) { dist[2]=val; }
184 inline void p2(
double val) { dist[3]=val; }
186 inline void k3(
double val) { dist[4]=val; }
191 bool
BASE_IMPEXP operator ==(const
mrpt::utils::TCamera& a, const
mrpt::utils::TCamera& b);
192 bool BASE_IMPEXP operator !=(const
mrpt::utils::TCamera& a, const
mrpt::utils::TCamera& b);
void k1(double val)
Get the value of the k1 distortion parameter.
std::vector< double > getDistortionParamsAsVector() const
Get a vector with the distortion params of the camera.
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...
The virtual base class which provides a unified interface for all persistent objects in MRPT...
double p2() const
Get the value of the p2 distortion parameter.
double k1() const
Get the value of the k1 distortion parameter.
double k2() const
Get the value of the k2 distortion parameter.
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 fy() const
Get the value of the focal length y-value (in pixels).
A numeric matrix of compile-time fixed size.
void setDistortionParamsVector(const mrpt::math::CMatrixDouble15 &distParVector)
Set the whole vector of distortion params of the camera.
#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).
double k3() const
Get the value of the k3 distortion parameter.
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.
void getDistortionParamsVector(mrpt::math::CMatrixDouble15 &distParVector) const
Get the vector of 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.
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).
void fx(double val)
Set the value of the focal length x-value (in pixels).
double fx() const
Get 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 p1() const
Get the value of the p1 distortion parameter.
void cy(double val)
Set the value of the principal point y-coordinate (in pixels).
double cx() const
Get the value of the principal point x-coordinate (in pixels).
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...
Structure to hold the parameters of a pinhole camera model.
double cy() const
Get the value of the principal point y-coordinate (in pixels).