OpenCV FullScreen Window
import cv2cv2.namedWindow('screen', cv2.WINDOW_NORMAL)cv2.setProperty('screen', cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
黒画面
import cv2import numpy as np# Change hereWIDTH = 1920HEIGHT = 1080# For secondary monitor,LEFT = 0TOP = 0screen = np.zeros((HEIGHT, WIDTH), dtype=np.uint8)cv2.namedWindow('screen', cv2.WINDOW_NORMAL)cv2.moveWindow('screen', LEFT, TOP)cv2.setWindowProperty('screen', cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)cv2.imshow('screen', screen)cv2.waitKey(0)
For dynamic image size,
- https://stackoverflow.com/questions/3129322/how-do-i-get-monitor-resolution-in-python
- macos - How to get the desktop resolution in Mac via Python? - Stack Overflow
クリック
def on_click(event, x, y, flags, param):if event == cv2.EVENT_LBUTTONDOWN:passcv2.setMouseCallback('screen', on_click)