16 #include <mexplus/mxarray.h>
31 void* iplImageLeft,
void* iplImageRight,
void* iplImageDisparity,
36 hasImageDisparity(iplImageDisparity !=
nullptr),
37 hasImageRight(iplImageRight !=
nullptr)
40 ownMemory ? imageLeft.setFromIplImage(iplImageLeft)
41 : imageLeft.loadFromIplImage(iplImageLeft);
43 ownMemory ? imageRight.setFromIplImage(iplImageRight)
44 : imageRight.loadFromIplImage(iplImageRight);
45 if (iplImageDisparity)
46 ownMemory ? imageDisparity.setFromIplImage(iplImageDisparity)
47 : imageDisparity.loadFromIplImage(iplImageDisparity);
54 : hasImageDisparity(false), hasImageRight(true)
165 if (version >= 3 && version < 5)
172 else if (version < 3)
197 const char* fields[] = {
"class",
"ts",
"sensorLabel",
"imageL",
198 "imageR",
"poseL",
"poseLR",
"poseR",
199 "paramsL",
"paramsR"};
200 mexplus::MxArray obs_struct(
201 mexplus::MxArray::Struct(
sizeof(fields) /
sizeof(fields[0]), fields));
206 obs_struct.set(
"imageL", this->
imageLeft);
213 return obs_struct.release();
271 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot "
282 o <<
"Right camera pose wrt left camera (YPR):" << endl
286 o <<
" Left image is stored externally in file: "
293 o <<
" is stored externally in file: "
299 o <<
" Disparity image";
303 o <<
" is stored externally in file: "
316 " Rows are stored in top-bottom order: %s\n",
struct mxArray_tag mxArray
Forward declaration for mxArray (avoid #including as much as possible to speed up compiling)
#define IMPLEMENTS_MEXPLUS_FROM(complete_type)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
This class is a "CSerializable" wrapper for "CMatrixFloat".
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ,...
Declares a class that represents any robot's observation.
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 sensorLabel
An arbitrary label that can be used to identify the sensor.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
void swap(CObservation &o)
Swap with another observation, ONLY the data defined here in the base class CObservation.
Observation class for either a pair of left+right or left+disparity images from a stereo camera.
mrpt::poses::CPose3DQuat cameraPose
The pose of the LEFT camera, relative to the robot.
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...
virtual const mrpt::utils::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime.
bool hasImageRight
Whether imageRight actually contains data (Default upon construction: true)
mrpt::utils::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
void setStereoCameraParams(const mrpt::utils::TStereoCamera &in_params)
Sets leftCamera, rightCamera and rightCameraPose from a TStereoCamera structure.
bool hasImageDisparity
Whether imageDisparity actually contains data (Default upon construction: false)
mrpt::utils::CImage imageDisparity
Disparity image, only contains a valid image if hasImageDisparity == true.
mrpt::utils::TCamera leftCamera
Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras.
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
CObservationStereoImages()
Default Constructor.
~CObservationStereoImages()
Destructor.
mrpt::utils::TCamera rightCamera
mrpt::utils::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
mrpt::poses::CPose3DQuat rightCameraPose
The pose of the right camera, relative to the left one: Note that using the conventional reference co...
void getStereoCameraParams(mrpt::utils::TStereoCamera &out_params) const
Populates a TStereoCamera structure with the parameters in leftCamera, rightCamera and rightCameraPos...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
void swap(CObservationStereoImages &o)
Do an efficient swap of all data members of this object with "o".
bool areImagesRectified() const
This method only checks whether ALL the distortion parameters in leftCamera are set to zero,...
static constexpr const char * className
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
mrpt::math::CMatrixDouble44 getHomogeneousMatrixVal() const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
bool isOriginTopLeft() const
Returns true if the coordinates origin is top-left, or false if it is bottom-left
size_t getHeight() const override
Returns the height of the image in pixels.
void swap(CImage &o)
Very efficient swap of two images (just swap the internal pointers)
std::string getExternalStorageFile() const noexcept
Only if isExternallyStored() returns true.
bool isExternallyStored() const noexcept
See setExternalStorage().
size_t getWidth() const override
Returns the width of the image in pixels.
const char * getChannelsOrder() const
Returns a string of the form "BGR","RGB" or "GRAY" indicating the channels ordering.
virtual mxArray * writeToMatlab() const
Introduces a pure virtual method responsible for writing to a mxArray Matlab object,...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
double focalLengthMeters
The focal length of the camera, in meters (can be used among 'intrinsicParams' to determine the pixel...
mrpt::math::CArrayDouble< 5 > dist
[k1 k2 t1 t2 k3] -> k_i: parameters of radial distortion, t_i: parameters of tangential distortion (d...
mrpt::math::CMatrixDouble33 intrinsicParams
Matrix of intrinsic parameters (containing the focal length and principal point coordinates)
Structure to hold the parameters of a pinhole stereo camera model.
mrpt::poses::CPose3DQuat rightCameraPose
Pose of the right camera with respect to the coordinate origin of the left camera.
std::string dumpAsText() const
Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.
TCamera leftCamera
Intrinsic and distortion parameters of the left and right cameras.
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This base provides a set of functions for maths stuff.
CMatrixFixedNumeric< double, 3, 3 > CMatrixDouble33
This namespace contains representation of robot actions and observations.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.