37 cameraLeft.intrinsicParams = iPLeft;
38 cameraLeft.dist = dPLeft;
40 cameraRight.intrinsicParams = iPRight;
41 cameraRight.dist = dPRight;
43 rightCameraPose = rCPose;
44 cameraPoseOnRobot = cPORobot;
54 rightCameraPose = rCPose;
55 cameraPoseOnRobot = cPORobot;
67 for( it = theFeatures.begin(); it != theFeatures.end(); ++it )
68 file <<
format(
"%u %.2f %.2f %.2f %.2f\n", it->ID, it->pixels.first.x, it->pixels.first.y, it->pixels.second.x, it->pixels.second.y );
85 out << rightCameraPose << cameraPoseOnRobot;
87 for(
unsigned int i = 0; i < theFeatures.size(); ++i )
89 out << theFeatures[i].pixels.first.x << theFeatures[i].pixels.first.y;
90 out << theFeatures[i].pixels.second.x << theFeatures[i].pixels.second.y;
93 out << sensorLabel << timestamp;
109 in >> rightCameraPose >> cameraPoseOnRobot;
111 theFeatures.resize( nL );
112 for(
unsigned int i = 0; i < theFeatures.size(); ++i )
114 in >> theFeatures[i].pixels.first.x >> theFeatures[i].pixels.first.y;
115 in >> theFeatures[i].pixels.second.x >> theFeatures[i].pixels.second.y;
117 theFeatures[i].ID = (
unsigned int)nR;
119 in >> sensorLabel >> timestamp;
130 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot base:\n";
131 o << cameraPoseOnRobot.getHomogeneousMatrixVal()
132 << cameraPoseOnRobot << endl;
134 o <<
"Homogeneous matrix for the RIGHT camera's 3D pose, relative to LEFT camera reference system:\n";
135 o << rightCameraPose.getHomogeneousMatrixVal()
136 << rightCameraPose << endl;
138 o <<
"Intrinsic parameters matrix for the LEFT camera:"<< endl;
140 o << aux.inMatlabFormat() << endl << aux << endl;
142 o <<
"Distortion parameters vector for the LEFT camera:"<< endl <<
"[ ";
143 for(
unsigned int i = 0; i < 5; ++i )
144 o << cameraLeft.dist[i] <<
" ";
147 o <<
"Intrinsic parameters matrix for the RIGHT camera:"<< endl;
148 aux = cameraRight.intrinsicParams;
149 o << aux.inMatlabFormat() << endl << aux << endl;
151 o <<
"Distortion parameters vector for the RIGHT camera:"<< endl <<
"[ ";
152 for(
unsigned int i = 0; i < 5; ++i )
153 o << cameraRight.dist[i] <<
" ";
156 o << endl <<
format(
" Image size: %ux%u pixels\n", (
unsigned int)cameraLeft.ncols, (
unsigned int)cameraLeft.nrows );
157 o << endl <<
format(
" Number of features in images: %u\n", (
unsigned int)theFeatures.size() );
void close()
Close the stream.
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...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Declares a class derived from "CObservation" that encapsules a pair of cameras and a set of matched i...
~CObservationStereoImagesFeatures()
Destructor.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
void getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
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.
This CStream derived class allow using a file as a write-only, binary stream.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This namespace contains representation of robot actions and observations.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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...
Declares a class that represents any robot's observation.
GLenum GLsizei GLenum format
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
unsigned __int32 uint32_t
CObservationStereoImagesFeatures()
Default Constructor.
Structure to hold the parameters of a pinhole 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...