该方法通过基于 cv2.VideoCapture 能够获取视频流入(rtmp/rtsp等)实时帧,能够解决由于图像处理速度不够等原因造成帧堆积的问题。class ThreadedCamera(object): def __init__(self, source=0): global cap self.capture = cv2.VideoCapture(source) self.thread = Thread(target=self.update, args=()) self.thread.daemon = True # 防止主线程挂掉,子线变成程僵尸进程 self.thread.start() self.status = False self.fra