Skip to content

Commit 779ad25

Browse files
code for screen capture tutorial (12)
1 parent 5184051 commit 779ad25

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import numpy as np
2+
import cv2
3+
from PIL import ImageGrab
4+
img = ImageGrab.grab(bbox=(100, 10, 200, 300)) #x, y, w, h
5+
img_np = np.array(img)
6+
frame = cv2.cvtColor(img_np, cv2.COLOR_BGR2GRAY)
7+
cv2.imshow("frame", frame)
8+
cv2.waitKey(0)
9+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)