Skip to content

Commit a56b19c

Browse files
added code for video 14 on recording screen
1 parent 7228dda commit a56b19c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import numpy as np
2+
import cv2
3+
from PIL import ImageGrab
4+
5+
fourcc = cv2.VideoWriter_fourcc('X','V','I','D')
6+
vid = cv2.VideoWriter('record.avi', fourcc, 8, (500,490))
7+
while(True):
8+
img = ImageGrab.grab(bbox=(100, 10, 600, 500)) #x, y, w, h
9+
img_np = np.array(img)
10+
#frame = cv2.cvtColor(img_np, cv2.COLOR_BGR2GRAY)
11+
vid.write(img_np)
12+
cv2.imshow("frame", img_np)
13+
key = cv2.waitKey(1)
14+
if key == 27:
15+
break
16+
17+
vid.release()
18+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)