Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. def snapPhoto(camera):
  2.     for i in range(3):
  3.         camera.capture('threaded_photo_' + str(i) + '.jpg')
  4.         # Tried to use video port with no luck
  5.         #camera.capture('threaded_photo_' + str(i) + '.jpg', use_video_port=True)
  6.  
  7. def runCameraPreview():
  8.  
  9.     #for i in range(3):
  10.     with picamera.PiCamera() as camera:
  11.         # Get the camera ready
  12.         time.sleep(2)
  13.         print("Starting process")
  14.         # try image capture in a thread
  15.         p1 = Process(target=snapPhoto, args=(camera,))      
  16.         p1. start()
  17.         # Do any processing
  18.         print("Waiting")
  19.         p1.join() # Wait for the process to return
  20.  
  21. runCameraPreview()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement