I have two opencv2/Python scripts running at the same time on the same Raspberry PI.
- A streaming server script based on this, that outputs a live camera feed to the web
- a motion detection script, that detects movement from a camera
Only one of these scripts can access the NOIR camera board at once, so I need a way of passing/sharing each frame gathered to the other script.
They both grab the frame from the NOIR camera board using opencv2's
rc,img = capture.read(); so i'll have to remove that from one of them and somehow pass the img to the other script when rc is true.
As the camera frame rate is substantial, I don't think it's feasible to save the img (numpy array) to a file on a disc that they can both access; but I may be wrong!
I've been scratching my head and searching the net for examples on scripts that pass data, but alas i'm stuck.
How could I share a numpy array between two running python programs on the same Raspberry PI, and could someone kindly provide me some example code?