fix(cameras): opencv camera index casting (#2286)

This commit is contained in:
Steven Palma
2025-10-22 17:27:31 +02:00
committed by GitHub
parent 12f2f35760
commit 306429a85b

View File

@@ -300,11 +300,12 @@ class OpenCVCamera(Camera):
"""
found_cameras_info = []
targets_to_scan: list[str | int]
if platform.system() == "Linux":
possible_paths = sorted(Path("/dev").glob("video*"), key=lambda p: p.name)
targets_to_scan = [str(p) for p in possible_paths]
else:
targets_to_scan = [str(i) for i in range(MAX_OPENCV_INDEX)]
targets_to_scan = [int(i) for i in range(MAX_OPENCV_INDEX)]
for target in targets_to_scan:
camera = cv2.VideoCapture(target)