Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. def picamera_logging_thread():
  2. logger.info('Started camera logging thread')
  3. while time() < start_time + timeout:
  4. with PiCamera() as camera:
  5. # set values
  6. camera.resolution = (3280, 2464)
  7.  
  8. # let automatic exposure settle
  9. sleep(2)
  10. image_name = 'image_' + str(int(time()))
  11.  
  12. # capture in PNG format at native resolution
  13. camera.capture(os.path.join(image_dir, image_name + '.png'))
  14. logger.info('Saved image ' + image_name + '.png')
  15.  
  16. # let automatic exposure settle
  17. sleep(2)
  18. image_name = 'image_' + str(int(time()))
  19.  
  20. # capture in unencoded RGB format
  21. camera.capture(os.path.join(image_dir, image_name + '.data'), 'rgb')
  22. logger.info('Saved image ' + image_name + '.data')
  23.  
  24. # delay the specified interval
  25. sleep(picamera_logging_interval - 4)
  26. logger.info('Stopped camera logging thread')
  27.  
  28. start_time = time()
  29.  
  30. # start logging threads
  31. Thread(target = sensehat_logging_thread).start()
  32. Thread(target = picamera_logging_thread).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement