Update visualization.py
Browse files- visualization.py +2 -6
visualization.py
CHANGED
@@ -291,8 +291,6 @@ def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_v
|
|
291 |
seconds = t
|
292 |
timecode = f"{int(seconds//3600):02d}:{int((seconds%3600)//60):02d}:{int(seconds%60):02d}"
|
293 |
|
294 |
-
# We'll use PIL for text as it's easier to work with in this context
|
295 |
-
from PIL import Image, ImageDraw, ImageFont
|
296 |
pil_img = Image.fromarray(combined_frame)
|
297 |
draw = ImageDraw.Draw(pil_img)
|
298 |
font = ImageFont.load_default()
|
@@ -301,7 +299,7 @@ def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_v
|
|
301 |
return np.array(pil_img)
|
302 |
|
303 |
# Create the final video
|
304 |
-
final_clip =
|
305 |
final_clip = final_clip.set_duration(video.duration)
|
306 |
|
307 |
# Write the final video
|
@@ -317,6 +315,4 @@ def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_v
|
|
317 |
return heatmap_video_path
|
318 |
else:
|
319 |
print(f"Failed to create heatmap video at: {heatmap_video_path}")
|
320 |
-
return None
|
321 |
-
|
322 |
-
|
|
|
291 |
seconds = t
|
292 |
timecode = f"{int(seconds//3600):02d}:{int((seconds%3600)//60):02d}:{int(seconds%60):02d}"
|
293 |
|
|
|
|
|
294 |
pil_img = Image.fromarray(combined_frame)
|
295 |
draw = ImageDraw.Draw(pil_img)
|
296 |
font = ImageFont.load_default()
|
|
|
299 |
return np.array(pil_img)
|
300 |
|
301 |
# Create the final video
|
302 |
+
final_clip = video.fl_image(make_frame)
|
303 |
final_clip = final_clip.set_duration(video.duration)
|
304 |
|
305 |
# Write the final video
|
|
|
315 |
return heatmap_video_path
|
316 |
else:
|
317 |
print(f"Failed to create heatmap video at: {heatmap_video_path}")
|
318 |
+
return None
|
|
|
|