[mousetrap/ng] Merging svn's ng branch with git's ng branch
- From: Flavio Percoco <flaper src gnome org>
- To: svn-commits-list gnome org
- Subject: [mousetrap/ng] Merging svn's ng branch with git's ng branch
- Date: Sun, 3 May 2009 05:28:35 -0400 (EDT)
commit 6a9d9789722f2473434d4692daf796346a20ae97
Author: Flavio Percoco Premoli <flaper87 gmail com>
Date: Sun May 3 08:06:06 2009 +0200
Merging svn's ng branch with git's ng branch
---
src/mousetrap/environment.py | 6 ++--
src/mousetrap/lib/dbusd.py | 6 ++--
src/mousetrap/lib/httpd.py | 6 ++--
src/mousetrap/lib/mouse.py | 6 ++--
src/mousetrap/lib/settings.py | 6 ++--
src/mousetrap/mousetrap.py | 6 ++--
src/mousetrap/ui/main.py | 6 ++--
src/mousetrap/ui/scripts/screen.py | 6 ++--
src/mousetrap/ui/settings_gui.py | 26 +++++++++++++++------
src/mousetrap/ui/widgets.py | 6 ++--
src/ocvfw/_ocv.py | 20 ++++++++++------
src/ocvfw/debug.py | 6 ++--
src/ocvfw/dev/camera.py | 6 ++--
src/ocvfw/idm/__init__.py | 6 ++--
src/ocvfw/idm/forehead.py | 25 ++++++++++++++++-----
src/ocvfw/pocv.py | 43 ++++++++++++++++++++++++++++++++++++
16 files changed, 128 insertions(+), 58 deletions(-)
diff --git a/src/mousetrap/environment.py b/src/mousetrap/environment.py
index 6a3cfe8..07afa26 100644
--- a/src/mousetrap/environment.py
+++ b/src/mousetrap/environment.py
@@ -21,9 +21,9 @@
""" Holds mousetrap internal information. """
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: environment.py 27 2009-03-31 12:02:22Z flaper $"
+__version__ = "$Revision: 27 $"
+__date__ = "$Date: 2009-03-31 14:02:22 +0200 (mar 31 de mar de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli."
__license__ = "GPLv2"
diff --git a/src/mousetrap/lib/dbusd.py b/src/mousetrap/lib/dbusd.py
index 551af13..1cc699a 100755
--- a/src/mousetrap/lib/dbusd.py
+++ b/src/mousetrap/lib/dbusd.py
@@ -23,9 +23,9 @@
""" Exposes mouseTrap as a DBus service for comunication purposes. """
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: dbusd.py 29 2009-03-31 12:06:44Z flaper $"
+__version__ = "$Revision: 29 $"
+__date__ = "$Date: 2009-03-31 14:06:44 +0200 (mar 31 de mar de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/mousetrap/lib/httpd.py b/src/mousetrap/lib/httpd.py
index da5b4e5..a2df198 100644
--- a/src/mousetrap/lib/httpd.py
+++ b/src/mousetrap/lib/httpd.py
@@ -23,9 +23,9 @@
"""The Server module of mouseTrap."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: httpd.py 29 2009-03-31 12:06:44Z flaper $"
+__version__ = "$Revision: 29 $"
+__date__ = "$Date: 2009-03-31 14:06:44 +0200 (mar 31 de mar de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/mousetrap/lib/mouse.py b/src/mousetrap/lib/mouse.py
index a5d0ebd..1dd86bf 100644
--- a/src/mousetrap/lib/mouse.py
+++ b/src/mousetrap/lib/mouse.py
@@ -21,9 +21,9 @@
"""The mouse events handler."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: mouse.py 21 2009-02-22 18:24:52Z flaper $"
+__version__ = "$Revision: 21 $"
+__date__ = "$Date: 2009-02-22 19:24:52 +0100 (dom 22 de feb de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/mousetrap/lib/settings.py b/src/mousetrap/lib/settings.py
index a035c0e..70fd8a8 100755
--- a/src/mousetrap/lib/settings.py
+++ b/src/mousetrap/lib/settings.py
@@ -22,9 +22,9 @@
"""MouseTrap's settings handler."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: settings.py 30 2009-04-03 16:00:06Z flaper $"
+__version__ = "$Revision: 30 $"
+__date__ = "$Date: 2009-04-03 18:00:06 +0200 (vie 03 de abr de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/mousetrap/mousetrap.py b/src/mousetrap/mousetrap.py
index d4e6cfb..581a150 100644
--- a/src/mousetrap/mousetrap.py
+++ b/src/mousetrap/mousetrap.py
@@ -22,9 +22,9 @@
"""MouseTrap's main script."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: mousetrap.py 30 2009-04-03 16:00:06Z flaper $"
+__version__ = "$Revision: 30 $"
+__date__ = "$Date: 2009-04-03 18:00:06 +0200 (vie 03 de abr de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/mousetrap/ui/main.py b/src/mousetrap/ui/main.py
index 649d6bd..17a8994 100644
--- a/src/mousetrap/ui/main.py
+++ b/src/mousetrap/ui/main.py
@@ -22,9 +22,9 @@
"""The main GUI of mousetrap."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: main.py 30 2009-04-03 16:00:06Z flaper $"
+__version__ = "$Revision: 30 $"
+__date__ = "$Date: 2009-04-03 18:00:06 +0200 (vie 03 de abr de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/mousetrap/ui/scripts/screen.py b/src/mousetrap/ui/scripts/screen.py
index 70d9e03..bfdc707 100644
--- a/src/mousetrap/ui/scripts/screen.py
+++ b/src/mousetrap/ui/scripts/screen.py
@@ -22,9 +22,9 @@
"""The Screen Mode script."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: screen.py 21 2009-02-22 18:24:52Z flaper $"
+__version__ = "$Revision: 21 $"
+__date__ = "$Date: 2009-02-22 19:24:52 +0100 (dom 22 de feb de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/mousetrap/ui/settings_gui.py b/src/mousetrap/ui/settings_gui.py
index 5eaf725..129ab7c 100755
--- a/src/mousetrap/ui/settings_gui.py
+++ b/src/mousetrap/ui/settings_gui.py
@@ -22,14 +22,15 @@
"""Settings Handler Interface."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: settings_gui.py 30 2009-04-03 16:00:06Z flaper $"
+__version__ = "$Revision: 30 $"
+__date__ = "$Date: 2009-04-03 18:00:06 +0200 (vie 03 de abr de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
import gtk
import sys
+import dialogs
from i18n import _
import environment as env
from ocvfw import pocv
@@ -210,9 +211,10 @@ class preffGui( gtk.Window ):
algo_box = gtk.VBox( spacing = 6 )
- liststore = gtk.ListStore(bool, str, bool)
+ liststore = gtk.ListStore(bool, str, str)
conf_button = gtk.Button(stock=gtk.STOCK_PREFERENCES)
+ conf_button.connect('clicked', self.show_alg_pref, liststore)
conf_button.set_sensitive(False)
tree_view = gtk.TreeView(liststore)
@@ -231,7 +233,8 @@ class preffGui( gtk.Window ):
for alg in pocv.get_idms_list():
alg_inf = pocv.get_idm_inf(alg)
- liststore.append([False, "%s: %s" % (alg_inf["name"], alg_inf["dsc"]), alg_inf["stgs"]])
+ liststore.append([False, alg_inf["name"], alg_inf["stgs"]])
+ #liststore.append([False, "%s: %s" % (alg_inf["name"], alg_inf["dsc"]), alg_inf["stgs"]])
tree_view.append_column(toggle_column)
tree_view.append_column(text_column)
@@ -362,6 +365,11 @@ class preffGui( gtk.Window ):
self.NoteBook.insert_page(Frame, gtk.Label( _("Debug") ) )
+ def show_alg_pref(self, widget, liststore):
+ dlg = dialogs.IdmSettings(self.cfg, self.selected_idm, self.selected_idm_stgs)
+ dlg.set_transient_for(self)
+ dlg.set_destroy_with_parent(True)
+
def acceptButtonClick( self, *args ):
"""
Acept button callback. This will apply the settings and close the
@@ -391,9 +399,12 @@ class preffGui( gtk.Window ):
ts = widget.get_selection()
model, it = ts.get_selected()
path = model.get_path(it)[0]
- conf_button.set_sensitive(model[path][2])
+ if model[path][0] and model[path][2]:
+ self.selected_idm = model[path][1]
+ self.selected_idm_stgs = model[path][2]
+ conf_button.set_sensitive(True)
- def _toggle_cell_changed(self, cell, path, model ):
+ def _toggle_cell_changed(self, cell, path, model):
"""
ListStore RadioButton Value Changer.
"""
@@ -408,7 +419,6 @@ class preffGui( gtk.Window ):
else:
model[pth][0] = False
-
def _checkToggled( self, widget, section, option ):
"""
Sets the new value in the settings object for the toggled checkbox
diff --git a/src/mousetrap/ui/widgets.py b/src/mousetrap/ui/widgets.py
index 240b24a..d12d6df 100644
--- a/src/mousetrap/ui/widgets.py
+++ b/src/mousetrap/ui/widgets.py
@@ -22,9 +22,9 @@
"""Scripts Common Widgets Module."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: widgets.py 27 2009-03-31 12:02:22Z flaper $"
+__version__ = "$Revision: 27 $"
+__date__ = "$Date: 2009-03-31 14:02:22 +0200 (mar 31 de mar de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/ocvfw/_ocv.py b/src/ocvfw/_ocv.py
index 3ef7aa5..c45a6ba 100644
--- a/src/ocvfw/_ocv.py
+++ b/src/ocvfw/_ocv.py
@@ -22,9 +22,9 @@
"""Little Framework for OpenCV Library."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: _ocv.py 20 2009-02-21 21:34:12Z flaper $"
+__version__ = "$Revision: 20 $"
+__date__ = "$Date: 2009-02-21 22:34:12 +0100 (sáb 21 de feb de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
@@ -94,11 +94,11 @@ class ocvfw:
if not cascade:
debug.exception( "ocvfw", "The Haar Classifier Cascade load failed" )
- cv.cvResize( self.img, self.smallImg, cv.CV_INTER_LINEAR )
+ cv.cvResize( self.img, self.small_img, cv.CV_INTER_LINEAR )
cv.cvClearMemStorage( self.storage )
- points = cv.cvHaarDetectObjects( self.smallImg, cascade, self.storage, 1.2, 2, method, cv.cvSize(20,20) )
+ points = cv.cvHaarDetectObjects( self.small_img, cascade, self.storage, 1.2, 2, method, cv.cvSize(20,20) )
if points:
matches = [ [ cv.cvPoint( int(r.x*self.imageScale), int(r.y*self.imageScale)), \
@@ -122,10 +122,8 @@ class ocvfw:
cascade = cv.cvLoadHaarClassifierCascade( haarCascade, self.imgSize )
cv.cvClearMemStorage( self.storage )
- #imageROI = cv.cvCreateImage( cv.cvSize( rect.width, rect.height ), 8, 1 )
imageROI = cv.cvGetSubRect( self.img, rect )
- #imageROI = cv.getImageROI(self.img)
if cascade:
points = cv.cvHaarDetectObjects( imageROI, cascade, self.storage,
@@ -174,6 +172,12 @@ class ocvfw:
self.img_lkpoints["current"] = []
def clean_lkpoints(self):
+ """
+ Cleans all the registered points.
+
+ Arguments:
+ - self: The main object pointer
+ """
self.img_lkpoints = { "current" : [],
"last" : [],
@@ -281,7 +285,7 @@ class ocvfw:
self.prevGrey = cv.cvCreateImage ( self.imgSize, 8, 1 )
self.pyramid = cv.cvCreateImage ( self.imgSize, 8, 1 )
self.prevPyramid = cv.cvCreateImage ( self.imgSize, 8, 1 )
- self.smallImg = cv.cvCreateImage( cv.cvSize( cv.cvRound ( self.imgSize.width/self.imageScale),
+ self.small_img = cv.cvCreateImage( cv.cvSize( cv.cvRound ( self.imgSize.width/self.imageScale),
cv.cvRound ( self.imgSize.height/self.imageScale) ), 8, 3 )
self.img = frame
cv.cvCvtColor(self.img, self.grey, cv.CV_BGR2GRAY)
diff --git a/src/ocvfw/debug.py b/src/ocvfw/debug.py
index fc00873..d8a39c6 100644
--- a/src/ocvfw/debug.py
+++ b/src/ocvfw/debug.py
@@ -21,9 +21,9 @@
"""The debug module of mouseTrap."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: debug.py 18 2009-02-21 21:17:24Z flaper $"
+__version__ = "$Revision: 18 $"
+__date__ = "$Date: 2009-02-21 22:17:24 +0100 (sáb 21 de feb de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/ocvfw/dev/camera.py b/src/ocvfw/dev/camera.py
index 572e931..4206565 100644
--- a/src/ocvfw/dev/camera.py
+++ b/src/ocvfw/dev/camera.py
@@ -22,9 +22,9 @@
"""Camera Device Module."""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: camera.py 21 2009-02-22 18:24:52Z flaper $"
+__version__ = "$Revision: 21 $"
+__date__ = "$Date: 2009-02-22 19:24:52 +0100 (dom 22 de feb de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/ocvfw/idm/__init__.py b/src/ocvfw/idm/__init__.py
index 40d8ef8..e4452bb 100644
--- a/src/ocvfw/idm/__init__.py
+++ b/src/ocvfw/idm/__init__.py
@@ -21,9 +21,9 @@
"""IDM Init Module"""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: __init__.py 18 2009-02-21 21:17:24Z flaper $"
+__version__ = "$Revision: 18 $"
+__date__ = "$Date: 2009-02-21 22:17:24 +0100 (sáb 21 de feb de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
diff --git a/src/ocvfw/idm/forehead.py b/src/ocvfw/idm/forehead.py
index 9c3f349..06a0df0 100644
--- a/src/ocvfw/idm/forehead.py
+++ b/src/ocvfw/idm/forehead.py
@@ -22,22 +22,28 @@
"""Forehead IDM"""
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
+__id__ = "$Id: forehead.py 21 2009-02-22 18:24:52Z flaper $"
+__version__ = "$Revision: 21 $"
+__date__ = "$Date: 2009-02-22 19:24:52 +0100 (dom 22 de feb de 2009) $"
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
from ocvfw.dev.camera import *
+
+a_name = "Forehead"
+a_description = "Forehead point tracker based on LK Algorithm"
+a_settings = { 'speed' : {"value":2}}
+
class Module(object):
- def __init__(self, controller):
+ def __init__(self, controller, stgs = {}):
Camera.init(idx=0)
self.img = None
self.ctr = controller
self.cap = None
+ self.stgs = stgs
##############################
# MOTION RELATED VARIABLES #
@@ -66,6 +72,15 @@ class Module(object):
self.isMoving = False
+ self.prepare_config()
+
+ def prepare_config(self):
+ global a_settings
+
+ for key in self.stgs:
+ pass
+ pass
+
def set_capture(self):
self.cap = Capture(async=True)
self.cap.change(color="rgb")
@@ -132,5 +147,3 @@ class Module(object):
self.foreheadOrig = None
return False
-
-
diff --git a/src/ocvfw/pocv.py b/src/ocvfw/pocv.py
index 8654fc4..1fbf997 100644
--- a/src/ocvfw/pocv.py
+++ b/src/ocvfw/pocv.py
@@ -1,3 +1,34 @@
+# -*- coding: utf-8 -*-
+
+# mouseTrap
+#
+# Copyright 2009 Flavio Percoco Premoli
+#
+# This file is part of mouseTrap.
+#
+# mouseTrap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# mouseTrap 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 mouseTrap. If not, see <http://www.gnu.org/licenses/>.
+
+
+"""Python Opencv Handler."""
+
+__id__ = "$Id: mousetrap.py 29 2009-03-31 12:06:44Z flaper $"
+__version__ = "$Revision: 29 $"
+__date__ = "$Date: 2009-03-31 14:06:44 +0200 (mar 31 de mar de 2009) $"
+__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
+__license__ = "GPLv2"
+
+import os
def get_idm(idm):
"""
@@ -10,3 +41,15 @@ def get_idm(idm):
globals(),
locals(),
[''])
+
+def get_idms_list():
+ dirname = os.path.dirname(__file__)
+ return [ f.replace(".py", "") for f in os.listdir("%s/idm/" % dirname) if "__" not in f and ".py" in f and ".pyc" not in f ]
+
+def get_idm_inf(idm):
+ tmp = __import__("ocvfw.idm.%s" % idm,
+ globals(),
+ locals(),
+ [''])
+ return { "name" : tmp.a_name, "dsc" : tmp.a_description, "stgs" : tmp.a_settings}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]