Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SiftData.cc

Go to the documentation of this file.
00001 #include "SiftData.h"
00002 #include "ShapeFuns.h"
00003 #include "ShapePoint.h"
00004 #include "ShapeSift.h"
00005 #include "Vision/SIFT/SIFTDatabase/keypoint.h"
00006 
00007 namespace DualCoding {
00008 
00009 SiftData:: SiftData(ShapeSpace& _space, SiftMatch* _match)
00010   : BaseData(_space, getStaticType()), center_pt(), match(_match) {
00011   if ( match )
00012     center_pt = (match->topLeft + match->topRight + match->bottomLeft + match->bottomRight) / 4;
00013 }
00014 
00015 SiftData::SiftData(const SiftData &other)
00016   : BaseData(other), center_pt(other.center_pt), 
00017     match(new SiftMatch(*other.match)) // must copy SiftMatch structure because destrutor will delete it
00018 {}
00019   
00020 SiftData::~SiftData() {
00021   delete match;
00022 }
00023 
00024 BoundingBox2D SiftData::getBoundingBox() const {
00025   return BoundingBox2D(center_pt.coords); // *** incomplete ***
00026 }
00027 
00028 bool SiftData::isMatchFor(const ShapeRoot& other) const {
00029   if ( ! isSameTypeAs(other) ) return false;
00030   const Shape<SiftData>& other_sift = ShapeRootTypeConst(other,SiftData);
00031   return (getObjectID() == other_sift->getObjectID());
00032 }
00033 
00034 bool SiftData::updateParams(const ShapeRoot& other, bool force) {
00035   // *** incomplete ***
00036   return true;
00037 }
00038 
00039 void SiftData::printParams() const {
00040   std::cout << "Type = " << getTypeName() << "  ID=" << getId() << "  ParentID=" << getParentId() << std::endl;
00041   match->print("  ");
00042 }
00043 
00044 void SiftData::applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref) {
00045   // *** incomplete definition ***
00046   std::cerr << "Don't know how to apply a transform to SiftData object!\n";
00047 }
00048 
00049 void SiftData::projectToGround(const fmat::Transform& camToBase, const PlaneEquation& groundplane) {
00050   // *** incomplete definition ***
00051   std::cerr << "Don't know how to project-to-ground a SiftData object!\n";
00052 }
00053 
00054 Sketch<bool>* SiftData::render() const {
00055   SketchSpace &SkS = space->getDualSpace();
00056   Sketch<bool> result(SkS, "render("+getName()+")");
00057   result = 0;   // *** incomplete rendering ***
00058   return new Sketch<bool>(result);
00059 }
00060 
00061 void SiftData::displayMatchedFeatures() {
00062   for ( std::vector<keypointPair>::const_iterator it = match->inliers.begin(); it != match->inliers.end(); it++ ) {
00063     NEW_SHAPE(feature, PointData, new PointData(*space, Point(it->getKey1()->modelX, it->getKey1()->modelY, 0, camcentric)));
00064     feature->setParentId(getId());
00065     feature->setColor(rgb(0,255,0));
00066   }
00067 }
00068   
00069 DATASTUFF_CC(SiftData);
00070 
00071 } // namespace

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