bunkahle / pygrabber

Python tool to capture photo from camera and for doing simple image processing using DirectShow and OpenCV
MIT License
17 stars 5 forks source link

Does not display proper index when two cameras are mounted with the same name #4

Open sampras-intel opened 2 years ago

sampras-intel commented 2 years ago
  1. Two webcams with same name are mounted onto Windows system.
  2. Using OpenCV I am able to differentiate them as Index 1 & 2 respectively
  3. On using FilterGraph().get_input_devices().index("Camera Name") it always returns the first index and does not access the second camera at all.
    from pygrabber.dshow_graph import FilterGraph
    graph = FilterGraph()
    print(graph.get_input_devices())
    # Output = ['HP HD Camera', 'C270 HD WEBCAM', 'C270 HD WEBCAM']
    device_index = graph.get_input_devices().index("C270 HD WEBCAM")
    print(device_index)
    # Output = 1

How do I get the index of the other camera with the same name?