Dadep Dadep - 11 months ago 64
C++ Question

communication of a value in streaming between python and c++

I have a script in C++ done by someone else which is doing online (realtime) analysis from video. In the running code there is a switch case. Each case depend of what is detect in the online video analysis, the frequency of event should be close to 20Hz.

Inside each "case" I would like to send "something" to a python script I am building. The python script is going, online, to count the events and after a threshold value write on a serial port. And do this forever.

My problem is the "online" comminication between both script...

The "already built" software in c++ already send many different cout, so I can't separate the information i want from the other cout. I would like to find an other "output" or a way to distinguish my relevant information...
So I want to send from C++ to python

What should I use ?
Can I create a pipe from the c++ script to the python script ? how can I do this to make it work "online" ?

Thanks a lot

Answer Source

I found a way using "pipe" in a shell script :

./scriptc++ | ./

the standard output of my C++ a redirected to the standard input of my puthon script It work !