diff --git a/bob/pad/face/database/database.py b/bob/pad/face/database/database.py index 5d029071f585acdb20d7169e63ceda7f928ad946..8f88445f8d0ff4614ddd6d8d24fffde186bfa1b3 100644 --- a/bob/pad/face/database/database.py +++ b/bob/pad/face/database/database.py @@ -1,23 +1,36 @@ from bob.pad.base.database import PadFile -from bob.bio.video.database import VideoBioFile +import bob.bio.video -class VideoPadFile(VideoBioFile, PadFile): +class VideoPadFile(PadFile): """A simple base class that defines basic properties of File object for the - use in PAD experiments + use in face PAD experiments. """ def __init__(self, attack_type, client_id, path, file_id=None): - VideoBioFile.__init__( - self, - client_id=client_id, - path=path, - file_id=file_id, - ) - PadFile.__init__( - self, + super(VideoPadFile, self).__init__( attack_type=attack_type, client_id=client_id, path=path, file_id=file_id, ) + + def load(self, directory=None, extension='.avi', + frame_selector=bob.bio.video.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. + """ + return frame_selector(self.make_path(directory, extension)) diff --git a/bob/pad/face/database/mifs.py b/bob/pad/face/database/mifs.py index d66cc4af01c0f568ac88102914c3e6e906a38eff..2b77f19e1e2e2ac03e80ac79c739760c0bef8880 100644 --- a/bob/pad/face/database/mifs.py +++ b/bob/pad/face/database/mifs.py @@ -41,6 +41,9 @@ class MIFSPadFile(VideoPadFile): Extension of the video files in the MIFS database. Default: None + ``frame_selector`` : ``FrameSelector`` + The frame selector to use. + **Returns:** ``video_data`` : FrameContainer diff --git a/bob/pad/face/database/msu_mfsd.py b/bob/pad/face/database/msu_mfsd.py index 6783d888873c33b3573f4fac6d2955216632d87e..80e8ab5232d53e88a980665e5680a6f1e7413144 100644 --- a/bob/pad/face/database/msu_mfsd.py +++ b/bob/pad/face/database/msu_mfsd.py @@ -66,6 +66,9 @@ class MsuMfsdPadFile(VideoPadFile): Note: ``extension`` value is not used in the code of this method. Default: None + ``frame_selector`` : ``FrameSelector`` + The frame selector to use. + **Returns:** ``video_data`` : FrameContainer diff --git a/bob/pad/face/database/replay.py b/bob/pad/face/database/replay.py index 8a9ff58faa62266434d5053bf76460fbd9cd1b5f..f998848767d7bf20a222396493eb2195e93d05da 100644 --- a/bob/pad/face/database/replay.py +++ b/bob/pad/face/database/replay.py @@ -48,32 +48,9 @@ class ReplayPadFile(VideoPadFile): attack_type=attack_type, file_id=f.id) - #========================================================================== - def load(self, directory=None, extension='.mov', frame_selector=FrameSelector(selection_style='all')): - """ - Overridden version of the load method defined in the ``VideoPadFile``. - - **Parameters:** - - ``directory`` : :py:class:`str` - String containing the path to the Replay database. - - ``extension`` : :py:class:`str` - Extension of the video files in the Replay database. - - **Returns:** - - ``video_data`` : FrameContainer - Video data stored in the FrameContainer, see ``bob.bio.video.utils.FrameContainer`` - for further details. - """ - - path = self.f.make_path( - directory=directory, extension=extension) # path to the video file - - video_data = frame_selector(path) # video data - - return video_data # video data + def make_path(self, directory=None, extension='.mov'): + # path to the video file + return self.f.make_path(directory=directory, extension=extension) #============================================================================== diff --git a/bob/pad/face/database/replay_mobile.py b/bob/pad/face/database/replay_mobile.py index 75c23b7a51c9dff08e61c1d4a61da5a5dcc9ce98..82f8444a443e927779aa55ae063d6fdd730e4579 100644 --- a/bob/pad/face/database/replay_mobile.py +++ b/bob/pad/face/database/replay_mobile.py @@ -59,6 +59,9 @@ class ReplayMobilePadFile(VideoPadFile): ``extension`` : :py:class:`str` Extension of the video files in the Replay-Mobile database. + ``frame_selector`` : ``FrameSelector`` + The frame selector to use. + **Returns:** ``video_data`` : FrameContainer