(-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'
原因:图像只支持uint8类型数据,正确代码:
pybind代码:
aaa= binddemo.proxy_init3F(3.0) aaa=aaa.astype(np.uint8) # aaa=cv2.imread("d:/f1.jpg") cv2.imshow("a",aaa) cv2.waitKeyEx()
m.def("proxy_init3F", [](double start) {
py::array_t
auto r = a.mutable_unchecked<3>();
for (ssize_t k = 0; k < r.shape(2); k++)
for (ssize_t j = 0; j < r.shape(1); j++)
for (ssize_t i = 0; i < r.shape(0); i++)
r(i, j, k) = start++;
return a;
});