Go to the documentation of this file.
17 #include <mexplus/mxarray.h>
31 : cameraPose(),
image(iplImage)
38 out << cameraPose << cameraParams <<
image << timestamp << sensorLabel;
60 CMatrix intrinsicParams, distortionParams;
61 in >> distortionParams >> intrinsicParams;
63 if (distortionParams.rows() == 1 &&
64 distortionParams.cols() == 5)
67 cameraParams.setDistortionParamsVector(
p);
70 cameraParams.dist.fill(0);
72 cameraParams.intrinsicParams =
73 intrinsicParams.block(0, 0, 3, 3).cast<
double>();
78 if (version >= 1)
in >> timestamp;
82 if (version < 4)
in >> cameraParams.focalLengthMeters;
85 cameraParams.focalLengthMeters = 0.002;
109 const char* fields[] = {
"class",
"ts",
"sensorLabel",
110 "image",
"pose",
"params"};
111 mexplus::MxArray obs_struct(
112 mexplus::MxArray::Struct(
sizeof(fields) /
sizeof(fields[0]), fields));
114 obs_struct.set(
"class", this->GetRuntimeClass()->className);
115 obs_struct.set(
"ts", this->timestamp);
116 obs_struct.set(
"sensorLabel", this->sensorLabel);
117 obs_struct.set(
"image", this->
image);
118 obs_struct.set(
"pose", this->cameraPose);
119 obs_struct.set(
"params", this->cameraParams);
120 return obs_struct.release();
128 image.rectifyImage(out_img, cameraParams);
136 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot "
138 o << cameraPose.getHomogeneousMatrixVal<
CMatrixDouble44>() << cameraPose
142 "Focal length: %.03f mm\n", cameraParams.focalLengthMeters * 1000);
144 o <<
"Intrinsic parameters matrix for the camera:" << endl
145 << cameraParams.intrinsicParams.inMatlabFormat() << endl
146 << cameraParams.intrinsicParams << endl;
148 o <<
"Distorsion parameters for the camera: "
149 << cameraParams.getDistortionParamsAsVector() << endl;
151 if (
image.isExternallyStored())
152 o <<
" Image is stored externally in file: "
153 <<
image.getExternalStorageFile() << endl;
156 " Image size: %ux%u pixels\n", (
unsigned int)
image.getWidth(),
157 (
unsigned int)
image.getHeight());
159 o <<
" Channels order: " <<
image.getChannelsOrder() << endl;
162 " Rows are stored in top-bottom order: %s\n",
163 image.isOriginTopLeft() ?
"YES" :
"NO");
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
#define THROW_EXCEPTION(msg)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
This namespace contains representation of robot actions and observations.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Virtual base class for "archives": classes abstracting I/O streams.
This class is a "CSerializable" wrapper for "CMatrixFloat".
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
A numeric matrix of compile-time fixed size.
A class for storing images as grayscale or RGB bitmaps.
GLenum GLsizei GLenum GLenum const GLvoid * image
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
void getRectifiedImage(mrpt::img::CImage &out_img) const
Computes the rectified (un-distorted) image, using the embeded distortion parameters.
Declares a class that represents any robot's observation.
This base provides a set of functions for maths stuff.
#define IMPLEMENTS_MEXPLUS_FROM(complete_type)
virtual mxArray * writeToMatlab() const
Introduces a pure virtual method responsible for writing to a mxArray Matlab object,...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
struct mxArray_tag mxArray
Forward declaration for mxArray (avoid #including as much as possible to speed up compiling)
Declares a class derived from "CObservation" that encapsules an image from a camera,...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |