【问题标题】:"[ WARN:0] global SourceReaderCB::~SourceReaderCB terminating async callback" warning“[WARN:0] 全局 SourceReaderCB::~SourceReaderCB 终止异步回调”警告
【发布时间】:2020-04-23 02:10:23
【问题描述】:

我在尝试运行以下代码时收到警告。我也添加了 cv.destroyAllWindows() 函数。警告仍在显示。

import cv2 as cv
import datetime

cap = cv.VideoCapture(0)
cap.set(3,1280)
cap.set(4,720)

while(cap.isOpened()):
    ret, frame = cap.read()

    if ret == True:
        text = "Width: "+str(cap.get(3))+" Height: "+str(cap.get(4))
        datet = str(datetime.datetime.now())
        frame = cv.putText(frame, datet, (10, 50), cv.FONT_HERSHEY_SIMPLEX, 2, (0, 255, 255), 2, cv.LINE_AA)
        frame = cv.circle(frame, (640, 360), 200, (0, 255, 255), 2, cv.LINE_AA)
        cv.imshow("frame", frame)

        if cv.waitKey(1) & 0xFF == ord('q'):
            break

cap.release()
cv.destroyAllWindows()

【问题讨论】:

    标签: opencv


    【解决方案1】:

    对于那些接受的答案不起作用并且遇到如下错误的谷歌同事:

    anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback
    

    修复将opencv版本降级为3.4.2.16

    做:

    pip install opencv-python==3.4.2.16 
    

    【讨论】:

      【解决方案2】:

      这个问题与this one重复

      使用cap = cv.VideoCapture(0, cv2.CAP_DSHOW) 为我修复了它

      【讨论】:

        猜你喜欢
        • 2020-05-17
        • 1970-01-01
        • 2019-07-21
        • 2015-09-23
        • 1970-01-01
        • 2010-10-06
        • 2022-07-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多