123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- /**
- * @file LFGenericLocal.cpp
- * @brief generic local features
- * @author Erik Rodner
- * @date 02/05/2008
- */
- #include <iostream>
- #include <sstream>
- #include "vislearning/features/localfeatures/LFGenericLocal.h"
- #include "vislearning/features/localfeatures/LocalFeatureSift.h"
- #include "vislearning/features/localfeatures/IDRandomSampling.h"
- using namespace OBJREC;
- using namespace std;
- using namespace NICE;
- ///////////////////// ///////////////////// /////////////////////
- // CONSTRUCTORS / DESTRUCTORS
- ///////////////////// ///////////////////// /////////////////
- LFGenericLocal::LFGenericLocal()
- {
- this->lf = NULL;
- this->id = NULL;
- }
- LFGenericLocal::LFGenericLocal( const Config *conf, int numFeatures )
- {
- lf = new LocalFeatureSift(conf);
- id = new IDRandomSampling(conf, numFeatures);
- }
- LFGenericLocal::~LFGenericLocal()
- {
- if ( this->lf != NULL )
- {
- delete this->lf;
- this->lf = NULL;
- }
- if ( this->id != NULL )
- {
- delete this->id;
- this->id = NULL;
- }
- }
- ///////////////////// ///////////////////// /////////////////////
- // FEATURE STUFF
- ///////////////////// ///////////////////// //////////////////
- int LFGenericLocal::getDescSize () const
- {
- return lf->getDescSize();
- }
- int LFGenericLocal::extractFeatures ( const NICE::Image & img,
- VVector & features,
- VVector & positions ) const
- {
- id->getInterests ( img, positions );
- lf->getDescriptors ( img, positions, features );
- return 0;
- }
- void LFGenericLocal::visualizeFeatures ( NICE::Image & mark,
- const VVector & positions,
- size_t color ) const
- {
- lf->visualizeFeatures ( mark, positions, color );
- }
- ///////////////////// INTERFACE PERSISTENT /////////////////////
- // interface specific methods for store and restore
- ///////////////////// INTERFACE PERSISTENT /////////////////////
- void LFGenericLocal::restore ( std::istream & is, int format )
- {
- fthrow ( Exception, "LFGenericLocal::restore not implemented yet." );
- //TODO
- }
- void LFGenericLocal::store ( std::ostream & os, int format ) const
- {
- fthrow ( Exception, "LFGenericLocal::store not implemented yet." );
- //TODO
- }
- void LFGenericLocal::clear ()
- {
- if ( this->lf != NULL )
- {
- delete this->lf;
- this->lf = NULL;
- }
- if ( this->id != NULL )
- {
- delete this->id;
- this->id = NULL;
- }
- }
|