Apply suggestions from code review of branch opencv-camera-switcher
This commit is contained in:
parent
9e48f13d6f
commit
2fee313d42
1 changed files with 3 additions and 1 deletions
|
|
@ -27,6 +27,8 @@ elif sys.platform == "darwin":
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(f"Unsupported platform {sys.platform}")
|
raise RuntimeError(f"Unsupported platform {sys.platform}")
|
||||||
|
|
||||||
|
# Max cameras is set to balance finding all cameras with not taking too long to start up.
|
||||||
|
# Note that due to extra camera modes in Linux 1 camera can take up multiple camera numbers.
|
||||||
MAX_CAMERAS = 12
|
MAX_CAMERAS = 12
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -44,7 +46,7 @@ def find_all_cameras() -> list[int]:
|
||||||
|
|
||||||
def identify_cameras(camera_ids: list[int]) -> dict[str, int]:
|
def identify_cameras(camera_ids: list[int]) -> dict[str, int]:
|
||||||
"""For a list of camera IDs return a dictionary of name -> ID."""
|
"""For a list of camera IDs return a dictionary of name -> ID."""
|
||||||
# When first creating the mapping the mapping with default names it goes from
|
# When first creating the mapping with default names it goes from
|
||||||
# id -> camera name. This makes it easy to replace the name (based on a fixed camera
|
# id -> camera name. This makes it easy to replace the name (based on a fixed camera
|
||||||
# id as the key) if the name is then found.
|
# id as the key) if the name is then found.
|
||||||
# Before returning this is swapped to be a mapping from camera name -> id. As this
|
# Before returning this is swapped to be a mapping from camera name -> id. As this
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue