From 33a502f60943a16eb57e0061b4d6791186013ada Mon Sep 17 00:00:00 2001 From: Mehrab Shahbazi Date: Wed, 1 Jan 2025 12:29:20 +0330 Subject: [PATCH] video path is enabled in stream --- deepface/modules/streaming.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deepface/modules/streaming.py b/deepface/modules/streaming.py index cc44783..3f16f82 100644 --- a/deepface/modules/streaming.py +++ b/deepface/modules/streaming.py @@ -22,6 +22,7 @@ os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" IDENTIFIED_IMG_SIZE = 112 TEXT_COLOR = (255, 255, 255) + # pylint: disable=unused-variable def analysis( db_path: str, @@ -82,7 +83,11 @@ def analysis( num_frames_with_faces = 0 tic = time.time() - cap = cv2.VideoCapture(source) # webcam + # If source is an integer, use it as a webcam index. Otherwise, treat it as a video file path. + if isinstance(source, int): + cap = cv2.VideoCapture(source) # webcam + else: + cap = cv2.VideoCapture(str(source)) # video file while True: has_frame, img = cap.read() if not has_frame: