Has any one been able to get OpenCV to directly play video from the RasPiCam board using python?

I've seen some projects involving workarounds, but what I'm interested in is being able to use the RasPiCam board with OpenCV as if it were a USB cam.

Ideally, I'd like to do something like this:

import cv2.cv as cv
capture = cv.CreateCameraCapture(-1) 
#some other code to actually display the video

2 Answers 2


You will be able to access to the raspi camera like other V4L2 device using :

sudo modprobe bcm2835-v4l2

uv4l --driver raspicam --auto-video_nr

  • 1
    Excellent. Exactly what I was looking for. Thanks so much.
    – Ryan
    Commented Jun 1, 2014 at 21:15

If you like reading, this guys tutorial is pretty comprehensive. http://thinkrpi.wordpress.com/opencv-and-pi-camera-board/

  • I looked at that tutorial, but it seems to me like that is geared for using OpenCV with C, not python. It wasn't clear to me after reading it how the tutorial would be useful for using OpenCV with python.
    – Ryan
    Commented May 23, 2014 at 3:22
  • Yeah my bad.. sorry clearly didn't read your Question probably :S
    – mrwhale
    Commented May 23, 2014 at 3:23

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.