So this can be achieved in 2-ways.
1.) you can develop a backend server for python and then expose those api's , and then you can use your api's to send the data and get the results back.
2.) also you can make your python function called by a c++ program ,for that you can use lib like Python.h to call and receive data from the python script.
Example lets say you have a python file named aiDosomething.py which has a function detect which do the detection task.
then in c++ you can do something like
#include <Python.h>
int main()
{
pModule = PyImport_ImportModule("aiDosomething");
//chose the function in file Sample
pFunc = PyObject_GetAttrString(pModule,"detect");
pDict = PyModule_GetDict(pModule); // Create a dictionary for the contents of the module.
//make the args to be passes in the function
pArgs = PyTuple_New(1); // Create a Python tuple to hold the arguments to the method.
PyTuple_SetItem(pArgs, 0, insertArray); // insertArray can be your cv::mat array
//run the code and get the result
PyObject* pResult = PyObject_CallObject(pFunc, pArgs);
return 0;
}
for keeping things simple you can put your python code and c++ under same directory.
Mattondarray. There's also Boost.Numpy.