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",
bool hasImageRight
Whether imageRight actually contains data (Default upon construction: true)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
mrpt::utils::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
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...
double focalLengthMeters
The focal length of the camera, in meters (can be used among 'intrinsicParams' to determine the pixel...
bool areImagesRectified() const
This method only checks whether ALL the distortion parameters in leftCamera are set to zero...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
virtual const mrpt::utils::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime.
const char * getChannelsOrder() const
Returns a string of the form "BGR","RGB" or "GRAY" indicating the channels ordering.
bool hasImageDisparity
Whether imageDisparity actually contains data (Default upon construction: false)
CMatrixFixedNumeric< double, 3, 3 > CMatrixDouble33
void swap(CObservation &o)
Swap with another observation, ONLY the data defined here in the base class CObservation.
mrpt::math::CMatrixDouble44 getHomogeneousMatrixVal() const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
Structure to hold the parameters of a pinhole stereo camera model.
mrpt::poses::CPose3DQuat cameraPose
The pose of the LEFT camera, relative to the robot.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
This base provides a set of functions for maths stuff.
size_t getWidth() const override
Returns the width of the image in pixels.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
CObservationStereoImages()
Default Constructor.
size_t getHeight() const override
Returns the height of the image in pixels.
Observation class for either a pair of left+right or left+disparity images from a stereo camera...
std::string dumpAsText() const
Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.
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)
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
void getStereoCameraParams(mrpt::utils::TStereoCamera &out_params) const
Populates a TStereoCamera structure with the parameters in leftCamera, rightCamera and rightCameraPos...
void swap(CImage &o)
Very efficient swap of two images (just swap the internal pointers)
mrpt::utils::TCamera leftCamera
Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
mrpt::utils::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
mrpt::math::CMatrixDouble33 intrinsicParams
Matrix of intrinsic parameters (containing the focal length and principal point coordinates) ...
void setStereoCameraParams(const mrpt::utils::TStereoCamera &in_params)
Sets leftCamera, rightCamera and rightCameraPose from a TStereoCamera structure.
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
mrpt::math::CArrayDouble< 5 > dist
[k1 k2 t1 t2 k3] -> k_i: parameters of radial distortion, t_i: parameters of tangential distortion (d...
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.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
~CObservationStereoImages()
Destructor.
Declares a class that represents any robot's observation.
TCamera leftCamera
Intrinsic and distortion parameters of the left and right cameras.
void swap(CObservationStereoImages &o)
Do an efficient swap of all data members of this object with "o".
mrpt::poses::CPose3DQuat rightCameraPose
The pose of the right camera, relative to the left one: Note that using the conventional reference co...
bool isOriginTopLeft() const
Returns true if the coordinates origin is top-left, or false if it is bottom-left.
static constexpr const char * className
mrpt::utils::CImage imageDisparity
Disparity image, only contains a valid image if hasImageDisparity == true.
std::string getExternalStorageFile() const noexcept
Only if isExternallyStored() returns true.
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ...
bool isExternallyStored() const noexcept
See setExternalStorage().
mrpt::utils::TCamera rightCamera
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) ...
mrpt::poses::CPose3DQuat rightCameraPose
Pose of the right camera with respect to the coordinate origin of the left camera.
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...