I am exporting C++ API for python code using Cython. The application will be executed on Ubuntu. The project files are present here
The function I am wrapping, reads
To follow up on my comment, You have to call an init function for the module:
// ...
Py_Initialize();
initShow_Img(); // for Python3
// (especially with the more modern 2 phase module initialization)
// the process is a little more complicated - see the documentation
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.