Closed zimixvx closed 1 year ago
What is the region?
Python version?
Also you might not need npImg = np.array(frame)
640x640 py 3.8 didnt work btw
fixed
import cv2
import dxcam
MONITOR_WIDTH = 1920 # game res
MONITOR_HEIGHT = 1080 # game res
MONITOR_SCALE = 1 # how much the screen shot is downsized by eg. 5 would be one fifth of the monitor dimensions
region = (int(MONITOR_WIDTH / 2 - MONITOR_WIDTH / MONITOR_SCALE / 2),
int(MONITOR_HEIGHT / 2 - MONITOR_HEIGHT / MONITOR_SCALE / 2),
int(MONITOR_WIDTH / 2 + MONITOR_WIDTH / MONITOR_SCALE / 2),
int(MONITOR_HEIGHT / 2 + MONITOR_HEIGHT / MONITOR_SCALE / 2))
camera = dxcam.create(output_idx=0, output_color="BGRA")
while True:
screenshot = camera.grab(region)
if screenshot is not None:
cv2.imshow('1', screenshot)
cv2.waitKey(1)
`cv2.error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'imshow'
code