Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python -u
- """
- Not only Obamas _is_ watching you...
- Based in: http://stackoverflow.com/questions/15870619/python-webcam-http-streaming-and-image-capture
- """
- SAVEDIR = "/home/helio/Pictures/Webcam"
- import pygame, sys
- import pygame.camera
- import time, random
- pygame.init()
- pygame.camera.init()
- cam = pygame.camera.Camera("/dev/video0", (640,480))
- while True:
- print "Taking a shot:",
- cam.start()
- image = cam.get_image()
- cam.stop()
- timestamp = time.strftime("%Y-%m-%d_%H%M%S", time.localtime())
- filename = "%s/%s.jpg" % (SAVEDIR, timestamp)
- print "saving into %s" % filename
- pygame.image.save(image, filename)
- time.sleep(random.randrange(10) * 60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement