Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to count how many cameras you have with python

import cv2

def camera_amount():
    '''Returns int value of available camera devices connected to the host device'''
    camera = 0
    while True:
        if (cv2.VideoCapture(camera).grab()) is True:
            camera = camera + 1
        else:
            cv2.destroyAllWindows()
            return(int(camera))
 
PREVIOUS NEXT
Tagged: #count #cameras #python
ADD COMMENT
Topic
Name
2+4 =