Mihao

Raspberry Pi Camera Test

Jan 8th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #Import modules
  2. import picamera
  3. import picamera.array
  4. import time
  5. import cv2
  6.  
  7. #Initialize camera
  8. camera = picamera.PiCamera()
  9. camera.resolution = (640,480)
  10. rawCapture = picamera.array.PiRGBArray(camera)
  11. #Let camera warm up
  12. time.sleep(0.1)
  13.  
  14. #Capture image
  15. camera.capture(rawCapture, format="bgr")
  16. img = rawCapture.array
  17.  
  18. cv2.imshow("picamera test", img)
  19. cv2.waitKey(0)
Add Comment
Please, Sign In to add comment