Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why do you want to use any other numbers ? if it works only with '0' means that '0' is the ID that the system has assigned to your camera in that moment.

Another story is to check if different API backend works better or gives you more controls (more available properties) via VideoCapture.get(). e.g. you could try

cap = cv2.VideoCapture(0+cv2.CAP_DSHOW)
if cap.isOpened() == False:
    print('ERROR: Unable to open the camera')
else:
    # this pop ups the driver settings form only with DSHOW
    cap.set(cv2.CAP_PROP_SETTINGS,-1)

other backends are CAP_MSMF and CAP_VFW . VFW is default on Windows, others have to be enabled in your OpenCV binary.

Why do you want to use any other numbers ? if it works only with '0' means that '0' is the ID that the system has assigned to your camera in that moment.

Another story is to check if different API backend works better or gives you more controls (more available properties) via VideoCapture.get(). e.g. you could try

cap = cv2.VideoCapture(0+cv2.CAP_DSHOW)
if cap.isOpened() == False:
    print('ERROR: Unable to open the camera')
else:
    # this pop ups the driver settings form only with DSHOW
    cap.set(cv2.CAP_PROP_SETTINGS,-1)

other backends backends on Windows are CAP_MSMF and CAP_VFW . VFW is default on Windows, others have to be enabled in your OpenCV binary.binary via CMake.