Using Python 3 and OpenCV 3.
I have written some DLL's in C++ that export a few C-type functions and a uchar3 c-type struct. I have been using these with OpenCV in a C++ project, but I would like to be able to access them from Python as well. I am pretty new to Python, but I see that ctypes provides a fairly straightforward way to use DLL's.
What I can't sort out is how to get a pointer to the OpenCV Mat from within Python. Using C++, I do the following:
myMatDataPointer = myMat.ptr<uchar>(0)
Ideally, I would like to find an easy way to use the uchar3 struct, but I see that a char* is supported out-of-the-box by ctypes, so I can make do with that if I can figure out how to get one pointing to the Mat's data.
thisinstance for a Python proxy class. The proxy calls C wrappers for the C++ methods, manually supplying thethisreference as the first argument.