[mousetrap/gnome3-wip: 132/240] Extract nose.py configuration.



commit 262f763009c5aca6d6773c624a4dadd488075383
Author: Stoney Jackson <dr stoney gmail com>
Date:   Mon Jun 23 15:44:09 2014 -0400

    Extract nose.py configuration.

 src/mousetrap/config.py       |   13 +++++++++++++
 src/mousetrap/plugins/nose.py |   12 ++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/mousetrap/config.py b/src/mousetrap/config.py
index 261da4a..7bb408e 100644
--- a/src/mousetrap/config.py
+++ b/src/mousetrap/config.py
@@ -76,9 +76,22 @@ class Config(dict):
                     'min_neighbors': 10,
                     },
                 },
+
             'mousetrap.plugins.nose_joystick.NoseJoystickPlugin': {
                 'threshold': 5,
                 },
+
+            'mousetrap.plugins.nose.NoseLocator': {
+                'face_detector': {
+                    'scale_factor': 1.5,
+                    'min_neighbors': 5
+                    },
+
+                'nose_detector': {
+                    'scale_factor': 1.1,
+                    'min_neighbors': 5
+                    },
+                },
             }
 
 
diff --git a/src/mousetrap/plugins/nose.py b/src/mousetrap/plugins/nose.py
index 01e5a3b..d7d92b9 100644
--- a/src/mousetrap/plugins/nose.py
+++ b/src/mousetrap/plugins/nose.py
@@ -39,9 +39,17 @@ class NoseLocator(object):
     def __init__(self, config):
         self._config = config
         self._face_detector = FeatureDetector(
-                config, 'face', scale_factor=1.5, min_neighbors=5)
+                config,
+                'face',
+                scale_factor=config[self]['face_detector']['scale_factor'],
+                min_neighbors=config[self]['face_detector']['min_neighbors']
+                )
         self._nose_detector = FeatureDetector(
-                config, 'nose', scale_factor=1.1, min_neighbors=5)
+                config,
+                'nose',
+                scale_factor=config[self]['nose_detector']['scale_factor'],
+                min_neighbors=config[self]['nose_detector']['min_neighbors']
+                )
 
     def locate(self, image):
         face = self._face_detector.detect(image)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]