11 #ifndef BOOST_ARCHIVER_H 12 #define BOOST_ARCHIVER_H 13 #include <boost/serialization/list.hpp> 14 #include <boost/serialization/vector.hpp> 15 #include <boost/serialization/set.hpp> 17 #include <boost/serialization/map.hpp> 19 #include <boost/archive/binary_oarchive.hpp> 20 #include <boost/archive/binary_iarchive.hpp> 21 #include <boost/serialization/split_free.hpp> 22 #include <boost/serialization/base_object.hpp> 24 #include <opencv2/core/core.hpp> 29 BOOST_SERIALIZATION_SPLIT_FREE(::cv::Mat)
31 namespace serialization {
34 template<
class Archive>
37 ar & boost::serialization::base_object< std::map<DBoW2::WordId, DBoW2::WordValue> >(BowVec);
40 template<
class Archive>
43 ar & boost::serialization::base_object<std::map<DBoW2::NodeId, std::vector<unsigned int> > >(FeatVec);
47 template<
class Archive>
48 void serialize(Archive &ar, ::cv::KeyPoint &kf,
const unsigned int file_version)
59 template<
class Archive>
60 void save(Archive &ar, const ::cv::Mat &m,
const unsigned int file_version)
63 if (!m.isContinuous())
65 size_t elem_size = m_.elemSize();
66 size_t elem_type = m_.type();
72 const size_t data_size = m_.cols * m_.rows * elem_size;
74 ar & boost::serialization::make_array(m_.ptr(), data_size);
76 template<
class Archive>
77 void load(Archive & ar, ::cv::Mat& m,
const unsigned int version)
80 size_t elem_size, elem_type;
87 m.create(rows, cols, elem_type);
88 size_t data_size = m.cols * m.rows * elem_size;
90 ar & boost::serialization::make_array(m.ptr(), data_size);
95 #endif // BOOST_ARCHIVER_H
void load(Archive &ar,::cv::Mat &m, const unsigned int version)
void serialize(Archive &ar,::cv::KeyPoint &kf, const unsigned int file_version)
Vector of words to represent images.
Vector of nodes with indexes of local features.
void save(Archive &ar, const ::cv::Mat &m, const unsigned int file_version)