Created
January 13, 2017 09:03
-
-
Save SkaTeMasTer/55577b4b1c59bf7ae0ebced774828acb to your computer and use it in GitHub Desktop.
Python script to capture the time lapse images:
This file contains hidden or 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
#do apt-get install ffmpeg Then, use this | |
import time | |
import picamera | |
VIDEO_DAYS = 1 | |
FRAMES_PER_HOUR = 60 | |
FRAMES = FRAMES_PER_HOUR * 24 * VIDEO_DAYS | |
def capture_frame(frame): | |
with picamera.PiCamera() as cam: | |
time.sleep(2) | |
cam.capture('/home/pi/Desktop/frame%03d.jpg' % frame) | |
# Capture the images | |
for frame in range(FRAMES): | |
# Note the time before the capture | |
start = time.time() | |
capture_frame(frame) | |
# Wait for the next capture. Note that we take into | |
# account the length of time it took to capture the | |
# image when calculating the delay | |
time.sleep( | |
int(60 * 60 / FRAMES_PER_HOUR) - (time.time() - start) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment