Serializing OpenCV Mat_

前端 未结 7 1174
刺人心
刺人心 2020-11-30 05:29

I\'m working on a robotics research project where I need to serialize 2D matrices of 3D points: basically each pixel is a 3-vector of floats. These pixels are saved in an Op

7条回答
  •  醉梦人生
    2020-11-30 05:47

    I was recently asking myself a similar question, though specifically I was trying to serialize opencv's Mat and MatND objects. Using boost::serialize is nice, but requires a couple tricks. As you don't want to go about modifying the internals of OpenCV itself to serialize these objects, you are forced to use what's called a "free" function. Since it is complicated to serialize the OpenCV objects, I found I was forced to split the serialize operation into save and load, each with a slightly different implementation. You need to use boost/serialization/split_free.hpp for this task. Boost provides good documentation for this here: http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html.

    Good luck!

提交回复
热议问题