我的问题 :
我正在研究我的计算机视觉项目。我使用 opencv(4.1.2) 和 python 来实现它。
我需要一种更快的方法将读取帧传递到我的计算机上的图像处理(Ubuntu 18.04 8 核 i7 3.00GHz 内存 32GB)。读取cv2.VideoCapture.read()帧(帧大小:720x1280)大约需要120~140ms。这太慢了。我的处理模块每次运行大约需要 40 毫秒。我们希望 25~30 FPS。
这是到目前为止我的演示代码:
import cv2
from collections import deque
from time import sleep, time
import threading
class camCapture:
def __init__(self, camID, buffer_size):
self.Frame = deque(maxlen=buffer_size)
self.status = False
self.isstop = False
self.capture = cv2.VideoCapture(camID)
def start(self):
print('camera started!')
t1 = threading.Thread(target=self.queryframe, daemon=True, args=())
t1.start()
def stop(self):
self.isstop = True
print('camera stopped!')
def getframe(self):
print('current buffers : ', len(self.Frame))
return …Run Code Online (Sandbox Code Playgroud)