00001 /* 00002 * Copyright (C) 2009 by Ulrich Friedrich Klank <klank@in.tum.de> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 00019 /************************************************************************ 00020 Signature.h - Copyright klank 00021 00022 00023 **************************************************************************/ 00024 00025 00026 #ifndef SIGNATURE_H 00027 #define SIGNATURE_H 00028 00029 00030 #include "Class.h" 00031 #include "Object.h" 00032 00036 typedef double Probability_1D_t; /* < Type for storing Probability of a location to occur*/ 00037 00038 00039 00040 #ifndef XML_NODE_SIGNATURE 00041 #define XML_NODE_SIGNATURE "Signature" 00042 #define XML_NODE_SIGNATURE_VEC "SignatureVector" 00043 #endif 00044 00045 namespace cop 00046 { 00047 class RelPose; 00048 class Sensor; 00049 00050 00055 class Signature : public Object 00056 { 00057 public: 00058 00059 // Constructors/Destructors 00060 // 00064 Signature ( ); 00065 00066 virtual ~Signature ( ); 00067 00068 // Static Public attributes 00069 // 00070 00071 // Public attributes 00072 // 00073 00074 // Public attribute accessor methods 00075 // 00076 00077 00078 // Public attribute accessor methods 00079 // 00080 00081 00082 00088 Elem* GetElement (const int &id, const ElemType_t &type ) const; 00089 /*** 00090 * RemoveElem 00091 * @param elemToRemove Element that shoul be taken out of the list 00092 */ 00093 void RemoveElem(Elem* elemToRemove); 00094 00095 size_t CountClasses() const {return m_class.size();} 00096 size_t CountElems() const {return m_elems.size();} 00097 Class* GetClass(int index); 00098 bool HasClass(Class* classToSet); 00099 00100 virtual std::string GetNodeName() const{return XML_NODE_SIGNATURE;} 00105 long SetElem (Elem* elemToSet ); 00106 long SetClass ( Class* classToSet); 00107 void Show(Sensor* cam); 00108 virtual ElemType_t GetType(){return SIGNATURE;} 00109 virtual void SetPose(RelPose* pose); 00113 virtual Elem* Duplicate(bool bStaticCopy); 00114 00115 /*********************************************************************** 00116 * Evaluate */ 00117 /************************************************************************ 00118 * @brief Puts a result to a descriptor to set its quality. 00119 * @param eval a value from 0.0 (bad) to 1.0 (good) 00120 * @param weight a value describing the influence of the former 00121 * m_qualityMeasure 00122 *************************************************************************/ 00123 virtual void Evaluate(const double eval, const double weight); 00124 00125 protected: 00126 virtual void SaveTo(XMLTag* tag); 00132 virtual void SetData(XMLTag* tag); 00133 00134 // Protected attribute accessor methods 00135 // 00136 00137 00138 private: 00139 00140 std::vector<Elem*> m_elems; 00141 std::vector<Class*> m_class; 00142 void initAttributes ( ) ; 00143 00144 boost::mutex m_mutexClasses; 00145 }; 00146 } 00147 #endif // SIGNATURE_H