33 rightCameraPose = rCPose;
34 cameraPoseOnRobot = cPORobot;
38 const std::string& filename)
40 std::ofstream file(filename);
43 vector<TStereoImageFeatures>::iterator it;
44 for (it = theFeatures.begin(); it != theFeatures.end(); ++it)
46 "%u %.2f %.2f %.2f %.2f\n", it->ID, it->pixels.first.x,
47 it->pixels.first.y, it->pixels.second.x, it->pixels.second.y);
60 out << rightCameraPose << cameraPoseOnRobot;
61 out << (uint32_t)theFeatures.size();
63 for (
const auto& theFeature : theFeatures)
65 out << theFeature.pixels.first.x << theFeature.pixels.first.y;
66 out << theFeature.pixels.second.x << theFeature.pixels.second.y;
67 out << (uint32_t)theFeature.ID;
69 out << sensorLabel << timestamp;
82 in >> rightCameraPose >> cameraPoseOnRobot;
84 theFeatures.resize(nL);
85 for (
auto& theFeature : theFeatures)
87 in >> theFeature.pixels.first.x >> theFeature.pixels.first.y;
88 in >> theFeature.pixels.second.x >> theFeature.pixels.second.y;
90 theFeature.ID = (
unsigned int)nR;
92 in >> sensorLabel >> timestamp;
101 std::ostream& o)
const 105 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot " 108 << cameraPoseOnRobot << endl;
110 o <<
"Homogeneous matrix for the RIGHT camera's 3D pose, relative to LEFT " 111 "camera reference system:\n";
113 << rightCameraPose << endl;
115 o <<
"Intrinsic parameters matrix for the LEFT camera:" << endl;
119 o <<
"Distortion parameters vector for the LEFT camera:" << endl <<
"[ ";
120 for (
unsigned int i = 0; i < 5; ++i) o << cameraLeft.dist[i] <<
" ";
123 o <<
"Intrinsic parameters matrix for the RIGHT camera:" << endl;
124 aux = cameraRight.intrinsicParams;
127 o <<
"Distortion parameters vector for the RIGHT camera:" << endl <<
"[ ";
128 for (
unsigned int i = 0; i < 5; ++i) o << cameraRight.dist[i] <<
" ";
133 " Image size: %ux%u pixels\n", (
unsigned int)cameraLeft.ncols,
134 (
unsigned int)cameraLeft.nrows);
137 " Number of features in images: %u\n",
138 (
unsigned int)theFeatures.size());
void saveFeaturesToTextFile(const std::string &filename)
A method for storing the set of observed features in a text file in the format: ID ul vl ur vr be...
CObservationStereoImagesFeatures()=default
A compile-time fixed-size numeric matrix container.
Declares a class derived from "CObservation" that encapsules a pair of cameras and a set of matched i...
std::string std::string format(std::string_view fmt, ARGS &&... args)
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
IMPLEMENTS_SERIALIZABLE(CObservationStereoImagesFeatures, CObservation, mrpt::obs) CObservationStereoImagesFeatures
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define ASSERT_(f)
Defines an assertion mechanism.
This base provides a set of functions for maths stuff.
This namespace contains representation of robot actions and observations.
Parameters for the Brown-Conrady camera lens distortion model.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::vision::TStereoCalibResults out
Declares a class that represents any robot's observation.
std::string inMatlabFormat(const std::size_t decimal_digits=6) const
Exports the matrix as a string compatible with Matlab/Octave.
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...