VideoCamera.list#
- classmethod VideoCamera.list() list[dict][source]#
Enumerate available local video cameras
- Returns:
list of dicts, one per camera, each with keys
id,width,height,fps, andname(best-effort). On macOS,width,height, andfpsareNoneif the process has not yet been granted camera authorisation.- Return type:
list[dict]
Probes integer indices 0, 1, 2, … until no camera responds, and returns a list describing each one. Camera names are obtained by a platform-specific method:
macOS —
system_profiler SPCameraDataType -json(no camera authorisation required)Linux —
/sys/class/video4linux/videoN/namesysfs entryWindows — not available;
nameisNone
The name mapping is best-effort: if the platform query fails the
namekey isNone.Example:
$ python >>> from machinevisiontoolbox import VideoCamera >>> for cam in VideoCamera.list(): ... print(cam) {'id': 0, 'width': 1280, 'height': 720, 'fps': 30, 'name': 'FaceTime HD Camera'} {'id': 1, 'width': 1920, 'height': 1080, 'fps': 30, 'name': 'iPhone Camera'}- Seealso: