title: Converting PyObject* to C++ Object
body: <p>I have a shared library (util.so) that returns the following to python:</p>
  
  <pre><code>cv::Mat toCvMat(PyObject *ndArrayObj) {
      // return cv::Mat
  }
  </code></pre>
  
  <p>I invoke the method from my python script using:</p>
  
  <p><strong>Python:</strong></p>
  
  <pre><code>testMat = util.toCvMat(orig_frame_gray_img)
  </code></pre>
  
  <p>When I pass this to my other test library (test_library.so), it is passed as PyObject*, how do I access cv::Mat in my test_library.so?:</p>
  
  <p><strong>Python:</strong></p>
  
  <pre><code>test_library.process(testMat)
  </code></pre>
  
  <p><strong>C++</strong></p>
  
  <pre><code>bool TestLibrary::Process( PyObject* pTestImg)
  {
  // How to get cv::Mat from pTestImg?
  }
  </code></pre>
  
  <p>At present, my test_library doesn't link with util and they are separate .so files.</p>