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..d3584b05eda0cddfcca768ed807e5fd88a9f17d4 100644 --- a/bob/rppg/ssr/script/test.py +++ b/bob/rppg/ssr/script/test.py @@ -1,23 +1,6 @@ #!/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 @@ -68,8 +51,8 @@ def test_get_eigen(): 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])) + evals, evecs = get_eigen(a) + assert numpy.all(evals == numpy.array([0.5, 0.5])) assert numpy.all(evecs == numpy.array([[0, 1], [1, 0]])) a = numpy.array([[0, 0], [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)