Skip to content
Snippets Groups Projects
Commit 1d9329ac authored by Olegs NIKISINS's avatar Olegs NIKISINS
Browse files

Merge branch 'pad-file' into 'master'

Use all frames. Improve docs

See merge request !30
parents 4501b21a 2d9a724d
No related branches found
No related tags found
1 merge request!30Use all frames. Improve docs
Pipeline #
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))
......@@ -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
......
......@@ -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
......
......@@ -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)
#==============================================================================
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment