Skip to content

Commit

Permalink
fixed ug in sample_frames (vdh) ...
Browse files Browse the repository at this point in the history
* it sometimes includes last+1 frame due to rounding errors
* related to clamsproject/app-swt-detection#126
  • Loading branch information
keighrim committed Feb 3, 2025
1 parent e776810 commit 364af05
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mmif/utils/video_document_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ def sample_frames(start_frame: int, end_frame: int, sample_rate: float = 1) -> L
frame_nums: List[int] = []
cur_f = start_frame
while cur_f < end_frame:
frame_nums.append(math.ceil(cur_f))
ceiling = math.ceil(cur_f)
if ceiling < end_frame:
frame_nums.append(math.ceil(cur_f))
cur_f += sample_rate
return frame_nums

Expand Down

0 comments on commit 364af05

Please sign in to comment.