Expected behaviour
Assuming 2 cameras (also gives the error if only one camera):
C:\Users\Dave\data\Code\Python\VideoCapture>python3 test.py
Found camera 0
Found camera 1
Actual behaviour
C:\Users\Dave\data\Code\Python\VideoCapture>python3 test.py
Found camera 0
[ WARN:0] terminating async callback
Found camera 1
[ WARN:0] terminating async callback
Steps to reproduce
import cv2
def countCameras():
"""Returns count of found cameras (not opened yet).
Brute force - just tries them all till it fails."""
camCount = 0
while True:
cam = cv2.VideoCapture(camCount)
if cam.isOpened():
print("Found camera", camCount)
cam.release()
camCount += 1
else:
return camCount
countCameras()
Windows 10 Pro
x64
cv2.version == '4.1.0'
Expected behaviour
Assuming 2 cameras (also gives the error if only one camera):
Actual behaviour
Steps to reproduce
Windows 10 Pro
x64
cv2.version == '4.1.0'