Created
August 31, 2010 14:59
-
-
Save brunomlopes/559151 to your computer and use it in GitHub Desktop.
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
from VideoCapture import Device | |
from os import listdir | |
from datetime import datetime | |
from threading import Timer | |
from sys import stdin | |
from string import zfill | |
cam = Device() | |
format = "snap_%s_%s.png" | |
i = 1 | |
l = [int(a.split("_")[1]) for a in listdir(".") if a.endswith("png")] | |
if len(l)>0: | |
i = max(l)+1 | |
def takesnapshot(i): | |
n = format % (zfill(i,5), datetime.now().strftime("%Y-%m-%d_%H-%M-%S")) | |
print n | |
cam.saveSnapshot(n, quality=100) | |
Timer(10.0, lambda : takesnapshot(i+1)).start() | |
cam.setResolution(1280,960) | |
takesnapshot(i) | |
while stdin.read(1) != 'q': | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment