Go to the documentation of this file.
17 #include <mexplus/mxarray.h>
34 out << cameraPose << leftCamera << rightCamera << imageLeft;
35 out << hasImageDisparity << hasImageRight;
36 if (hasImageRight)
out << imageRight;
37 if (hasImageDisparity)
out << imageDisparity;
39 out << rightCameraPose;
50 in >> cameraPose >> leftCamera >> rightCamera >> imageLeft;
51 in >> hasImageDisparity >> hasImageRight;
52 if (hasImageRight) in >> imageRight;
53 if (hasImageDisparity) in >> imageDisparity;
55 in >> rightCameraPose;
69 hasImageDisparity =
false;
80 in >> cameraPose >> leftCamera >> rightCamera;
88 leftCamera.intrinsicParams = intParams;
90 rightCamera.intrinsicParams = intParams;
93 in >> imageLeft >> imageRight;
108 in >> rightCameraPose;
116 if (version >= 3 && version < 5)
120 leftCamera.focalLengthMeters = rightCamera.focalLengthMeters =
123 else if (version < 3)
124 leftCamera.focalLengthMeters = rightCamera.focalLengthMeters =
150 const char* fields[] = {
"class",
"ts",
"sensorLabel",
"imageL",
151 "imageR",
"poseL",
"poseLR",
"poseR",
152 "paramsL",
"paramsR"};
153 mexplus::MxArray obs_struct(
154 mexplus::MxArray::Struct(
sizeof(fields) /
sizeof(fields[0]), fields));
156 obs_struct.set(
"class", this->GetRuntimeClass()->className);
158 obs_struct.set(
"sensorLabel", this->sensorLabel);
159 obs_struct.set(
"imageL", this->imageLeft);
160 obs_struct.set(
"imageR", this->imageRight);
161 obs_struct.set(
"poseL", this->cameraPose);
162 obs_struct.set(
"poseR", this->cameraPose + this->rightCameraPose);
163 obs_struct.set(
"poseLR", this->rightCameraPose);
164 obs_struct.set(
"paramsL", this->leftCamera);
165 obs_struct.set(
"paramsR", this->rightCamera);
166 return obs_struct.release();
200 leftCamera.dist.begin(), leftCamera.dist.end(),
201 [](
auto v) { return v == 0; });
228 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot "
231 <<
"Camera pose: " << cameraPose <<
"\n"
232 <<
"Camera pose (YPR): " <<
CPose3D(cameraPose) <<
"\n"
236 getStereoCameraParams(stParams);
239 o <<
"Right camera pose wrt left camera (YPR):"
243 if (imageLeft.isExternallyStored())
244 o <<
" Left image is stored externally in file: "
245 << imageLeft.getExternalStorageFile() <<
"\n";
250 if (imageRight.isExternallyStored())
251 o <<
" is stored externally in file: "
252 << imageRight.getExternalStorageFile() <<
"\n";
257 o <<
" Disparity image";
258 if (hasImageDisparity)
260 if (imageDisparity.isExternallyStored())
261 o <<
" is stored externally in file: "
262 << imageDisparity.getExternalStorageFile() <<
"\n";
267 if (!imageLeft.isEmpty())
270 " Image size: %ux%u pixels\n", (
unsigned int)imageLeft.getWidth(),
271 (
unsigned int)imageLeft.getHeight());
273 o <<
" Channels order: " << imageLeft.getChannelsOrder() <<
"\n";
276 " Rows are stored in top-bottom order: %s\n",
277 imageLeft.isOriginTopLeft() ?
"YES" :
"NO");
283 imageLeft.forceLoad();
284 imageRight.forceLoad();
285 imageDisparity.forceLoad();
void setStereoCameraParams(const mrpt::img::TStereoCamera &in_params)
Sets leftCamera, rightCamera and rightCameraPose from a TStereoCamera structure.
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
mrpt::img::TCamera rightCamera
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void load() const override
Makes sure all images and other fields which may be externally stored are loaded in memory.
bool areImagesRectified() const
This method only checks whether ALL the distortion parameters in leftCamera are set to zero,...
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
mrpt::vision::TStereoCalibResults out
#define THROW_EXCEPTION(msg)
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
mrpt::img::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
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".
static double toDouble(const time_point t) noexcept
Converts a timestamp to a UNIX time_t-like number, with fractional part.
A compile-time fixed-size numeric matrix container.
mrpt::img::TCamera leftCamera
Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras.
mrpt::img::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
Structure to hold the parameters of a pinhole stereo camera model.
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::math::TPose3DQuat rightCameraPose
Pose of the right camera with respect to the coordinate origin of the left camera.
void swap(CObservationStereoImages &o)
Do an efficient swap of all data members of this object with "o".
void getStereoCameraParams(mrpt::img::TStereoCamera &out_params) const
Populates a TStereoCamera structure with the parameters in leftCamera, rightCamera and rightCameraPos...
mrpt::img::CImage imageDisparity
Disparity image, only contains a valid image if hasImageDisparity == true.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ,...
mrpt::poses::CPose3DQuat cameraPose
The pose of the LEFT camera, relative to the robot.
Declares a class that represents any robot's observation.
void swap(CObservation &o)
Swap with another observation, ONLY the data defined here in the base class CObservation.
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,...
TCamera leftCamera
Intrinsic and distortion parameters of the left and right cameras.
bool hasImageRight
Whether imageRight actually contains data (Default upon construction: true)
std::string dumpAsText() const
Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.
#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)
bool hasImageDisparity
Whether imageDisparity actually contains data (Default upon construction: false)
mrpt::poses::CPose3DQuat rightCameraPose
The pose of the right camera, relative to the left one: Note that using the conventional reference co...
Observation class for either a pair of left+right or left+disparity images from a stereo camera.
std::string std::string format(std::string_view fmt, ARGS &&... args)
Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Fri Jul 17 08:43:33 UTC 2020 | |