Installing and testing the Python library
Now that we have the camera module installed and working, we can install and start using the picamera
library.
First, we need to install the pip package manager in order to install the latest version of the
picamera
library. This can be done using the following command:sudo apt-get install python-pip
Next, we will update the installed version of the
picamera
library using the following command:sudo pip install --upgrade picamera
Now that the library is installed, we can test it out with a basic example to ensure that both the camera and the library are working correctly. This also gives us a chance to look at the basic usage of the picamera
library.
We will do this from an interactive Python shell. First, we will import the required libraries:
import time from picamera import PiCamera
Next, we will use the with
statement to manage opening and closing the camera:
with PiCamera() as cam:
Now, we will set the resolution the camera will capture at and start...