尽量不要这么写,这样很可能需要依赖Python版本。一定要用的话,可参考下面的写法。
Py_Initialize();
np::initialize();
int rows = 480;
int cols = 640;
int channels = 3;
//py::tuple shape = py::make_tuple(rows, cols, channels);
Py_intptr_t dims[] = { 480, 640, 3 };
np::ndarray img_array = np::zeros(3, dims, np::dtype::get_builtin<unsigned char>());
//np::dtype dtype = np::dtype::get_builtin<unsigned char>();
// np::ndarray dst_arry = np::empty(shape, dtype);
std::cout << 1 << std::endl;
int result = hslib->getImg(img_array);
C++与NumPy高效集成指南

2296

被折叠的 条评论
为什么被折叠?



