Skip to content
Snippets Groups Projects
Commit c76ea2c6 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

fix install stuff

parent dfbc9801
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -12,9 +12,9 @@ def compute_mean_rgb(image, mask=None):
Parameters
----------
image: 3d numpy array
image: numpy.ndarray
The image to process
mask: 2d boolen numpy array
mask: numpy.ndarray
Mask of the size of the image, telling which pixels
should be considered
......@@ -40,9 +40,9 @@ def compute_gray_diff(previous, current):
Parameters
----------
previous: 3d numpy array
previous: numpy.ndarray
The previous frame.
current: 3d numpy array
current: numpy.ndarray
The current frame.
Returns
......@@ -65,7 +65,7 @@ def select_stable_frames(diff, n):
Parameters
----------
diff: 1d numpy array
diff: numpy.ndarray
The sum of absolute pixel intensity differences between
consecutive frames, across the whole sequence.
n: int
......
#!/usr/bin/env python
# encoding: utf-8
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>,
#
# This file is part of bob.rpgg.base.
#
# bob.rppg.base is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# bob.rppg.base is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>.
"""Pulse extraction for database videos (%(version)s)
Usage:
......
#!/usr/bin/env python
# encoding: utf-8
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>,
#
# This file is part of bob.rpgg.base.
#
# bob.rppg.base is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# bob.rppg.base is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>.
'''Skin color extraction for database videos (%(version)s)
"""Skin color extraction for database videos (%(version)s)
Usage:
%(prog)s (cohface | hci) [--protocol=<string>] [--subset=<string> ...]
[--verbose ...] [--plot]
[--dbdir=<path>] [--outdir=<path>] [--limit=<int>]
[--dbdir=<path>] [--outdir=<path>]
[--overwrite] [--threshold=<float>] [--skininit]
[--gridcount]
......@@ -43,7 +26,6 @@ Options:
-D, --dbdir=<path> The path to the database on your disk. If not set,
defaults to Idiap standard locations.
-o, --outdir=<path> Where the skin color will be stored [default: skin].
-l, --limit=<int> Limits the processing to the first N videos of the
database (for testing purposes)
-O, --overwrite By default, we don't overwrite existing files. The
processing will skip those so as to go faster. If you
......@@ -54,7 +36,6 @@ Options:
Examples:
To run the skin color extraction on the hci database
......@@ -72,16 +53,16 @@ Examples:
See '%(prog)s --help' for more information.
'''
"""
from __future__ import print_function
import os
import sys
import pkg_resources
import logging
__logging_format__='[%(levelname)s] %(message)s'
logging.basicConfig(format=__logging_format__)
logger = logging.getLogger("extract_log")
from bob.core.log import set_verbosity_level
from bob.core.log import setup
logger = setup("bob.rppg.base")
from docopt import docopt
......@@ -103,19 +84,11 @@ def main(user_input=None):
arguments = sys.argv[1:]
prog = os.path.basename(sys.argv[0])
completions = dict(
prog=prog,
version=version,
)
args = docopt(
__doc__ % completions,
argv=arguments,
version='Skin color extraction for videos (%s)' % version,
)
completions = dict(prog=prog, version=version,)
args = docopt(__doc__ % completions, argv=arguments, version='Signal extractor for videos (%s)' % version,)
# if the user wants more verbosity, lowers the logging level
if args['--verbose'] == 1: logging.getLogger().setLevel(logging.INFO)
elif args['--verbose'] >= 2: logging.getLogger().setLevel(logging.DEBUG)
set_verbosity_level(logger, args['--verbose'])
# chooses the database driver to use
if args['cohface']:
......@@ -153,21 +126,22 @@ def main(user_input=None):
sys.exit()
objects = db.objects(args['--protocol'], args['--subset'])
# tells the number of grid objects, and exit
if args['--gridcount']:
print len(objects)
sys.exit()
# if we are on a grid environment, just find what I have to process.
if os.environ.has_key('SGE_TASK_ID'):
sge = False
try:
sge = os.environ.has_key('SGE_TASK_ID') # python2
except AttributeError:
sge = 'SGE_TASK_ID' in os.environ # python3
if sge:
pos = int(os.environ['SGE_TASK_ID']) - 1
if pos >= len(objects):
raise RuntimeError, "Grid request for job %d on a setup with %d jobs" % \
(pos, len(objects))
raise RuntimeError("Grid request for job {} on a setup with {} jobs".format(pos, len(objects)))
objects = [objects[pos]]
else: #maybe the user wants to limit the total amount of videos for testing
if args['--limit']: objects = objects[:int(args['--limit'])]
if args['--gridcount']:
print(len(objects))
sys.exit()
# does the actual work - for every video in the available dataset,
# extract the average color in both the mask area and in the backround,
......
......@@ -32,7 +32,6 @@ setup(
entry_points={
'console_scripts': [
'rppg_bbox.py = bob.rppg.base.script.extract_boundingboxes:main',
'cvpr14_extract_signals.py = bob.rppg.cvpr14.script.extract_signals:main',
'cvpr14_video2skin.py = bob.rppg.cvpr14.script.video2skin:main',
'cvpr14_illumination.py = bob.rppg.cvpr14.script.illumination_rectification:main',
......
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