Skip to content

Commit

Permalink
video path is enabled in stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehrab-Shahbazi committed Jan 1, 2025
1 parent ca6afd9 commit 33a502f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion deepface/modules/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
IDENTIFIED_IMG_SIZE = 112
TEXT_COLOR = (255, 255, 255)


# pylint: disable=unused-variable
def analysis(
db_path: str,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 33a502f

Please sign in to comment.