yasserrmd commited on
Commit
8a4dc7e
1 Parent(s): f5586b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -30,6 +30,15 @@ def categorize_activity(detected_objects):
30
 
31
  return categorized_activities
32
 
 
 
 
 
 
 
 
 
 
33
  # Function to process the video, detect objects, and generate a categorized journal with images
34
  @spaces.GPU
35
  def generate_journal_with_images(video_path, frame_interval=30):
 
30
 
31
  return categorized_activities
32
 
33
+
34
+ # Function to compare frames using SSIM to avoid repeated frames
35
+ def is_frame_different(frame1, frame2, threshold=0.9):
36
+ gray_frame1 = cv2.cvtColor(frame1, cv2.COLOR_BGR2GRAY)
37
+ gray_frame2 = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)
38
+ score, _ = ssim(gray_frame1, gray_frame2, full=True)
39
+ return score < threshold
40
+
41
+
42
  # Function to process the video, detect objects, and generate a categorized journal with images
43
  @spaces.GPU
44
  def generate_journal_with_images(video_path, frame_interval=30):