user2696522
user2696522

Reputation: 41

How to read video stream in python using opencv

I'm using raspberry pi with dedicated camera board and i'm trying to do some image processing simultaneously with streaming it to web server. To do this I created named pipe and I'm streaming video from raspivid -> named_pipe -> ffmpeg -> web server. This part works with no problems. Now I want to detect movement on this video feed. Any ideas how to read video stream from this named_pipe in python and then process it in opencv?

Upvotes: 3

Views: 2749

Answers (2)

RossBille
RossBille

Reputation: 1489

Installing this driver on the rpi will allow python-opencv to read the stream as if it were a webcam attached by usb. See this answer in order to remove the fullscreen preview.

The problem seems to be that the python-opencv cannot easily access the camera unless its in userspace.

Upvotes: 1

203
203

Reputation: 499

I'm not into this, but have you tried this:

vid = cv2.VideoCapture("/path/to/stream")
# read frames, compare them, ...

Upvotes: 0

Related Questions