I’m using OpenCV within a DLL that provides plain C interfaces, no C++objects are allowed to be handed over to the calling application.
One part of this DLL performs fiducial learning for later pattern recognition which results in a list of keypoints and a Mat object. These data have to be stored by the calling application.
Handing over the keypoints via DLL interface is no problem by using a plain C struct, the members of such a keypoint can be converted easily. But I don’t see which parts of cv::Mat are really needed. Or to be more exact: my Mat-object makes use of the member “data” which points to a memory area but I have no idea how much data are contained.
So my question: how can I convert a cv::Mat object into a plain C-style structure, how can I estimate the exact length of the data field?
Thanks!
The easy way is to convert cv::Mat to the classical OpenCV C structure: IplImage.
A more detailed explanation of the Mat parameters:
And here’s how you calculate data field length: