MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / get_num_frames

Method get_num_frames

monai/data/video_dataset.py:187–197  ·  view source on GitHub ↗

Return the number of frames in a video file. Raises: RuntimeError: no frames found.

(self)

Source from the content-addressed store, hash-verified

185 return codecs
186
187 def get_num_frames(self) -> int:
188 """
189 Return the number of frames in a video file.
190
191 Raises:
192 RuntimeError: no frames found.
193 """
194 num_frames = int(self._get_cap().get(cv2.CAP_PROP_FRAME_COUNT))
195 if num_frames == 0:
196 raise RuntimeError("0 frames found")
197 return num_frames
198
199 def __len__(self):
200 return self.max_num_frames

Callers 2

__init__Method · 0.95
test_datasetMethod · 0.80

Calls 2

getMethod · 0.80
_get_capMethod · 0.80

Tested by 1

test_datasetMethod · 0.64