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

Dxcam can't find gpu? #91

Open
QuangNguyenPT opened this issue Apr 15, 2024 · 1 comment
Open

Dxcam can't find gpu? #91

QuangNguyenPT opened this issue Apr 15, 2024 · 1 comment

Comments

@QuangNguyenPT
Copy link

I'm not sure what is happening but like when I set my device_idx = 1 ( as my gpu is 1 ) it gives the error:
Traceback (most recent call last):
File "C:\Users\phuoc\OneDrive\Desktop\All-in-One\Coding\Aimbot\test\capture.py", line 5, in
camera = dxcam.create(device_idx= 1, output_color="BGR")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\phuoc\AppData\Local\Programs\Python\Python311\Lib\site-packages\dxcam_init_.py", line 112, in create
return _factory.create(
^^^^^^^^^^^^^^^^^
File "C:\Users\phuoc\AppData\Local\Programs\Python\Python311\Lib\site-packages\dxcam_init
.py", line 45, in create
device = self.devices[device_idx]
~~~~~~~~~~~~^^^^^^^^^^^^
IndexError: list index out of range
but when I set it to 0 ( is my cpu ) it work fine
below is my code:
import dxcam
import cv2
import time

camera = dxcam.create(device_idx= 1, output_color="BGR")
print(dxcam.device_info())

Initialize loop_time before the loop

loop_time = time.time()
print("running")
while True:
capture = camera.grab()
if capture is None:
continue

hsv_capture = cv2.cvtColor(capture, cv2.COLOR_BGR2HSV)

print('FPS {}'.format(1 / (time.time() - loop_time)))
loop_time = time.time()

cv2.imshow("capture", hsv_capture)

if cv2.waitKey(1) & 0xFF == ord('q'):
    break

print("done")
time.sleep(3)
cv2.destroyAllWindows()

@Xpropel
Copy link

Xpropel commented Jun 13, 2024

I think your computer may be laptop,not desktop computer. Beacuse I also had this problem when I wanted to use my Nvida. But, I found it's normal if I chose Interl, which is a more slow device.

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