import cv
import datetime
import time

capture = cv.CaptureFromCAM(0)
time.sleep(0.3)
#cd=cv.WaitKey(1000)
while True:
	frame = cv.QueryFrame(capture)
	str=datetime.datetime.isoformat(datetime.datetime.now())
	cv.SaveImage("capture%s.jpg" % str.replace(":","_"), frame)
	cv.ShowImage("capture", frame)
	time.sleep(1.0)
	c=cv.WaitKey(1)
	if c==ord('q'):
		break