python - Converting numpy.ndarray into opencv cv::Mat -


i have boost-python interface c++ opencv. getting error when invoke c++ method python:

boost.python.argumenterror: python argument types in     vision.process(vision, numpy.ndarray, numpy.ndarray) did not match c++ signature:     process(python::vision::pythonvision {lvalue}, cv::mat {lvalue}, cv::mat {lvalue}) 

i using python cv2.so module. how convert numpy.ndarray cv::mat?

i used following project:https://github.com/algomorph/pyboostcvconverter , statically linked it.

note (to avoid segmentation fault):

1) py_array_unique_symbol should defined import_array invoked in other places included, use no_import_array

#define py_array_unique_symbol pyvision_array_api #include <pyboostcvconverter/pyboostcvconverter.hpp> 

2) invoke init_ar boost_python_module

/**  * @brief initialize numpy array  */ static void init_ar( ) {     // initialize     py_initialize();      // defined in numpy     import_array(); } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -