Skip to content

Commit 364af05

Browse files
committed
fixed ug in sample_frames (vdh) ...
* it sometimes includes last+1 frame due to rounding errors * related to clamsproject/app-swt-detection#126
1 parent e776810 commit 364af05

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mmif/utils/video_document_helper.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ def sample_frames(start_frame: int, end_frame: int, sample_rate: float = 1) -> L
205205
frame_nums: List[int] = []
206206
cur_f = start_frame
207207
while cur_f < end_frame:
208-
frame_nums.append(math.ceil(cur_f))
208+
ceiling = math.ceil(cur_f)
209+
if ceiling < end_frame:
210+
frame_nums.append(math.ceil(cur_f))
209211
cur_f += sample_rate
210212
return frame_nums
211213

0 commit comments

Comments
 (0)