I'm trying to figure out how it is possible to receive an OpenCV image from a Python in C++. I'm trying to send a callback function, from C++ to my Python module, and then when I call a specific python method in my C++ app, I can access the needed image.
Before I add more details, I need to add that there are already several questions in this regard including :
- how-to-convert-opencv-image-data-from-python-to-c
- pass-image-data-from-python-to-cvmat-in-c
- writing-python-bindings-for-c-code-that-use-opencv
- c-conversion-from-numpy-array-to-mat-opencv
but none of them have anything about
Код: Выделить всё
Pybind11Код: Выделить всё
PyObjectКод: Выделить всё
Python.hКод: Выделить всё
Boost.PythonКод: Выделить всё
Pybind11Код: Выделить всё
NumpyAlso On the
Код: Выделить всё
C++Код: Выделить всё
OpenCVКод: Выделить всё
C++11Код: Выделить всё
3.xКод: Выделить всё
Pybind11What I have tried so far: I made a quick dummy callback and tried passing a simple
Код: Выделить всё
cv::Mat&Код: Выделить всё
#include #include #include #include namespace py = pybind11; ... void cpp_callback1(bool i, std::string id, cv::Mat img) { auto timenow = chrono::system_clock::to_time_t(chrono::system_clock::now()); cout
Источник: [url]https://stackoverflow.com/questions/60917800/how-to-get-the-opencv-image-from-python-and-use-it-in-c-in-pybind11[/url]
Мобильная версия