forked from tangger/lerobot
fix(cameras): opencv camera index casting (#2286)
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user