Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def picamera_logging_thread():
- logger.info('Started camera logging thread')
- while time() < start_time + timeout:
- with PiCamera() as camera:
- # set values
- camera.resolution = (3280, 2464)
- # let automatic exposure settle
- sleep(2)
- image_name = 'image_' + str(int(time()))
- # capture in PNG format at native resolution
- camera.capture(os.path.join(image_dir, image_name + '.png'))
- logger.info('Saved image ' + image_name + '.png')
- # let automatic exposure settle
- sleep(2)
- image_name = 'image_' + str(int(time()))
- # capture in unencoded RGB format
- camera.capture(os.path.join(image_dir, image_name + '.data'), 'rgb')
- logger.info('Saved image ' + image_name + '.data')
- # delay the specified interval
- sleep(picamera_logging_interval - 4)
- logger.info('Stopped camera logging thread')
- start_time = time()
- # start logging threads
- Thread(target = sensehat_logging_thread).start()
- Thread(target = picamera_logging_thread).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement