Advertisement
MendaxPentest

abrindo camera

Feb 10th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. #! /usr/bin/python -u
  2.  
  3. """
  4. Not only Obamas _is_ watching you...
  5. Based in: http://stackoverflow.com/questions/15870619/python-webcam-http-streaming-and-image-capture
  6. """
  7.  
  8. SAVEDIR = "/home/helio/Pictures/Webcam"
  9.  
  10. import pygame, sys
  11. import pygame.camera
  12. import time, random
  13.  
  14. pygame.init()
  15. pygame.camera.init()
  16. cam = pygame.camera.Camera("/dev/video0", (640,480))
  17.  
  18. while True:
  19.    print "Taking a shot:",
  20.    cam.start()
  21.    image = cam.get_image()
  22.    cam.stop()
  23.  
  24.    timestamp = time.strftime("%Y-%m-%d_%H%M%S", time.localtime())
  25.    filename = "%s/%s.jpg" % (SAVEDIR, timestamp)
  26.    print "saving into %s" % filename
  27.  
  28.    pygame.image.save(image, filename)
  29.    time.sleep(random.randrange(10) * 60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement