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.

21 lines
486 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}'
image = cv2.imread("nst/ori/1.jpg")
cv2.imshow("Image", image)
cv2.waitKey(0)