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