Commit 7463ec3a authored by Salamandar's avatar Salamandar
Browse files

Fix and rename list_available_cameras

parent 580f1578
......@@ -58,15 +58,16 @@ rectangleColorSuspicious = RED
SUSPICIOUS_THRESHOLD = 2
# Get the number of cameras available
def count_cameras():
max_tested = 10
for i in range(max_tested):
def list_available_cameras():
cameras = []
for i in range(10):
temp_camera = cv2.VideoCapture(i)
if temp_camera.isOpened():
temp_camera.release()
continue
yield i
cameras.append(i)
print("Found cameras:", cameras)
return cameras
class facetracker:
......@@ -618,8 +619,8 @@ class facetracker:
return color
if __name__ == '__main__':
for value in count_cameras():
camera = facetracker(value)
for camera_id in list_available_cameras():
camera = facetracker(camera_id)
camera.detectAndTrackMultipleFaces(
# False: Names are directly printed on screen, no new thread
start_thread = False,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment