Commit 201de0c0 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Fix loading of videos

parent c4f06b78
Pipeline #26003 failed with stages
in 17 minutes and 24 seconds
from pkg_resources import resource_filename
from bob.pad.base.database import FileListPadDatabase
from bob.pad.face.database import VideoPadFile
from bob.bio.video import FrameSelector
from bob.extension import rc
from bob.io.video import reader
from . import OULUNPU_FRAME_SHAPE
......@@ -72,6 +73,29 @@ class File(VideoPadFile):
}
return annotations
def load(self, directory=None, extension='.avi',
frame_selector=FrameSelector(selection_style='all')):
"""Loads the video file and returns in a
:any:`bob.bio.video.FrameContainer`.
Parameters
----------
directory : :obj:`str`, optional
The directory to load the data from.
extension : :obj:`str`, optional
The extension of the file to load.
frame_selector : :any:`bob.bio.video.FrameSelector`, optional
Which frames to select.
Returns
-------
:any:`bob.bio.video.FrameContainer`
The loaded frames inside a frame container.
"""
directory = directory or self.original_directory
extension = extension or self.original_extension
return frame_selector(self.make_path(directory, extension))
class Database(FileListPadDatabase):
"""The database interface for the OULU-NPU dataset."""
......@@ -97,6 +121,7 @@ class Database(FileListPadDatabase):
model_ids=model_ids, classes=classes, **kwargs)
for f in files:
f.original_directory = self.original_directory
f.original_extension = self.original_extension
return files
def frames(self, padfile):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment