root/juggler/branches/2.2/modules/gadgeteer/gadget/Type/Gesture.h
| Revision 19729, 3.7 kB (checked in by patrick, 2 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /*************** <auto-copyright.pl BEGIN do not edit this line> ************** |
| 2 | * |
| 3 | * VR Juggler is (C) Copyright 1998-2007 by Iowa State University |
| 4 | * |
| 5 | * Original Authors: |
| 6 | * Allen Bierbaum, Christopher Just, |
| 7 | * Patrick Hartling, Kevin Meinert, |
| 8 | * Carolina Cruz-Neira, Albert Baker |
| 9 | * |
| 10 | * This library is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Library General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This library is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * Library General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Library General Public |
| 21 | * License along with this library; if not, write to the |
| 22 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 02111-1307, USA. |
| 24 | * |
| 25 | *************** <auto-copyright.pl END do not edit this line> ***************/ |
| 26 | |
| 27 | #ifndef _GADGET_GESTURE_H_ |
| 28 | #define _GADGET_GESTURE_H_ |
| 29 | //#pragma once |
| 30 | |
| 31 | #include <gadget/gadgetConfig.h> |
| 32 | #include <boost/concept_check.hpp> |
| 33 | #include <jccl/Config/ConfigElementPtr.h> |
| 34 | |
| 35 | |
| 36 | namespace gadget |
| 37 | { |
| 38 | |
| 39 | /** \class Gesture Gesture.h gadget/Type/Gesture.h |
| 40 | * |
| 41 | * Base Gadgeteer Gesture interface class. |
| 42 | * This class is the base interface for all gesture recognition objects. |
| 43 | * |
| 44 | * All gesture objects have two parts to their interfaces. |
| 45 | * Getting gestures and training new gestures. |
| 46 | * |
| 47 | * In order to retrieve gesture information from the device, |
| 48 | * the user call the get functions to get the index, or |
| 49 | * string representation of the current gesture. |
| 50 | * |
| 51 | */ |
| 52 | class Gesture |
| 53 | { |
| 54 | public: |
| 55 | Gesture() |
| 56 | {} |
| 57 | |
| 58 | virtual ~Gesture() |
| 59 | {;} |
| 60 | |
| 61 | virtual bool config(jccl::ConfigElementPtr e) |
| 62 | { |
| 63 | boost::ignore_unused_variable_warning(e); |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | public: // **** GET GESTURES **** // |
| 68 | /** |
| 69 | * Retuns the id of the named gesture. |
| 70 | * @return -1 if the gesture name not found. |
| 71 | */ |
| 72 | virtual int getGestureIndex(std::string name) = 0; |
| 73 | |
| 74 | /** |
| 75 | * Gets the string name of the gesture. |
| 76 | * If id is -1, then it returns the string name of the current gesture. |
| 77 | */ |
| 78 | virtual std::string getGestureString(int id) = 0; |
| 79 | |
| 80 | /** |
| 81 | * Gets the current gesture. |
| 82 | * @return id of current gesture. |
| 83 | */ |
| 84 | virtual int getGesture() = 0; |
| 85 | |
| 86 | |
| 87 | public: // **** TRAINING **** // |
| 88 | |
| 89 | /** |
| 90 | * This creates a new gesture with the given name. |
| 91 | * Returns the identifier of the new gesture. |
| 92 | */ |
| 93 | virtual int createGesture(std::string gestureName) = 0; |
| 94 | |
| 95 | /** Adds a new sample of the given gesture to the training data. */ |
| 96 | virtual void addSample(int gestureId) = 0; |
| 97 | |
| 98 | /** This actually starts the training on the given data. */ |
| 99 | virtual void train() = 0; |
| 100 | |
| 101 | /** |
| 102 | * Clears the samples that we have taken so far. |
| 103 | * @param gestureId = -1 (default) then we clear all gestures else we clear |
| 104 | * only the gesture that is specified. |
| 105 | */ |
| 106 | virtual void clearSamples(int gestureId = -1) = 0; |
| 107 | |
| 108 | /** Loads trained data for the gesture object. */ |
| 109 | virtual void loadTrainedFile(std::string fileName) = 0; |
| 110 | |
| 111 | /** Saves a trained data file for the gesture object. */ |
| 112 | virtual void saveTrainedFile(std::string fileName) = 0; |
| 113 | |
| 114 | /** |
| 115 | * Loads the sample training data specified. |
| 116 | * This file contains previous samples for the gesture recognizer to train |
| 117 | * from. |
| 118 | */ |
| 119 | virtual void loadSamplesFile(std::string filename) = 0; |
| 120 | |
| 121 | /** |
| 122 | * Saves the sample training data specified. |
| 123 | * This data can be loaded at a later time to do more sample training. |
| 124 | */ |
| 125 | virtual void saveSamplesFile(std::string filename) = 0; |
| 126 | |
| 127 | }; |
| 128 | |
| 129 | } // End of gadget namespace |
| 130 | |
| 131 | |
| 132 | #endif |
Note: See TracBrowser for help on using the browser.
