Python的低FPS,覆盆子Pi的OpenCV

Python的低FPS,覆盆子Pi的OpenCV,python,opencv,raspberry-pi,frame-rate,Python,Opencv,Raspberry Pi,Frame Rate,我正在尝试用Python和OpenCV在Raspberry Pi上进行一些图像处理。到目前为止,它运行良好,只是FPS速率较低。即使没有任何图像处理,仅使用下面的代码,我也只能以640x480分辨率获得10 FPS。 有没有更快的方法来捕获视频流?我这里有什么问题吗 import numpy as np import cv2 import time from picamera.array import PiRGBArray from picamera import PiCamera # ini

我正在尝试用Python和OpenCV在Raspberry Pi上进行一些图像处理。到目前为止,它运行良好,只是FPS速率较低。即使没有任何图像处理,仅使用下面的代码,我也只能以640x480分辨率获得10 FPS。 有没有更快的方法来捕获视频流?我这里有什么问题吗

import numpy as np
import cv2
import time
from picamera.array import PiRGBArray
from picamera import PiCamera

# initialize the camera and grab a reference to the raw camera capture
camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 32
rawCapture = PiRGBArray(camera, size=(640, 480))
# allow the camera to warmup
time.sleep(0.1)
start = time.time()

for img in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):

    frame = img.array
    rawCapture.truncate(0)
    end = time.time()
    print 'fps:', int(round(1 / (end - start)))
    start = time.time()
谢谢你


就我所知,硬件总是产生YUV(I420),并且转换到BGR或RGB作为额外的矢量sw阶段,从而减少每秒帧数

我建议创建一个专门用于IO管道的线程,以减少延迟并潜在地增加fps,但是我非常怀疑BGR模型是否能够实现出色的90fps(640x480)

查看这两篇文章,了解更详细的解释:


您使用的是哪种Rpi型号?RPI1处理图像和所有图像的速度相对较慢。最终,RPI2是强大的。