The question is a bit similar to this question.
The main difference is that I'm using a different camera (the Raspberry Pi camera board). I've spend a few days exploring Python and OpenCV. I'm writing a script on my Windows laptop that I want to run on my Raspberry Pi.
My Raspberry Pi has OpenCV 2.3.1 installed. I could make images using PiCamera, or I could write:
import os, sys
os.system('raspistill -o /var/www/images/image.jpg')
However, I want to use cv2.VideoCapture(int device). The documentation says:
Parameters:
- filename – name of the opened video file
- device – id of the opened video capturing device (i.e. a camera index). If there is a single camera connected, just pass 0.
cv2.CreateCapture(0)
works perfectly fine on my laptop. On the Raspberry Pi however, it's unable to open the camera. I'm not experienced with Raspbian, so I'm not sure if 0
is the correct device ID.
Any help will be greatly appreciated.