{"id":23482,"library":"cv2-enumerate-cameras","title":"cv2-enumerate-cameras","description":"Enumeration of available OpenCV camera indices via VideoCapture. Version 1.3.3, stable. Provides cross-platform functions to list camera devices without trial-and-error. Released irregularly.","status":"active","version":"1.3.3","language":"python","source_language":"en","source_url":"https://github.com/lukehugh/cv2_enumerate_cameras","tags":["opencv","camera","enumeration","video"],"install":[{"cmd":"pip install cv2-enumerate-cameras","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Core dependency for VideoCapture functionality.","package":"opencv-python","optional":false}],"imports":[{"note":"Correct import for listing camera indices.","symbol":"enumerate_cameras","correct":"from cv2_enumerate_cameras import enumerate_cameras"}],"quickstart":{"code":"from cv2_enumerate_cameras import enumerate_cameras\n\ncameras = enumerate_cameras()\nprint(cameras)  # e.g., [0, 1]","lang":"python","description":"List available camera indices. Returns a list of integers."},"warnings":[{"fix":"Always attempt cv2.VideoCapture(index) to verify the camera is usable.","message":"Function may return indices that fail to open if the camera is already in use by another process.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure user has read/write access to /dev/video*.","message":"On some systems (e.g., Linux with V4L), the enumeration might not detect all cameras if permissions are insufficient.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace 'list_cameras()' with 'enumerate_cameras()'.","message":"The function 'list_cameras()' (if imported from older versions) is deprecated; use 'enumerate_cameras()'.","severity":"deprecated","affected_versions":"<1.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install cv2-enumerate-cameras' in the correct Python environment.","cause":"Library not installed or installed in a different environment.","error":"ModuleNotFoundError: No module named 'cv2_enumerate_cameras'"},{"fix":"Upgrade to the latest version: 'pip install --upgrade cv2-enumerate-cameras'.","cause":"Using an older version of the library that does not have this function.","error":"ImportError: cannot import name 'enumerate_cameras' from 'cv2_enumerate_cameras'"},{"fix":"Verify the camera is available and not used elsewhere. Consider using error handling: cap = cv2.VideoCapture(index); if not cap.isOpened(): continue.","cause":"The function returned a camera index that is actually invalid or busy.","error":"AttributeError: 'NoneType' object has no attribute 'read'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}