17 # include <mexplus/mxarray.h> 46 out << cameraPose << cameraParams <<
image 73 CMatrix intrinsicParams, distortionParams;
74 in >> distortionParams >> intrinsicParams;
76 if (
size(distortionParams,1)==1 &&
size(distortionParams,2)==5)
79 cameraParams.setDistortionParamsVector(
p);
81 else cameraParams.dist.assign(0);
83 cameraParams.intrinsicParams = intrinsicParams.block(0,0,3,3).cast<
double>();
94 in >> cameraParams.focalLengthMeters ;
97 cameraParams.focalLengthMeters = 0.002;
101 else sensorLabel =
"";
120 const char* fields[] = {
"class",
"ts",
"sensorLabel",
"image",
"pose",
"params"};
121 mexplus::MxArray obs_struct( 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 base:\n";
147 o << cameraPose.getHomogeneousMatrixVal()
148 << cameraPose << endl;
150 o <<
format(
"Focal length: %.03f mm\n",cameraParams.focalLengthMeters*1000);
152 o <<
"Intrinsic parameters matrix for the camera:"<< endl
153 << cameraParams.intrinsicParams.inMatlabFormat() << endl << cameraParams.intrinsicParams << endl;
155 o <<
"Distorsion parameters for the camera: " << cameraParams.getDistortionParamsAsVector() << endl;
157 if (
image.isExternallyStored())
158 o <<
" Image is stored externally in file: " <<
image.getExternalStorageFile() << endl;
160 o <<
format(
" Image size: %ux%u pixels\n", (
unsigned int)
image.getWidth(), (
unsigned int)
image.getHeight() );
162 o <<
" Channels order: " <<
image.getChannelsOrder() << endl;
164 o <<
format(
" Rows are stored in top-bottom order: %s\n",
165 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.
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 writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
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 readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
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 BASE_IMPEXP 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 getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
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...