2

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?

Bonifacio2
  • 3,405
  • 6
  • 34
  • 54
user2696522
  • 31
  • 1
  • 4
  • You may run into a problem whereby your processing will take much more time than capturing the next frame, which means your moving object will not be where they were when the currently processed frame was taken. Would taking a still image -> processing it -> taking another one work? That's how I did it. – Aleksander Lidtke Sep 05 '13 at 14:35

2 Answers2

1

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.

Community
  • 1
  • 1
RossBille
  • 1,448
  • 1
  • 17
  • 26
0

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

vid = cv2.VideoCapture("/path/to/stream")
# read frames, compare them, ...
203
  • 499
  • 1
  • 6
  • 17