Reader small image

You're reading from  Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)

Product typeBook
Published inSep 2015
Reading LevelBeginner
Publisher
ISBN-139781783551590
Edition1st Edition
Languages
Right arrow
Author (1)
Dan Nixon
Dan Nixon
author image
Dan Nixon

Dan Nixon is a software and electronics engineer living in the north of England. He has past experience of creating software for data analysis, process control, and business intelligence applications. In most of these projects, Python was one of the main languages used. Dan previously authored another book on the uses of the Raspberry Pi, called Raspberry Pi Blueprints, and has worked on many personal projects that use both Python and the Raspberry Pi.
Read more about Dan Nixon

Right arrow

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...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)
Published in: Sep 2015Publisher: ISBN-13: 9781783551590

Author (1)

author image
Dan Nixon

Dan Nixon is a software and electronics engineer living in the north of England. He has past experience of creating software for data analysis, process control, and business intelligence applications. In most of these projects, Python was one of the main languages used. Dan previously authored another book on the uses of the Raspberry Pi, called Raspberry Pi Blueprints, and has worked on many personal projects that use both Python and the Raspberry Pi.
Read more about Dan Nixon