Writing applications for the camera
Now, we will look at a few different possible uses for the camera module and some of the functionality of the picamera
library. While this covers the basics of using the module, it may also be worth a look at the library documentation at picamera.readthedocs.org to learn more about the functionality offered by the library.
A time lapse recorder
The first example we will look at is a simple timelapse still recorder. Essentially, all this will do is capture a series of still images with a given delay between each image.
The code for the Python script that will do this is as follows. First, we will import all the libraries and functions that we will use in the script:
import sys import os from string import Template from time import sleep from threading import Thread from picamera import PiCamera
Next, we will create a thread
class that will perform the still image capture:
class ImageCapture(Thread): def __init__(self, filename, resolution=None, delay=1.0...