Enable Camera on Your Raspberry Pi
By default, the camera interface is closed on your Raspberry Pi, so enabling using the camera on your Raspberry Pi is the first step for a Computer Vision project on your Raspberry Pi. Following is a simple tutorial.
In the command line tool, use the following command:
$ sudo raspi-config
Then choose the 5th option(Interfacing Options)
Now if you are connecting to the Raspberry Pi remotely with ssh, you should reboot the Pi by using
$ sudo reboot
Fix the Potential Error & Test the Camera
Now let’s try the camera out!
$ workon cv
makes sure that you are in the virtual environment with cv2 installed.
But as you can see, there might be an ERROR as in my case.
VIDEOIO ERROR: V4L: can't open camera by index 0
To resolve it, exit the python command line, then run:
$ sudo modprobe bcm2835-v4l2
Now, feel free to start your project with the camera and opencv installed!
- Fix the possible ERROR: http://answers.opencv.org/question/199105/videoio-error-v4l-cant-open-camera-by-index-0/