You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
428 B

import cv2
def detect_cameras(max_cameras=10):
cameras = []
for i in range(max_cameras):
cap = cv2.VideoCapture(i)
if cap is None or not cap.isOpened():
cap.release()
else:
cameras.append(i)
cap.release()
return cameras
# available_cameras = detect_cameras()
# print(f'Found {len(available_cameras)} camera(s): {available_cameras}'
print(cv2.__version__)