Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SiftData.h

Go to the documentation of this file.
00001 #ifndef _SIFTDATA_H_
00002 #define _SIFTDATA_H_
00003 
00004 #include <vector>
00005 #include <string>
00006 
00007 #include "BaseData.h"    // superclass
00008 #include "Point.h"       // Point data member
00009 #include "Vision/SIFT/API/SiftMatch.h"
00010 #include "Vision/SIFT/API/SiftTekkotsu.h"
00011 
00012 #include "Sketch.h"
00013 
00014 namespace DualCoding {
00015 
00016   class ShapeRoot;
00017   class SketchSpace;
00018   template<typename T> class Sketch;
00019 
00020   class SiftData : public BaseData {
00021   private:
00022     Point center_pt;
00023     SiftMatch* match;
00024   
00025   public:
00026 
00027     //! Constructor
00028     SiftData(ShapeSpace& _space, SiftMatch* _match);
00029 
00030     //! Copy constructor
00031     SiftData(const SiftData &other);
00032 
00033     //! Destructor
00034     ~SiftData();
00035 
00036     static ShapeType_t getStaticType() { return siftDataType; }
00037 
00038     DATASTUFF_H(SiftData);
00039   
00040     //! Centroid. (Virtual in BaseData.)
00041     Point getCentroid() const { return center_pt; } 
00042     void setCentroidPt(const Point& other) { center_pt.setCoords(other); }
00043   
00044     //! returns the bounding box of the sift object
00045     virtual BoundingBox2D getBoundingBox() const;
00046 
00047     //! Bounding box points
00048     const Point& getTopLeft() const { return match->topLeft; }
00049     const Point& getTopRight() const { return match->topRight; }
00050     const Point& getBottomLeft() const { return match->bottomLeft; }
00051     const Point& getBottomRight() const { return match->bottomRight; }
00052 
00053     //! Match sift objects based on their parameters.  (Virtual in BaseData.)
00054     virtual bool isMatchFor(const ShapeRoot& other) const;
00055 
00056     virtual bool isAdmissible() const { return true; }
00057 
00058     virtual bool updateParams(const ShapeRoot& other, bool force=false);
00059 
00060     //! Print information about this shape. (Virtual in BaseData.)
00061     virtual void printParams() const;
00062   
00063     //! Transformations. (Virtual in BaseData.)
00064     void applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref=unspecified);
00065   
00066     //! Project to ground
00067     virtual void projectToGround(const fmat::Transform& camToBase, const PlaneEquation& groundplane);
00068 
00069     //! Center point access function.
00070     const Point& centerPt() const { return center_pt; }
00071   
00072     virtual unsigned short getDimension() const { return 2; }
00073   
00074     //! Properties functions.
00075     //@{
00076     int getObjectID() const { return match->objectID; }
00077     // **** Joehan: write accessors for the remaining fields of SiftMatch
00078     // const string& getObjectName const { return objectName; }
00079     //@}
00080     int getModelID() const { return match->modelID; } 
00081     const std::string& getObjectName() const { return match->objectName; }
00082     const std::string& getModelName() const { return match->modelName; }
00083     double getProbOfMatch() const { return match->probOfMatch; }
00084     double getError() const { return match->error; }
00085     double getScale() const { return match->scale; }
00086     double getOrientation() const { return match->orientation; }
00087     double getColumnTranslation() const { return match->columnTranslation; }
00088     double getRowTranslation() const { return match->rowTranslation; }
00089     const std::vector<keypointPair>& getInliers() const { return match->inliers; }
00090     const void siftMatchPrint() const { match->print("  "); }
00091     void getSiftMatchBoundingBox() const { match->computeBoundingBox(); }
00092     //! Extraction.
00093     static std::vector<Shape<SiftData> > extractSiftObjects(const Sketch<uchar> &sketch, const SiftTekkotsu &database);
00094     static std::vector<Shape<SiftData> > extractSiftObjects(const Sketch<uchar> &sketch, const SiftTekkotsu &database, const std::string &objectName);
00095   
00096     //! Display matched features as points in the object's shape space
00097     void displayMatchedFeatures();
00098 
00099   private:
00100     //! Render into a sketch space and return pointer. (Private.)
00101     virtual Sketch<bool>* render() const;
00102     SiftData& operator=(const SiftData&); //!< don't call
00103   };
00104 
00105 
00106 } // namespace
00107 
00108 #endif

DualCoding 5.1CVS
Generated Mon May 9 04:56:27 2016 by Doxygen 1.6.3