lerobot icon indicating copy to clipboard operation
lerobot copied to clipboard

fix(opencv backend): Removing open cv default backend on Windows

Open CarolinePascal opened this issue 7 months ago • 1 comments

What this does

This PR removes the forced open cv backend choice for Windows platforms :

if platform.system() == "Windows":
      return cv2.CAP_AVFOUNDATION

This choice reportedly caused errors that could have been avoided by letting open cv picking a available and working backend, i.e. using cv2.CAP_ANY for all operating systems.

How it was tested

TBD

How to checkout & try? (for the reviewer)

On Windows, plug a camera and run :

python lerobot/find_cameras.py

CarolinePascal avatar Jun 15 '25 00:06 CarolinePascal

If think that function should be

def get_cv2_backend() -> int:
    import cv2

    if platform.system() == "Windows":
-       return cv2.CAP_AVFOUNDATION
+       return cv2.CAP_DSHOW
    else:
        return cv2.CAP_ANY

Seems we've mixed it since #676 which was forcing cv2.CAP_DSHOW backend on Windows to avoid a delay issue

aliberts avatar Jun 15 '25 12:06 aliberts