Here’s the Python code for the time-lapse mentioned in the episode. Make sure to check your paths! Ensure you’re pointing to your correct capture directory and that the directory exists (I saved this as Desktop/timelapse).:

					
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/timelapse/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)

)
Tags

No responses yet

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

BMC logoBuy me a coffee

LiberaPay
SoundCloud – STFUandFish!

%d bloggers like this: