Descriptor.h
Go to the documentation of this file.
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                         Descriptor.h - Copyright klank
00021 
00022 **************************************************************************/
00023 
00024 
00025 #ifndef DESCRIPTOR_H
00026 #define DESCRIPTOR_H
00027 
00028 
00029 #include "Class.h"
00030 #include "GeometricShape.h"
00031 
00032 
00033 #define XML_NODE_DESCRIPTOR "Descriptor"
00034 #define XML_ATTRIBUTE_MODELID "ModelID"
00035 
00036 
00037 namespace cop
00038 {
00039 
00040   class RelPose;
00041   class Reading;
00042 
00043 
00048   class Descriptor : public Elem
00049   {
00050   public:
00051 
00052     // Constructors/Destructors
00053     //
00057     Descriptor ( Class* classref);
00058     Descriptor ( );
00059 
00063     virtual ~Descriptor ( );
00064 
00065     /***********************************************************************
00066       *   SetLastMatchedImage                                             */
00067     /************************************************************************
00068     *  @brief sets the last iamge on that this model was matched
00069     *  @param img  an image
00070     *  @param pose a pose that specifies the result in the given image
00071     *  of a locating algorithm
00072     *  @throw char* with an error message in case of failure
00073     **************************************************************************/
00074     void SetLastMatchedImage(Reading* img, RelPose* pose);
00077     /***********************************************************************
00078     * GetLastMatchedImage                                      */
00079     /************************************************************************
00080     *   @returns the last iamge on that this model was matched
00081     *************************************************************************/
00082     Reading* GetLastMatchedImage(){return m_imgLastMatchReading;}
00083     /***********************************************************************
00084     * GetLastMatchedPose                                                     */
00085     /************************************************************************
00086     * @brief The descrtiptor remebers the last matched pose/image combination for refinement.
00087     *************************************************************************/
00088     const RelPose* GetLastMatchedPose() const  {return m_poseLastMatchReading;}
00089     RelPose* GetLastMatchedPose(){return m_poseLastMatchReading;}
00090     /***********************************************************************
00091     * GetQuality                                                     */
00092     /************************************************************************
00093     * @returns the quality of the descriptor                                *
00094     *************************************************************************/
00095     double GetQuality(){return m_qualityMeasure;}
00096     /***********************************************************************
00097     * Evaluate                                                     */
00098     /************************************************************************
00099     * @brief Puts a result to a descriptor to set its quality.
00100     * @param eval a value from 0.0 (bad) to 1.0 (good)
00101     * @param weight a value describing the influence of the former
00102     *        m_qualityMeasure
00103     *************************************************************************/
00104     virtual void Evaluate(const double eval, const double weight){m_qualityMeasure = (eval  + m_qualityMeasure * weight) / (1+weight); } //TOCHECK: how to combine and TODO if(m_qualityMeasure == 0.0) delete this;
00105 
00106     /***********************************************************************
00107     * Show                                                     */
00108     /************************************************************************
00109     * @brief if this Descriptor can be showed, show it.
00110     * @param pose A position where this descriptor should be displayed,
00111     * @param camera that took the picture where the descriptor was displayed
00112     *************************************************************************/
00113     virtual void Show(RelPose* , Sensor* ){};
00114     /***********************************************************************
00115     * GetNodeName                                                     */
00116     /************************************************************************
00117     * @brief  The node name for saving and loading to XML
00118     *************************************************************************/
00119     virtual std::string GetNodeName() const{return XML_NODE_DESCRIPTOR;}
00120 
00121     /***********************************************************************
00122     * SaveTo                                                    */
00123     /************************************************************************
00124     * @brief  Adds the descriptors parameter to a XMLTag
00125     *************************************************************************/
00126     virtual void SaveTo(XMLTag* tag);
00127     // Public attribute accessor methods
00128     //
00129     Class* GetClass();
00130     void SetClass(Class* cl){m_class = cl;}
00131     /***********************************************************************
00132     *  GetShape                                                       */
00133     /************************************************************************
00134     * @brief fills in  the object's shape
00135     * @param objectShape retrieves the shape of a descriptor
00136     * @return true if a Shape was added, false if not. Mesh overrides Cylinder
00137     *         overrides  Box
00138     *************************************************************************/
00139     virtual bool GetShape(GeometricShape &objectShape) const {return false;}
00140     virtual void PropagatePose(RelPose* pose){}
00141   protected:
00142     virtual void SetData(XMLTag* tag);
00143 
00144 
00145   protected:
00146     Class* m_class;
00147     Reading* m_imgLastMatchReading;
00148     RelPose* m_poseLastMatchReading;
00149 
00150     double m_qualityMeasure;
00151   };
00152 
00153 }
00154 #endif // DESCRIPTOR_H
00155 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cognitive_perception
Author(s): Ulrich F Klank
autogenerated on Thu May 23 2013 07:38:34