@@ -102,7 +102,7 @@ def extract_frames_as_images(video_document: Document, framenums: List[int], as_
102
102
103
103
def get_mid_framenum (mmif : Mmif , time_frame : Annotation ) -> int :
104
104
warnings .warn ('This function is deprecated. Use ``get_representative_framenums()`` instead.' , DeprecationWarning , stacklevel = 2 )
105
- _get_mid_framenum (mmif , time_frame )
105
+ return _get_mid_framenum (mmif , time_frame )
106
106
107
107
108
108
def _get_mid_framenum (mmif : Mmif , time_frame : Annotation ) -> int :
@@ -116,7 +116,7 @@ def _get_mid_framenum(mmif: Mmif, time_frame: Annotation) -> int:
116
116
timeunit = time_frame .get_property ('timeUnit' )
117
117
video_document = mmif [time_frame .get_property ('document' )]
118
118
fps = get_framerate (video_document )
119
- return convert (time_frame .get_property ('start' ) + time_frame .get_property ('end' ), timeunit , 'frame' , fps ) // 2
119
+ return int ( convert (time_frame .get_property ('start' ) + time_frame .get_property ('end' ), timeunit , 'frame' , fps ) // 2 )
120
120
121
121
122
122
def extract_mid_frame (mmif : Mmif , time_frame : Annotation , as_PIL : bool = False ):
@@ -159,7 +159,7 @@ def get_representative_framenums(mmif: Mmif, time_frame: Annotation) -> List[int
159
159
rep_anno = mmif [rep_long_id ]
160
160
except KeyError :
161
161
raise ValueError (f'Representative timepoint { rep_long_id } not found in any view.' )
162
- ref_frams .append (convert (rep_anno .get_property ('timePoint' ), timeunit , 'frame' , fps ))
162
+ ref_frams .append (int ( convert (rep_anno .get_property ('timePoint' ), timeunit , 'frame' , fps ) ))
163
163
return ref_frams
164
164
165
165
@@ -185,7 +185,7 @@ def extract_representative_frame(mmif: Mmif, time_frame: Annotation, as_PIL: boo
185
185
:return: frame as a :py:class:`numpy.ndarray` or :py:class:`PIL.Image.Image`
186
186
"""
187
187
video_document = mmif [time_frame .get_property ('document' )]
188
- rep_frame_num = [get_representative_framenum (mmif , time_frame )] if first_only else : get_representative_framenums (mmif , time_frame )
188
+ rep_frame_num = [get_representative_framenum (mmif , time_frame )] if first_only else get_representative_framenums (mmif , time_frame )
189
189
return extract_frames_as_images (video_document , rep_frame_num , as_PIL = as_PIL )[0 ]
190
190
191
191
0 commit comments