diff --git a/MANIFEST.in b/MANIFEST.in index a619f4727691d71512a6a5b6825916f569f36eba..c1a9ce096f8f9b14b108af0a240421be5b013577 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include README.rst buildout.cfg develop.cfg COPYING version.txt requirements.txt recursive-include doc *.py *.rst *.ico *.png -recursive-include scripts-article *.py *.rst +recursive-include bob/rppg/base/data *.jpg *.face diff --git a/bob/rppg/ssr/script/data/001.face b/bob/rppg/base/data/001.face similarity index 100% rename from bob/rppg/ssr/script/data/001.face rename to bob/rppg/base/data/001.face diff --git a/bob/rppg/ssr/script/data/001.jpg b/bob/rppg/base/data/001.jpg similarity index 100% rename from bob/rppg/ssr/script/data/001.jpg rename to bob/rppg/base/data/001.jpg diff --git a/bob/rppg/chrom/script/test.py b/bob/rppg/chrom/script/test.py index 7f7e2eddac7308c29c7d29c45e63df3e63447909..3a9b884f07ed04d233aa75eece804bdbd1371143 100644 --- a/bob/rppg/chrom/script/test.py +++ b/bob/rppg/chrom/script/test.py @@ -89,4 +89,4 @@ def test_project_chrominance(): r = g = b = 1 x,y = project_chrominance(r, g, b) assert x == 1.0 - assert y == 4.0 + assert y == 1.0 diff --git a/bob/rppg/cvpr14/script/test.py b/bob/rppg/cvpr14/script/test.py index 44cb0137ffc42562c25e106722938e9c832b5376..f2b594798c6fd0435a812e98fb0e2a387d8d09e8 100644 --- a/bob/rppg/cvpr14/script/test.py +++ b/bob/rppg/cvpr14/script/test.py @@ -94,10 +94,10 @@ def test_gftt(): from bob.rppg.cvpr14.extract_utils import get_good_features_to_track corners = get_good_features_to_track(image, 4) - assert numpy.array_equal(corners[0][0], numpy.array([20.0,20.0])), "1st corner" - assert numpy.array_equal(corners[1][0], numpy.array([79.0,20.0])), "2nd corner" - assert numpy.array_equal(corners[2][0], numpy.array([20.0,79.0])), "3rd corner" - assert numpy.array_equal(corners[3][0], numpy.array([79.0,79.0])), "4th corner" + assert numpy.array_equal(corners[0][0], numpy.array([79.0,79.0])), "1st corner" + assert numpy.array_equal(corners[1][0], numpy.array([20.0,79.0])), "2nd corner" + assert numpy.array_equal(corners[2][0], numpy.array([79.0,20.0])), "3rd corner" + assert numpy.array_equal(corners[3][0], numpy.array([20.0,20.0])), "4th corner" @opencv_available @@ -118,10 +118,10 @@ def test_track_features(): from bob.rppg.cvpr14.extract_utils import track_features points2 = track_features(image1, image2, points1) points2 = numpy.rint(points2) - assert numpy.array_equal(points2[0][0], numpy.array([21,21])), "1st corner" - assert numpy.array_equal(points2[1][0], numpy.array([80,21])), "2nd corner" - assert numpy.array_equal(points2[2][0], numpy.array([21,80])), "3rd corner" - assert numpy.array_equal(points2[3][0], numpy.array([80,80])), "4th corner" + assert numpy.array_equal(points2[0][0], numpy.array([80,80])), "1st corner" + assert numpy.array_equal(points2[1][0], numpy.array([21,80])), "2nd corner" + assert numpy.array_equal(points2[2][0], numpy.array([80,21])), "3rd corner" + assert numpy.array_equal(points2[3][0], numpy.array([21,21])), "4th corner" @opencv_available diff --git a/bob/rppg/ssr/script/test.py b/bob/rppg/ssr/script/test.py index d3ae2013348274a00684aa9af17ae3d41571887b..fcac41644ec460c853eba4b7f907d9dfb379afb2 100644 --- a/bob/rppg/ssr/script/test.py +++ b/bob/rppg/ssr/script/test.py @@ -1,29 +1,15 @@ #!/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/>. - import nose.tools import pkgutil import os, sys import numpy import functools +from bob.io.base.test_utils import datafile +from bob.io.base import load + def test_get_skin_pixels(): """ @@ -36,13 +22,7 @@ def test_get_skin_pixels(): mod = sys.modules.get(__name__) or loader.load_module(__name__) # load face image - face_file = 'data/001.jpg' - parts = face_file.split('/') - parts.insert(0, os.path.dirname(mod.__file__)) - face_name = os.path.join(*parts) - import bob.io.base - import bob.io.image - face = bob.io.base.load(face_name) + face = load(datafile('001.jpg', 'bob.rppg.base')) from bob.rppg.ssr.ssr_utils import get_skin_pixels @@ -65,13 +45,7 @@ def test_get_eigen(): """ Test the computation of eigenvalues and eigenvector """ - a = numpy.array([[1, 0], [0, 1]]) - from bob.rppg.ssr.ssr_utils import get_eigen - evals, evecs = get_eigen(a) - assert numpy.all(evals == numpy.array([0, 0])) - assert numpy.all(evecs == numpy.array([[0, 1], [1, 0]])) - a = numpy.array([[0, 0], [0, 0]]) evals, evecs = get_eigen(a) assert numpy.all(evals == numpy.array([0, 0])) diff --git a/bob/rppg/ssr/ssr_utils.py b/bob/rppg/ssr/ssr_utils.py index 63601aa6f162cc783927eb0b0ed283cabeebe32f..f14dc1fd50c74738878222d98c59058f56c835aa 100644 --- a/bob/rppg/ssr/ssr_utils.py +++ b/bob/rppg/ssr/ssr_utils.py @@ -86,7 +86,7 @@ def get_eigen(skin_pixels): """ # build the correlation matrix c = numpy.dot(skin_pixels, skin_pixels.T) - c /= skin_pixels.shape[1] + c = c / skin_pixels.shape[1] # get eigenvectors and sort them according to eigenvalues (largest first) evals, evecs = numpy.linalg.eig(c) diff --git a/conda/meta.yaml b/conda/meta.yaml index 445f5161f1f8e793fb214fa14de213970a53fc85..e21345e710a36bb237ac4337ea6084a58d8ea73c 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -66,7 +66,7 @@ test: - bob_rppg_ssr_pulse_from_mask.py --help - bob_rppg_base_get_heart_rate.py --help - bob_rppg_base_compute_performance.py --help - - nosetests --with-coverage --cover-package={{ name }} -sv {{ name }} + - nosetests --with-coverage --cover-package={{ name }} -sv bob.rppg - sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx - sphinx-build -aEb doctest {{ project_dir }}/doc sphinx - conda inspect linkages -p $PREFIX {{ name }} # [not win] diff --git a/develop.cfg b/develop.cfg new file mode 100644 index 0000000000000000000000000000000000000000..e413dd4dd033510cd124c6593a13e26a2397e97e --- /dev/null +++ b/develop.cfg @@ -0,0 +1,66 @@ +; vim: set fileencoding=utf-8 : +; Manuel Guenther <manuel.guenther@idiap.ch> +; Thu Oct 9 16:51:06 CEST 2014 + +[buildout] +parts = scripts +eggs = bob.extension + bob.blitz + bob.core + bob.sp + bob.io.base + bob.math + bob.io.image + bob.io.video + bob.ip.base + bob.ip.draw + bob.ip.color + bob.learn.boosting + bob.ip.facedetect + bob.ip.skincolorfilter + +extensions = bob.buildout + mr.developer +auto-checkout = * +develop = src/bob.extension + src/bob.blitz + src/bob.core + src/bob.sp + src/bob.io.base + src/bob.math + src/bob.io.image + src/bob.io.video + src/bob.ip.base + src/bob.ip.draw + src/bob.ip.color + src/bob.learn.boosting + src/bob.ip.facedetect + src/bob.ip.skincolorfilter + . + +; options for bob.buildout +debug = true +verbose = true +newest = false + +[sources] +bob.extension = git https://gitlab.idiap.ch/bob/bob.extension +bob.blitz = git https://gitlab.idiap.ch/bob/bob.blitz +bob.core = git https://gitlab.idiap.ch/bob/bob.core +bob.sp = git https://gitlab.idiap.ch/bob/bob.sp +bob.io.base = git https://gitlab.idiap.ch/bob/bob.io.base +bob.math = git https://gitlab.idiap.ch/bob/bob.math +bob.io.image = git https://gitlab.idiap.ch/bob/bob.io.image +bob.io.video = git https://gitlab.idiap.ch/bob/bob.io.video +bob.ip.base = git https://gitlab.idiap.ch/bob/bob.ip.base +bob.ip.draw = git https://gitlab.idiap.ch/bob/bob.ip.draw +bob.ip.color = git https://gitlab.idiap.ch/bob/bob.ip.color +bob.ip.facedetect = git https://gitlab.idiap.ch/bob/bob.ip.facedetect +bob.ip.skincolorfilter = git https://gitlab.idiap.ch/bob/bob.ip.skincolorfilter +bob.learn.boosting = git https://gitlab.idiap.ch/bob/bob.learn.boosting + + + +[scripts] +recipe = bob.buildout:scripts +dependent-scripts = true