serialization.h
Go to the documentation of this file.
1 #ifndef SERIALIZATION_LIBRARY
2 #define SERIALIZATION_LIBRARY
3 
4 #include "std_include.h"
5 
6 #include <boost/serialization/split_free.hpp>
7 #include <boost/serialization/vector.hpp>
8 
9 using namespace std;
10 using namespace cv;
11 
12 BOOST_SERIALIZATION_SPLIT_FREE(Mat)
13 namespace boost {
14  namespace serialization {
15 
17  template<class Archive>
18  void save(Archive & ar, const Mat& m, const unsigned int version) {
19  size_t elem_size = m.elemSize();
20  size_t elem_type = m.type();
21 
22  ar & m.cols;
23  ar & m.rows;
24  ar & elem_size;
25  ar & elem_type;
26 
27  const size_t data_size = m.cols * m.rows * elem_size;
28  ar & boost::serialization::make_array(m.ptr(), data_size);
29  }
30 
32  template<class Archive>
33  void load(Archive & ar, Mat& m, const unsigned int version) {
34  int cols, rows;
35  size_t elem_size, elem_type;
36 
37  ar & cols;
38  ar & rows;
39  ar & elem_size;
40  ar & elem_type;
41 
42  m.create(rows, cols, elem_type);
43 
44  size_t data_size = m.cols * m.rows * elem_size;
45  ar & boost::serialization::make_array(m.ptr(), data_size);
46  }
47 
48  }
49 }
50 
51 #endif
void load(Archive &ar, Mat &m, const unsigned int version)
Definition: serialization.h:33
void save(Archive &ar, const Mat &m, const unsigned int version)
Definition: serialization.h:18


spinnaker_sdk_camera_driver
Author(s): Abhishek Bajpayee, Pushyami Kaveti, Vikrant Shah
autogenerated on Sun Feb 14 2021 03:34:42