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 = [] found_cameras_info = []
targets_to_scan: list[str | int]
if platform.system() == "Linux": if platform.system() == "Linux":
possible_paths = sorted(Path("/dev").glob("video*"), key=lambda p: p.name) possible_paths = sorted(Path("/dev").glob("video*"), key=lambda p: p.name)
targets_to_scan = [str(p) for p in possible_paths] targets_to_scan = [str(p) for p in possible_paths]
else: 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: for target in targets_to_scan:
camera = cv2.VideoCapture(target) camera = cv2.VideoCapture(target)