56 explicit SfmTrack2d(
const std::vector<SfmMeasurement>& measurements)
57 : measurements(measurements) {}
65 measurements.emplace_back(idx, m);
73 return measurements[idx];
77 const SiftIndex&
siftIndex(
size_t idx)
const {
return siftIndices[idx]; }
84 std::vector<int> track_cam_indices;
89 std::adjacent_find(track_cam_indices.begin(), track_cam_indices.end());
90 bool all_cameras_unique = (
i == track_cam_indices.end());
91 return all_cameras_unique;
100 Eigen::MatrixX2d
m(numberMeasurements(), 2);
101 for (
size_t i = 0;
i < numberMeasurements();
i++) {
109 Eigen::VectorXi
v(numberMeasurements());
110 for (
size_t i = 0;
i < numberMeasurements();
i++) {
132 explicit SfmTrack(
float r = 0,
float g = 0,
float b = 0)
133 : p(0, 0, 0), r(r), g(g), b(b) {}
137 : p(pt), r(r), g(g), b(b) {}
154 void print(
const std::string&
s =
"")
const;
163 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 165 friend class boost::serialization::access;
166 template <
class ARCHIVE>
167 void serialize(ARCHIVE& ar,
const unsigned int ) {
168 ar& BOOST_SERIALIZATION_NVP(p);
169 ar& BOOST_SERIALIZATION_NVP(r);
170 ar& BOOST_SERIALIZATION_NVP(g);
171 ar& BOOST_SERIALIZATION_NVP(b);
172 ar& BOOST_SERIALIZATION_NVP(measurements);
173 ar& BOOST_SERIALIZATION_NVP(siftIndices);
179 template <
typename T>
void print(const Matrix &A, const string &s, ostream &stream)
Point3 rgb() const
Get RGB values describing 3d point.
std::string serialize(const T &input)
serializes to a string
std::vector< SiftIndex > siftIndices
The feature descriptors (optional)
bool hasUniqueCameras() const
Check that no two measurements are from the same camera.
static const Point3 pt(1.0, 2.0, 3.0)
const Point3 & point3() const
Get 3D point.
void g(const string &key, int i)
const SiftIndex & siftIndex(size_t idx) const
Get the SIFT feature index corresponding to the measurement at idx
static Point2 measurement(323.0, 240.0)
std::pair< size_t, Point2 > SfmMeasurement
A measurement with its camera index.
size_t numberMeasurements() const
Total number of measurements in this track.
void addMeasurement(size_t idx, const gtsam::Point2 &m)
Add measurement (camera_idx, Point2) to track.
const SfmMeasurement & measurement(size_t idx) const
Get the measurement (camera index, Point2) at pose index idx
std::pair< size_t, size_t > SiftIndex
Sift index for SfmTrack.
Track containing 2D measurements associated with a single 3D point. Note: Equivalent to gtsam...
Array< int, Dynamic, 1 > v
Eigen::MatrixX2d measurementMatrix() const
Return the measurements as a 2D matrix.
std::vector< SfmMeasurement > measurements
The 2D image projections (id,(u,v))
Array< double, 1, 3 > e(1./3., 0.5, 2.)
SfmTrack2d(const std::vector< SfmMeasurement > &measurements)
std::vector< SfmTrack2d > SfmTrack2dVector
Point3 p
3D position of the point
SfmTrack(float r=0, float g=0, float b=0)
Eigen::VectorXi indexVector() const
Return the camera indices of the measurements.
SfmTrack(const gtsam::Point3 &pt, float r=0, float g=0, float b=0)