python capture desktop as video source

Solutions on MaxInterview for python capture desktop as video source by the best coders in the world

showing results for - "python capture desktop as video source"
Golda
13 Jan 2019
1import numpy as np
2import cv2
3from mss import mss
4from PIL import Image
5
6bounding_box = {'top': 100, 'left': 0, 'width': 400, 'height': 300}
7
8sct = mss()
9
10while True:
11    sct_img = sct.grab(bounding_box)
12    cv2.imshow('screen', np.array(sct_img))
13
14    if (cv2.waitKey(1) & 0xFF) == ord('q'):
15        cv2.destroyAllWindows()
16        break
17