title: Python OpenCV pass mat ptr to c++ code
body: <p>Using Python 3 and OpenCV 3.</p>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>    myMatDataPointer = myMat.ptr&lt;uchar&gt;(0)
  </code></pre>
  
  <p>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.</p>