-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoint3D.h
79 lines (63 loc) · 1.98 KB
/
Point3D.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef POINT3D_H
#define POINT3D_H
#include <stdio.h>
#include <eigen3/Eigen/Dense>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/serialization/vector.hpp>
using Eigen::MatrixXi;
using Eigen::VectorXi;
// forward declaration of class boost::serialization::access
namespace boost { namespace serialization { class access; } }
class Point3D
{
private:
// allow serialization to access non-public data members
friend class boost::serialization::access;
template<typename Archive>
void serialize(Archive& ar, const unsigned version)
{
ar & POINT3D_ID;
ar & x & y & z;
ar & num_tracks;
ar & num_descriptors;
ar & point_descriptor;
//ar & mean_descriptor;
ar & IMAGE_ID;
ar & POINT2D_IDX;
}
public:
unsigned POINT3D_ID;
double x, y, z;
unsigned num_tracks;
unsigned num_descriptors; // should be same as num_tracks...
//MatrixXi point_descriptors; // all descriptors for this point
VectorXi point_descriptor; // point descriptor
// vectors of TRACK elements
std::vector<unsigned> IMAGE_ID;
std::vector<unsigned> POINT2D_IDX;
Point3D();
Point3D( unsigned id_arg,
double x_arg, double y_arg, double z_arg,
unsigned num_tracks_arg );
};
namespace boost
{
template<class Archive, typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
inline void serialize
(
Archive & ar,
Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> & t,
const unsigned int file_version
)
{
size_t rows = t.rows(), cols = t.cols();
ar & rows;
ar & cols;
if( rows * cols != t.size() )
t.resize( rows, cols );
for(size_t i=0; i<t.size(); i++)
ar & t.data()[i];
}
}
#endif