“[ WARN:0] 全局 SourceReaderCB::~SourceReaderCB 终止异步回调”警告

Gir*_*ore 0 opencv

尝试运行以下代码时收到警告。我还添加了 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()
Run Code Online (Sandbox Code Playgroud)

nul*_*ine 5

这个问题是一个重复的这一个

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