Thanks for the reply, I tried adding import_array(); to my BOOST_PYTHON_MODULE block but I still got an error when importing my library into python, the same same error I mentioned above.
On Wed, Sep 21, 2011 at 9:43 AM, Jim Bosch <[email protected]> wrote: > On 09/21/2011 09:31 AM, Kevin Hughes wrote: > >> I am trying to create a python library from a class which uses opencv >> 2.3. I want to be able to pass numpy array's into the class where they >> will be converted into cv::Mat's processed then converted back to numpy >> array's and returned. >> >> Here is a simple test class I am working on to get this working before >> wrapping my own class. Currently I am just trying to receive a numpy >> array concert to a cv::Mat, process it and then write it to file. After >> this is working I will work on returning the processed array to python. >> >> > Without digging too deeply or getting into possibly better solutions, try > adding: > > import_array(); > > inside your BOOST_PYTHON_MODULE block. Or maybe there's some opencv > initialization function you need to call that will do that for you. The > NumPy C-API (which I assume the numpy_to_mat function uses internally) needs > to be initialized when your module is imported, or you'll get segfaults. > The above call to import_array() is how you'd do it if you were using the > NumPy C-API headers directly. In any case, you need to make sure it gets > called somehow. > > HTH > > Jim Bosch > ______________________________**_________________ > Cplusplus-sig mailing list > [email protected] > http://mail.python.org/**mailman/listinfo/cplusplus-sig<http://mail.python.org/mailman/listinfo/cplusplus-sig> >
_______________________________________________ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
