SerpentAI / D3DShot

Extremely fast and robust screen capture on Windows with the Desktop Duplication API
MIT License
323 stars 73 forks source link

Support OpenCV Mat as a capture format #36

Open MohiuddinM opened 3 years ago

Pro100rus32 commented 3 years ago

Code:

import d3dshot
import cv2
d = d3dshot.create(capture_output="numpy")
d.display = d.displays[0]
img = d.capture_output.backend
d.capture()
while True:
    cv2.imshow("Vision", img)
    if cv2.waitKey(1) & 0 == 1:
        break

output:

cv2.imshow("Vision", img)
TypeError: Expected Ptr<cv::UMat> for argument 'mat'
crackwitz commented 2 years ago

OpenCV, in python, uses numpy arrays.

I don't quite know what you're doing there but d.capture_output.backend is not a numpy array, yet you pass it to an opencv function as if it were. this looks like the error is yours.