最近我在OpenCV的加速图像处理上我的树莓派3平台上运行的挣扎。我做了脸部识别应用程序,但它运行速度非常缓慢。我读线程,多处理等诸多课题,但我仍然感到困惑了。我只是用面部检测来测试它,以使其更简单。这里是我的代码:实时图像处理与OpenCV的和树莓派
pivideostream.py - 在线程更新帧
from picamera.array import PiRGBArray
from picamera import PiCamera
from threading import Thread
import cv2
class PiVideoStream:
def __init__(self, resolution=(640, 480), framerate=30):
self.camera = PiCamera()
self.camera.resolution = resolution
self.camera.framerate = framerate
self.rawCapture = PiRGBArray(self.camera, size=resolution)
self.stream = self.camera.capture_continuous(self.rawCapture,format='bgr', use_video_port=True)
self.image = None
self.stopped = False
def start(self):
t = Thread(target=self.update)
t.daemon = True
t.start(