Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to start capture #5

Closed
qq923004243 opened this issue Aug 3, 2024 · 2 comments
Closed

Failed to start capture #5

qq923004243 opened this issue Aug 3, 2024 · 2 comments

Comments

@qq923004243
Copy link

Traceback (most recent call last):
File "D:\迅雷下载\main\AI-Aimbot-main\testwincap.py", line 9, in
frame, timestamp = camera.get_bgr_frame()
File "C:\Users\lixingliang\AppData\Local\Programs\Python\Python310\lib\site-packages\wincam\dxcam.py", line 58, in get_bgr_frame
raise Exception(f"Failed to start capture, error code {f'{-hr:02x}'}")
Exception: Failed to start capture, error code 01
2024-08-03_181648

Press ESCAPE to close the window...
Capture failed -2147467262
Error: Failed to start capture, error code 7fffbffe

This is my system environment Win10 2022H 19045.4651, GPU 2070s, but there is indeed no way to start when it is enabled。

import cv2
from wincam import DXCamera
x=665
y=550
w=825
h=577
with DXCamera(x, y, w, h, 144) as camera:
    while True:
        frame, timestamp = camera.get_bgr_frame()
        cv2.imshow("frame", frame)
        if cv2.waitKey(1) & 0xFF == 27:
            break
@blaxkwidow
Copy link

try #6

@qq923004243
Copy link
Author

@blaxkwidow thk u , it is useful .
my code:

from wincam import DXCamera
import cv2
import time
x=0
y=0
w=320
h=320
with DXCamera(x, y, w, h, fps=144) as camera:
    frame_count = 0
    start_time = time.time()
    while True:
        frame, timestamp = camera.get_bgr_frame()
        cv2.imshow("frame", frame)
        cv2.waitKey(1)
        frame_count += 1
        elapsed_time = time.time() - start_time

        if elapsed_time > 0:
            fps = frame_count / elapsed_time
            print(f"FPS: {fps:.2f}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants