Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lerobot/cameras/opencv/camera_opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def find_cameras() -> list[dict[str, Any]]:
targets_to_scan = [int(i) for i in range(MAX_OPENCV_INDEX)]

for target in targets_to_scan:
camera = cv2.VideoCapture(target)
camera = cv2.VideoCapture(target, get_cv2_backend())
if camera.isOpened():
default_width = int(camera.get(cv2.CAP_PROP_FRAME_WIDTH))
default_height = int(camera.get(cv2.CAP_PROP_FRAME_HEIGHT))
Expand Down
4 changes: 3 additions & 1 deletion src/lerobot/cameras/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,7 @@ def get_cv2_backend() -> int:
return int(cv2.CAP_MSMF) # Use MSMF for Windows instead of AVFOUNDATION
# elif platform.system() == "Darwin": # macOS
# return cv2.CAP_AVFOUNDATION
else: # Linux and others
elif platform.system() == "Linux":
return int(cv2.CAP_V4L2)
else: # others
return int(cv2.CAP_ANY)