Last active
December 17, 2015 18:29
-
-
Save benhosmer/5653641 to your computer and use it in GitHub Desktop.
Raspberry pi camera module time-delayed loop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Usage: | |
python timed_capture.py | |
''' | |
import datetime | |
from time import sleep | |
import subprocess | |
fps = 1 # The number of frames to capture per second. | |
total_dur = 10 # The total capture time. | |
''' | |
The settings above capture 1 frame every second and runs | |
for a total of 10 seconds. Afterwards you'll have 10 images | |
captured 1 second apart from each other | |
''' | |
for x in range(total_dur): | |
current_time = str(datetime.datetime.now()) | |
file_name = current_time.replace(' ', '_') + '.jpg' | |
subprocess.call(['raspistill', '-o', file_name, '-n']) | |
sleep(fps) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment