MCPcopy Create free account
hub / github.com/UZ-SLAMLab/ORB_SLAM3 / serializeMatrix

Function serializeMatrix

include/SerializationUtils.h:77–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76template<class Archive>
77void serializeMatrix(Archive& ar, cv::Mat& mat, const unsigned int version)
78{
79 int cols, rows, type;
80 bool continuous;
81
82 if (Archive::is_saving::value) {
83 cols = mat.cols; rows = mat.rows; type = mat.type();
84 continuous = mat.isContinuous();
85 }
86
87 ar & cols & rows & type & continuous;
88
89 if (Archive::is_loading::value)
90 mat.create(rows, cols, type);
91
92 if (continuous) {
93 const unsigned int data_size = rows * cols * mat.elemSize();
94 ar & boost::serialization::make_array(mat.ptr(), data_size);
95 } else {
96 const unsigned int row_size = cols*mat.elemSize();
97 for (int i = 0; i < rows; i++) {
98 ar & boost::serialization::make_array(mat.ptr(i), row_size);
99 }
100 }
101}
102
103template<class Archive>
104void serializeMatrix(Archive& ar, const cv::Mat& mat, const unsigned int version)

Callers 2

serializeMethod · 0.85
serializeMethod · 0.85

Calls 1

createMethod · 0.80

Tested by

no test coverage detected