반응형

Python MSS 라이브러리로 화면을 캡쳐하고 OpenCV로 표시해 보자.

(더 많은 예는 여기서 확인한다)

 

import numpy as np
import cv2
from mss import mss

with mss() as sct:
	# Part of the screen to capture
    monitor = {"top": 40, "left": 0, "width": 800, "height": 640}
    while True:
        img = np.array(sct.grab(monitor))
        cv2.imshow("img", img)
        if cv2.waitKey(1) & 0xFF == ord("q"):
            cv2.destroyAllWindows()
            break

 

거의 실시간으로 굉장히 빠르게 처리한다.

 

※ 참고

MSS Documentation

 

반응형
Posted by J-sean
: