I have a numpy ndarray
holding numpy.float64
data stored to a file in binary format using cPickle's dump()
method.
from cPickle import dump, HIGHEST_PROTOCOL
with open(filePath, 'wb') as f:
dump(numpyArray, f, protocol=HIGHEST_PROTOCOL)
At the time of this writing, HIGHEST_PROTOCOL
uses cPickle's protocol version 2 but there doesn't seem to be much documentation on how exactly this protocol works.
What I'm trying to do is read this file and create a cv::Mat
object (see here) with the data, which is proving quite difficult to do.
At this point, I'm looking to get things working as quickly as possible and I am not too worried about performance, storage space and efficiency. However, these factors might become important later.
Thus, my question would be, what is the easiest way I can go about converting the data in this file into a cv::Mat
object? If you think that the easiest way isn't necessarily the most efficient way then I would love to hear your thoughts on that as well. Note that I'm open to using a different storage format, possibly just a text file, if it will make interoperability between Python and C++ easier.
I have to store the numpy
array to disk because I need to be able to open and read this file on a mobile device (iOS and Android) and using a network call to get the data is not really on the table at the moment.