How to use opencv screen recording output for movement detection in python?

As a security guard we have to look an eye on a 60 inches TV which provides 20 camera output on it. So its really hard to watch the pot always. I decide to develope a programm to rectanglar the movement object in screen and make some beeps. My first step is to capture the screen frames. With below code its possible.

import numpy as np
import cv2
from mss import mss
from PIL import Image

bounding_box = {'top': 100, 'left': 0, 'width': 400, 'height': 300}

sct = mss()

while True:
    sct_img = sct.grab(bounding_box)
    cv2.imshow('screen', np.array(sct_img))

    if (cv2.waitKey(1) & 0xFF) == ord('q'):
        cv2.destroyAllWindows()
        break

As i understand we can use opencv to do some magic. There are some nice tutorial on net like this one. My problem is they got frames or stream from cams or ofline video files but here i have screen recording. Can you guys help me how to forward these frames into motion detection algorithm? Thanks


The process is the same, you have to modify the image source.
In the example you linked - in the 'The smart way' code - replace

cv.QueryFrame(self.capture)
with
sct.grab(bounding_box)

to use the screengrab as image source