I am using this code
import numpy as np
import cv2
from PIL import ImageGrab as ig
import time
last_time = time.time()
while(True):
screen = ig.grab(bbox=(200, 200, 600, 600))
print('Loop took {} seconds'.format(time.time()-last_time))
cv2.imshow("test", np.array(screen))
last_time = time.time()
if cv2.waitKey(25) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break
from this question on SO. This is my output:
This works fine. I am looking for a solution where I can capture the area just under the output window. When I move the window around, the output changes as well. One way would be to update this line as follows:
screen = ig.grab(bbox=(x1, y2, x2, y2))
but thing I can't figure out is that how to get these parameters values. Or how to get the coordinates of the output window?
P.S. I don't have enough reputation to embed images here directly so I added the external link.