123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- #include <iostream>
- #include <assert.h>
- #include "LocalFeatureLFInterface.h"
- using namespace OBJREC;
- using namespace std;
- using namespace NICE;
- LocalFeatureLFInterface::LocalFeatureLFInterface() : LocalFeature ()
- {
- this->lfpres = NULL;
- }
- LocalFeatureLFInterface::LocalFeatureLFInterface( const NICE::Config * _conf, LocalFeatureRepresentation *_lfpres )
- {
- this->initFromConfig( _conf );
-
- this->lfpres = _lfpres;
- }
- LocalFeatureLFInterface::~LocalFeatureLFInterface()
- {
- if ( this->lfpres != NULL )
- delete lfpres;
- this->lfpres = NULL;
- }
- void LocalFeatureLFInterface::initFromConfig( const NICE::Config* _conf, const std::string& _confSection )
- {
-
-
- }
- int LocalFeatureLFInterface::getDescriptors ( const NICE::Image & img, VVector & positions, VVector & descriptors ) const
- {
-
- lfpres->extractFeatures(img, descriptors, positions);
- assert(descriptors.size() == positions.size());
- return 0;
- }
- int LocalFeatureLFInterface::getDescriptors ( const NICE::ColorImage & img, VVector & positions, VVector & descriptors) const
- {
-
- lfpres->extractFeatures(img, descriptors, positions);
- assert(descriptors.size() == positions.size());
- return 0;
- }
- void LocalFeatureLFInterface::visualizeFeatures ( NICE::Image & mark,
- const VVector & positions,
- size_t color ) const
- {
-
- lfpres->visualizeFeatures(mark, positions, color);
- }
- void LocalFeatureLFInterface::restore ( std::istream & is, int format )
- {
-
- this->clear();
-
-
- if ( is.good() )
- {
-
- std::string tmp;
- is >> tmp;
-
- if ( ! this->isStartTag( tmp, "LocalFeatureLFInterface" ) )
- {
- std::cerr << " WARNING - attempt to restore LocalFeatureLFInterface, but start flag " << tmp << " does not match! Aborting... " << std::endl;
- throw;
- }
-
- bool b_endOfBlock ( false ) ;
-
- while ( !b_endOfBlock )
- {
- is >> tmp;
-
- if ( this->isEndTag( tmp, "LocalFeatureLFInterface" ) )
- {
- b_endOfBlock = true;
- continue;
- }
-
- tmp = this->removeStartTag ( tmp );
-
-
-
-
- if ( tmp.compare("lfpres") == 0 )
- {
-
-
- }
- else
- {
- std::cerr << "WARNING -- unexpected LocalFeatureOpponnentSift object -- " << tmp << " -- for restoration... aborting" << std::endl;
- throw;
- }
- }
- }
- else
- {
- std::cerr << "LocalFeatureOpponnentSift::restore -- InStream not initialized - restoring not possible!" << std::endl;
- throw;
- }
- }
- void LocalFeatureLFInterface::store ( std::ostream & os, int format ) const
- {
- if (os.good())
- {
-
- os << this->createStartTag( "LocalFeatureLFInterface" ) << std::endl;
-
-
-
-
- os << this->createStartTag( "lfpres" ) << std::endl;
-
- os << this->createStartTag( "lfpres" ) << std::endl;
-
-
- os << this->createEndTag( "LocalFeatureLFInterface" ) << std::endl;
- }
- else
- {
- std::cerr << "OutStream not initialized - storing not possible!" << std::endl;
- }
- }
- void LocalFeatureLFInterface::clear ()
- {
- if ( this->lfpres != NULL )
- delete lfpres;
- this->lfpres = NULL;
- }
|