📜  python 捕获桌面作为视频源 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:13.804000             🧑  作者: Mango

代码示例1
import numpy as np
import cv2
from mss import mss
from PIL import Image

bounding_box = {'top': 100, 'left': 0, 'width': 400, 'height': 300}

sct = mss()

while True:
    sct_img = sct.grab(bounding_box)
    cv2.imshow('screen', np.array(sct_img))

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