32 rightCameraPose = rCPose;
33 cameraPoseOnRobot = cPORobot;
39 std::ofstream file(filename);
43 for (it = theFeatures.begin(); it != theFeatures.end(); ++it)
45 "%u %.2f %.2f %.2f %.2f\n", it->ID, it->pixels.first.x,
46 it->pixels.first.y, it->pixels.second.x, it->pixels.second.y);
59 out << rightCameraPose << cameraPoseOnRobot;
62 for (
unsigned int i = 0; i < theFeatures.size(); ++i)
64 out << theFeatures[i].pixels.first.x << theFeatures[i].pixels.first.y;
65 out << theFeatures[i].pixels.second.x << theFeatures[i].pixels.second.y;
68 out << sensorLabel << timestamp;
81 in >> rightCameraPose >> cameraPoseOnRobot;
83 theFeatures.resize(nL);
84 for (
unsigned int i = 0; i < theFeatures.size(); ++i)
86 in >> theFeatures[i].pixels.first.x >>
87 theFeatures[i].pixels.first.y;
88 in >> theFeatures[i].pixels.second.x >>
89 theFeatures[i].pixels.second.y;
91 theFeatures[i].ID = (
unsigned int)nR;
93 in >> sensorLabel >> timestamp;
102 std::ostream& o)
const 106 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot " 109 << cameraPoseOnRobot << endl;
111 o <<
"Homogeneous matrix for the RIGHT camera's 3D pose, relative to LEFT " 112 "camera reference system:\n";
114 << rightCameraPose << endl;
116 o <<
"Intrinsic parameters matrix for the LEFT camera:" << endl;
118 o << aux.inMatlabFormat() << endl << aux << endl;
120 o <<
"Distortion parameters vector for the LEFT camera:" << endl <<
"[ ";
121 for (
unsigned int i = 0; i < 5; ++i) o << cameraLeft.dist[i] <<
" ";
124 o <<
"Intrinsic parameters matrix for the RIGHT camera:" << endl;
125 aux = cameraRight.intrinsicParams;
126 o << aux.inMatlabFormat() << endl << aux << endl;
128 o <<
"Distortion parameters vector for the RIGHT camera:" << endl <<
"[ ";
129 for (
unsigned int i = 0; i < 5; ++i) o << cameraRight.dist[i] <<
" ";
134 " Image size: %ux%u pixels\n", (
unsigned int)cameraLeft.ncols,
135 (
unsigned int)cameraLeft.nrows);
138 " Number of features in images: %u\n",
139 (
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
Declares a class derived from "CObservation" that encapsules a pair of cameras and a set of matched i...
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.
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
This namespace contains representation of robot actions and observations.
Structure to hold the parameters of a pinhole camera model.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
GLsizei const GLchar ** string
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.
Declares a class that represents any robot's observation.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
GLenum GLsizei GLenum format
unsigned __int32 uint32_t
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...