17 #include <mexplus/mxarray.h> 31 : cameraPose(),
image(iplImage)
46 out << cameraPose << cameraParams <<
image << timestamp << sensorLabel;
71 CMatrix intrinsicParams, distortionParams;
72 in >> distortionParams >> intrinsicParams;
74 if (
size(distortionParams, 1) == 1 &&
75 size(distortionParams, 2) == 5)
78 cameraParams.setDistortionParamsVector(
p);
81 cameraParams.dist.assign(0);
83 cameraParams.intrinsicParams =
84 intrinsicParams.block(0, 0, 3, 3).cast<
double>();
89 if (version >= 1)
in >> timestamp;
93 if (version < 4)
in >> cameraParams.focalLengthMeters;
96 cameraParams.focalLengthMeters = 0.002;
118 const char* fields[] = {
"class",
"ts",
"sensorLabel",
119 "image",
"pose",
"params"};
120 mexplus::MxArray obs_struct(
121 mexplus::MxArray::Struct(
sizeof(fields) /
sizeof(fields[0]), fields));
123 obs_struct.set(
"class", this->GetRuntimeClass()->className);
124 obs_struct.set(
"ts", this->timestamp);
125 obs_struct.set(
"sensorLabel", this->sensorLabel);
126 obs_struct.set(
"image", this->
image);
127 obs_struct.set(
"pose", this->cameraPose);
128 obs_struct.set(
"params", this->cameraParams);
129 return obs_struct.release();
138 image.rectifyImage(out_img, cameraParams);
146 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot " 148 o << cameraPose.getHomogeneousMatrixVal() << cameraPose << endl;
151 "Focal length: %.03f mm\n", cameraParams.focalLengthMeters * 1000);
153 o <<
"Intrinsic parameters matrix for the camera:" << endl
154 << cameraParams.intrinsicParams.inMatlabFormat() << endl
155 << cameraParams.intrinsicParams << endl;
157 o <<
"Distorsion parameters for the camera: " 158 << cameraParams.getDistortionParamsAsVector() << endl;
160 if (
image.isExternallyStored())
161 o <<
" Image is stored externally in file: " 162 <<
image.getExternalStorageFile() << endl;
165 " Image size: %ux%u pixels\n", (
unsigned int)
image.getWidth(),
166 (
unsigned int)
image.getHeight());
168 o <<
" Channels order: " <<
image.getChannelsOrder() << endl;
171 " Rows are stored in top-bottom order: %s\n",
172 image.isOriginTopLeft() ?
"YES" :
"NO");
Declares a class derived from "CObservation" that encapsules an image from a camera, whose relative pose to robot is also stored.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
A class for storing images as grayscale or RGB bitmaps.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
GLenum GLsizei GLenum GLenum const GLvoid * image
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
void getRectifiedImage(mrpt::utils::CImage &out_img) const
Computes the rectified (un-distorted) image, using the embeded distortion parameters.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This namespace contains representation of robot actions and observations.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
#define IMPLEMENTS_MEXPLUS_FROM(complete_type)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
virtual mxArray * writeToMatlab() const
Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.
Declares a class that represents any robot's observation.
This class is a "CSerializable" wrapper for "CMatrixFloat".
struct mxArray_tag mxArray
Forward declaration for mxArray (avoid #including as much as possible to speed up compiling) ...
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...