SHARE
TWEET

Untitled

a guest Apr 25th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from picamera.array import PiRGBArray
  2. from picamera import PiCamera
  3. import time
  4. import cv2
  5.  
  6. # initialize the camera and grab a reference to the raw camera capture
  7. camera = PiCamera()
  8. camera.resolution = (640, 480)
  9. camera.framerate = 32
  10. rawCapture = PiRGBArray(camera, size=(640, 480))
  11.  
  12. # allow the camera to warmup
  13. time.sleep(0.1)
  14.  
  15. # capture frames from the camera
  16. for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
  17.     # grab the raw NumPy array representing the image, then initialize the timestamp
  18.     # and occupied/unoccupied text
  19.     image = frame.array
  20.  
  21.     # OpenCV Examp
  22.     #image = cv2.erode(image,None,iterations = 5)
  23.     #image = cv2.dilate(image,None,iterations = 5)
  24.     image = cv2.Canny(image,30,150)
  25.  
  26.     #Show
  27.     cv2.imshow("Frame", image)
  28.     key = cv2.waitKey(1) & 0xFF
  29.  
  30.     # clear the stream in preparation for the next frame
  31.     rawCapture.truncate(0)
  32.  
  33.     # if the `q` key was pressed, break from the loop
  34.     if key == ord('q'):
  35.         break
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top