15 lines
327 B
Python
15 lines
327 B
Python
import cv2
|
|
|
|
def list_cameras():
|
|
index = 0
|
|
cameras = []
|
|
while True:
|
|
cap = cv2.VideoCapture(index)
|
|
if not cap.read()[0]:
|
|
break
|
|
cameras.append(f"Camera {index}: {cap.getBackendName()}")
|
|
cap.release()
|
|
index += 1
|
|
return cameras
|
|
|
|
print(list_cameras()) |