def __init__(self, resolution=(120, 160), framerate=20):
from picamera.array import PiRGBArray
from picamera import PiCamera
resolution = (resolution[1], resolution[0])
# initialize the camera and stream
self.camera = PiCamera() #PiCamera gets resolution (height, width)
self.camera.resolution = resolution
self.camera.framerate = framerate
self.rawCapture = PiRGBArray(self.camera, size=resolution)
self.stream = self.camera.capture_continuous(self.rawCapture,
format="rgb", use_video_port=True)
# initialize the frame and the variable used to indicate
# if the thread should be stopped
self.frame = None
self.on = True
print('PiCamera loaded.. .warming camera')
time.sleep(2)
评论列表
文章目录