From 56512871a01f2e596e583f564b1b8a3028deb7a9 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.anjos@idiap.ch>
Date: Fri, 21 Sep 2012 09:45:58 +0200
Subject: [PATCH] Unlock in critical regions; Implements testing

---
 flandmark/ext/ext.cpp | 7 +++++--
 flandmark/test.py     | 4 +++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/flandmark/ext/ext.cpp b/flandmark/ext/ext.cpp
index 81eb808..2c14351 100644
--- a/flandmark/ext/ext.cpp
+++ b/flandmark/ext/ext.cpp
@@ -96,8 +96,11 @@ class Localizer {
         det["bbox"] = make_tuple(r->x, r->y, r->width, r->height);
         int bbox[4] = {r->x, r->y, r->x + r->width, r->y + r->height};
 
-        flandmark_detect(ipl_image.get(), bbox, m_flandmark.get(),
-            m_landmarks.get());
+        {
+          bob::python::no_gil unlock;
+          flandmark_detect(ipl_image.get(), bbox, m_flandmark.get(),
+              m_landmarks.get());
+        }
 
         list lmlist; ///< landmark list
 
diff --git a/flandmark/test.py b/flandmark/test.py
index 31bba7c..501958d 100644
--- a/flandmark/test.py
+++ b/flandmark/test.py
@@ -39,4 +39,6 @@ class FlandmarkTest(unittest.TestCase):
         "flandmark/flandmark_model.dat")
 
     for i, f in enumerate(bob.io.VideoReader(INPUT_VIDEO)):
-      self.assertTrue(op(bob.ip.rgb_to_gray(f)))
+      v = bob.ip.rgb_to_gray(f)
+      print v
+      self.assertTrue(op(v))
-- 
GitLab