diff --git a/buildout.cfg b/buildout.cfg index 2b3f417e954139a4b11fa61eeeff30440c591bb8..9b83ba7425da5ce7f3b003df0fd9098499a965cf 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -3,7 +3,7 @@ ; Mon 16 Apr 08:29:18 2012 CEST [buildout] -parts = external python +parts = external tests python develop = . eggs = bob flandmark @@ -12,6 +12,11 @@ eggs = bob recipe = xbob.buildout:external egg-directories = /idiap/group/torch5spro/nightlies/last/install/linux-x86_64-release/lib +[tests] +recipe = xbob.buildout:nose +eggs = ${buildout:eggs} +script = tests.py + [python] recipe = zc.recipe.egg interpreter = python diff --git a/flandmark/__init__.py b/flandmark/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..6766446b630a88080deded520353fd225771df6d 100644 --- a/flandmark/__init__.py +++ b/flandmark/__init__.py @@ -0,0 +1 @@ +from ._flandmark import * diff --git a/flandmark/test.py b/flandmark/test.py new file mode 100644 index 0000000000000000000000000000000000000000..31bba7c82a8065333aaf1e54e4c74923c8b1d361 --- /dev/null +++ b/flandmark/test.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# Andre Anjos <andre.anjos@idiap.ch> +# Fri 21 Sep 2012 09:19:39 CEST + +"""Tests for flandmark python bindings +""" + +import os, sys +import unittest +import bob +import pkg_resources +from nose.plugins.skip import SkipTest + +from . import Localizer + +def F(name, f): + """Returns the test file on the "data" subdirectory""" + return pkg_resources.resource_filename(name, os.path.join('data', f)) + +INPUT_VIDEO = F('bob.io.test', 'test.mov') + +class FlandmarkTest(unittest.TestCase): + """Performs various tests on the Flandmark package""" + + def test01_video(self): + + op = Localizer("flandmark/haarcascade_frontalface_alt.xml", + "flandmark/flandmark_model.dat") + + v = bob.io.VideoReader(INPUT_VIDEO) + + for i, f in enumerate(v): + self.assertTrue(op(bob.ip.rgb_to_gray(f))) + + def xtest02_broken(self): + + op = Localizer("flandmark/haarcascade_frontalface_alt.xml", + "flandmark/flandmark_model.dat") + + for i, f in enumerate(bob.io.VideoReader(INPUT_VIDEO)): + self.assertTrue(op(bob.ip.rgb_to_gray(f))) diff --git a/setup.py b/setup.py index a99055a96e6b0e68e734bf7cd6bb1ec66f816f27..55da9ad4bc0eb816b71376b6849bb85e48f4dc60 100644 --- a/setup.py +++ b/setup.py @@ -85,7 +85,7 @@ setup( name="flandmark", version="1.0.6", ext_modules=[ - setup_bob_extension("_flandmark", + setup_bob_extension("flandmark._flandmark", [ "flandmark/ext/flandmark_detector.cpp", "flandmark/ext/liblbp.cpp", diff --git a/test.py b/test.py deleted file mode 100644 index 69ee9b449ca7d2f77c7bd3180a2f64d97c02f0ba..0000000000000000000000000000000000000000 --- a/test.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python -# vim: set fileencoding=utf-8 : -# Andre Anjos <andre.anjos@idiap.ch> -# Thu 20 Sep 2012 17:21:36 CEST - -""" -""" - -import sys -import bob -from _flandmark import Localizer - -op = Localizer("flandmark/haarcascade_frontalface_alt.xml", - "flandmark/flandmark_model.dat") - -for f in bob.io.VideoReader('/scratch/aanjos/bob/python/bob/io/test/data/test.mov'): - print "Hello!" - print op(bob.ip.rgb_to_gray(f))