【发布时间】:2019-01-09 20:27:25
【问题描述】:
我尝试实时捕获我的屏幕(视频)并用 Python 中的 OpenCV 显示它。
当我运行我的代码时,它会打开很多窗口,而不是只替换一个窗口上的框架。
请帮忙:)
代码如下:
import numpy as np
import cv2
from mss import mss
sct = mss()
monitor = {'top': 0, 'left': 0, 'width': 1920, 'height': 1080}
while True:
img = sct.grab(monitor)
cv2.imshow("Netstream", np.array(img))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
【问题讨论】: