How to dump a cv2 object (more preciely a list or a np.array containing these objects), for example keypoints (type: cv2.KeyPoint
) or matches (type: cv2.DMatch
), to a file on disk in order to import them later rather than re-runing a time consumming (several hours up to days on a low end computer) algorithm on a lot of images (> 50'000)?
It doesn't work with (c)Pickle. Typical errors are:
PicklingError: Can't pickle <type 'cv2.KeyPoint'>: it's not the same object as cv2.KeyPoint
or
PicklingError: Can't pickle <type 'cv2.DMatch'>: it's not the same object as cv2.DMatch
And I can not find any dump
or saving/export method on cv2.
The script runs using Python 2.7 on both Ubuntu 16.04 and Windows 7.