I'm desperately trying to use the Pi camera to do some work with it; I'm using OpenCV but trying to process the feed from the camera itself.

Currently I'm running OpenCV on the Pi itself but this is dead slow. I tried to stream the video to another computer, but this was even worse.

What is a mystery is that using the native raspivid tools, it produces beautiful video, but I can't seem to do much with it. Is there a way I can stream that exact data across the network, and it work well?

  • 1
    raspivid does almost all it's processing on the GPU, OpenCV and V4L2 (which I assume you are using to open the camera) will probably be using the CPU to convert the h264 stream from the camera to an MJPG stream, hence the terrible frame rate. It should be possible to change the pixel format in V4L2 but not sure if this works properly in OpenCV.
    – user8894
    Apr 24, 2014 at 17:29
  • 1
    What do you mean; change the pixel format from mjpg to h264, to prevent transcoding?
    – cjm2671
    Apr 26, 2014 at 10:44

1 Answer 1


Is it absolutely necessary that you run OpenCV algorithms on the video stream? The raspberry pi is only capable of so much, and much of OpenCV's manipulations of intensive on the system.

You may consider taking pictures and processing those. In a lot of cases, taking a few shots every second is sufficient to get an idea as to what is happening in the frame. Is this an option for you? If it was, you could use raspistill to get the high quality pics.

If this is not an option for you, I have heard very little for solutions to this problem. The only other thing I would suggest to you is to try: https://thinkrpi.wordpress.com/2013/05/22/opencvpi-cam-step-4-link-with-opencv/ But I have heard that it has degraded picture quality, which I imagine is not what your wanting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.