Go to the documentation of this file.
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++)
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]; }
183 inline void k1(
double val) { dist[0]=val; }
185 inline void k2(
double val) { dist[1]=val; }
187 inline void p1(
double val) { dist[2]=val; }
189 inline void p2(
double val) { dist[3]=val; }
191 inline void k3(
double val) { dist[4]=val; }
double p1() const
Get the value of the p1 distortion parameter.
void scaleToResolution(unsigned int new_ncols, unsigned int new_nrows)
Rescale all the parameters for a new camera resolution (it raises an exception if the aspect ratio is...
double focalLengthMeters
The focal length of the camera, in meters (can be used among 'intrinsicParams' to determine the pixel...
double k2() const
Get the value of the k2 distortion parameter.
uint32_t nrows
Camera resolution.
void k3(double val)
Get the value of the k3 distortion parameter.
void saveToConfigFile(const std::string §ion, mrpt::utils::CConfigFileBase &cfg) const
Save as a config block:
mrpt::math::CArrayDouble< 5 > dist
[k1 k2 t1 t2 k3] -> k_i: parameters of radial distortion, t_i: parameters of tangential distortion (d...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
void k1(double val)
Get the value of the k1 distortion parameter.
double k1() const
Get the value of the k1 distortion parameter.
void cx(double val)
Set 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)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void p2(double val)
Get the value of the p2 distortion parameter.
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...
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.
void fx(double val)
Set the value of the focal length x-value (in pixels).
void getDistortionParamsVector(mrpt::math::CMatrixDouble15 &distParVector) const
Get the vector of distortion params of the camera
std::string dumpAsText() const
Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.
double cx() const
Get the value of the principal point x-coordinate (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...
This class allows loading and storing values and vectors of different types from a configuration text...
void k2(double val)
Get the value of the k2 distortion parameter.
A numeric matrix of compile-time fixed size.
#define DECLARE_MEXPLUS_FROM(complete_type)
This must be inserted if a custom conversion method for MEX API is implemented in the class.
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 fy() const
Get the value of the focal length y-value (in pixels).
void cy(double val)
Set the value of the principal point y-coordinate (in pixels).
void setDistortionParamsVector(const mrpt::math::CMatrixDouble15 &distParVector)
Set the whole vector of distortion params of the camera.
void loadFromConfigFile(const std::string §ion, const mrpt::utils::CConfigFileBase &cfg)
Load all the params from a config source, in the format used in saveToConfigFile(),...
Structure to hold the parameters of a pinhole camera model.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &cfg, const std::string §ion)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
double k3() const
Get the value of the k3 distortion parameter.
void p1(double val)
Get the value of the p1 distortion parameter.
std::vector< double > getDistortionParamsAsVector() const
Get a vector with the distortion params of the camera
void fy(double val)
Set the value of the focal length y-value (in pixels).
#define DECLARE_MEX_CONVERSION
This must be inserted if a custom conversion method for MEX API is implemented in the class.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |