In today's lab, we will learn how to connect a Pi Camera to your Raspberry Pi and learn how to control it to capture photos and stream video.
Steps:
Call a command that will have the camera take a photo or video
Save the file with a timestamp as part of the filename
Post the file and share it with the class!
Stop motion:
Take single images (jpg)
Save them to the captured directory created earlier
Each pic must have its own filename (timestamp, counter...),
Trigger by button input
Make a GIF:
Like time lapse, but with very short intervals
Use another library to stitch the images together
Reduce resolution of images
Save stitched image as .gif
Time Lapse:
Take shots at specified intervals.
Time lapse must exit if a key is pressed, or run for a known number of times.
Prevent time-lapse from filling your disk.
Send Email:
Like Stop Motion, this takes single shots, but sends them via email
The email includes a camera attachment with the JPG image
Lower the resolution to save email storage space
The Pi Camera module is an add-on component that allows you to take photos or videos with the Raspberry Pi. It includes the basic functionality as well as more advanced features, such as using RAW, capturing long exposures, directly accessing sensors, and more. The component can be controlled completely programmatically, which means that you can write and run a script that will control the camera without the user having to press any buttons to snap the photo!
raspistill is the command line tool for capturing still photographs with a Raspberry Pi camera module.
A basic image can be captured by running the following command:
raspistill -o imagename.jpg
This library also contains many other commands that allow you to modify the image, such as rotating it or flipping it.
raspivid is the command line tool for capturing video with a Raspberry Pi camera module.
Similar to the raspistill library, videos can be captured using the command:
raspivid -o videoname.jpg
The default length of the video is 5 seconds so if you want to capture longer videos, you can add to the command above by specifying the length of the video you want to capture (in milliseconds).
raspivid -o videoname.jpg -t 10000