HOW TO USE WINDOWS DOS TO LIST WEB CAMs

Instead of looping using this call

cap = cv2.VideoCapture(index)
    if not cap.read()[0]:

I wish there is alternative approach to list cameras on the USB just like in linux base architecture where I could use the attached bash script to return list of camera on the USBs.


#python !/bin/bash

if [[ $# -eq 0 ]]
then
    for device in /sys/class/video4Linux/*
    do
        declare devpath="dev/$(basename $device)"
        read name <$device/name
        echo "$devpath => $name"
        done
    exit 0
fi

I search and so far I am yet to get any useful approach to use dos in windows.
Does anyone know of a link or approach in handling this?

Is it relative to opencv or shell in windows?

there is no “DOS” on Windows. Hasn’t been since consumer Windows became NT-based (Windows 2000).

You are correct in that OpenCV does not have an API to list video devices. If you want that, file an issue on the github.

The application I am working uses opencv, but i wish to run a shell search for the cameras and pass the return list to the opencv application.
In the linux, it is already working as I want since i can invloke video4Linux to do the search

Okay, I was actually refering to window command promt terminal :smiley: