reab5555 commited on
Commit
944ef0c
·
verified ·
1 Parent(s): fdd165a

Update video_processing.py

Browse files
Files changed (1) hide show
  1. video_processing.py +4 -1
video_processing.py CHANGED
@@ -120,10 +120,11 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
120
 
121
  progress(1, "Frame extraction complete")
122
  progress(0.3, "Processing frames")
123
- embeddings_by_frame, posture_scores_by_frame, posture_landmarks_by_frame, aligned_face_paths = process_frames(
124
  frames_folder, aligned_faces_folder,
125
  frame_count,
126
  progress)
 
127
 
128
  if not aligned_face_paths:
129
  raise ValueError("No faces were extracted from the video.")
@@ -209,6 +210,8 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
209
  face_img = cv2.imread(face_path)
210
  if face_img is not None:
211
  face_img = cv2.cvtColor(face_img, cv2.COLOR_BGR2RGB)
 
 
212
  timecode = df[df['Frame'] == frame]['Timecode'].iloc[0]
213
  face_img_with_timecode = add_timecode_to_image(face_img, timecode)
214
  anomaly_faces_embeddings.append(face_img_with_timecode)
 
120
 
121
  progress(1, "Frame extraction complete")
122
  progress(0.3, "Processing frames")
123
+ embeddings_by_frame, posture_scores_by_frame, posture_landmarks_by_frame, aligned_face_paths, facial_landmarks_by_frame = process_frames(
124
  frames_folder, aligned_faces_folder,
125
  frame_count,
126
  progress)
127
+
128
 
129
  if not aligned_face_paths:
130
  raise ValueError("No faces were extracted from the video.")
 
210
  face_img = cv2.imread(face_path)
211
  if face_img is not None:
212
  face_img = cv2.cvtColor(face_img, cv2.COLOR_BGR2RGB)
213
+ if frame in facial_landmarks_by_frame:
214
+ face_img = draw_facial_landmarks(face_img, facial_landmarks_by_frame[frame])
215
  timecode = df[df['Frame'] == frame]['Timecode'].iloc[0]
216
  face_img_with_timecode = add_timecode_to_image(face_img, timecode)
217
  anomaly_faces_embeddings.append(face_img_with_timecode)