Commit 6218bad0 authored by Sushil BHATTACHARJEE's avatar Sushil BHATTACHARJEE
Browse files

level2 now determines video file type automatically, like in other databases

parent b3f21388
......@@ -203,7 +203,7 @@ def add_command(subparsers):
parser.add_argument('-v', '--verbose', action='count', default=0,
help="Do SQL operations in a verbose way")
parser.add_argument('-D', '--protodir', action='store',
default='/idiap/group/replay/database/protocols/replayattack-database/protocols',
default='/idiap/group/biometric/databases/replay/protocols/replayattack-database/protocols', #'/idiap/group/replay/database/protocols/replayattack-database/protocols',
metavar='DIR',
help="Change the relative path to the directory containing the protocol definitions for replay attacks (defaults to %(default)s)")
......
......@@ -15,6 +15,8 @@ from sqlalchemy.orm import backref
from sqlalchemy.ext.declarative import declarative_base
import numpy
import bob
import bob.io.video
Base = declarative_base()
......@@ -165,7 +167,7 @@ class File(Base):
raise RuntimeError("%s is not an attack" % self)
return self.attack[0]
def load(self, directory=None, extension='.hdf5'):
def load(self, directory=None, extension=None):
"""Loads the data at the specified location and using the given extension.
Keyword parameters:
......@@ -181,7 +183,19 @@ class File(Base):
[optional] The extension of the filename - this will control the type of
output and the codec for saving the input blob.
"""
return bob.io.base.load(self.make_path(directory, extension))
if extension is None:
extension = '.mov'
print 'replaydb::models.py()::load::extension', extension
vfn = self.make_path(directory, extension)
print 'file to load:', vfn
if extension == '.mov':
video = bob.io.video.reader(self.make_path(directory, extension))
vin = video.load()
else:
vin = bob.io.base.load(self.make_path(directory, extension))
return vin #bob.io.base.load(self.make_path(directory, extension))
def save(self, data, directory=None, extension='.hdf5'):
"""Saves the input data at the specified location and using the given
......
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