import cv2
cv2.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 cv2
import numpy as np
# Change here
WIDTH = 1920
HEIGHT = 1080
# For secondary monitor,
LEFT = 0
TOP = 0
screen = 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:
pass
cv2.setMouseCallback('screen', on_click)