Unable to execute Cython wrapped Python code

十年热恋 提交于 2019-12-01 19:05:18

To follow up on my comment, You have to call an init function for the module:

// ...
Py_Initialize();
initShow_Img(); // for Python3 use PyInit_Show_Img instead
Print_image(name);
Py_Finalize();
// ...

The reason being is that this sets up the module, include executing the line import cv2. Without it things like accessing the module globals (to get to cv2) won't reliably work. This a likely cause of the segmentation fault.

This is in the documentation example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!