Skip to content

Instantly share code, notes, and snippets.

@weberhen
Last active August 2, 2018 12:51
Show Gist options
  • Save weberhen/ef2ad7f59021325adeb4e8728333ed44 to your computer and use it in GitHub Desktop.
Save weberhen/ef2ad7f59021325adeb4e8728333ed44 to your computer and use it in GitHub Desktop.
import mss
import numpy
import cv2
out = cv2.VideoWriter("output.avi", cv2.VideoWriter_fourcc(*'MJPG'), 25.0,(600,400), True)
i = 0
while i < 1000:
i+=1
with mss.mss() as sct:
monitor = {'top': 52, 'left': 65, 'width': 600, 'height': 400}
img = numpy.array(sct.grab(monitor))
print(img.shape)
out.write(img[:,:,0:3].astype('uint8'))
cv2.imshow('A',img)
cv2.waitKey(3)
out.release()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment