|
@@ -1,10 +1,14 @@
|
|
|
-#include "vislearning/features/localfeatures/LFColorWeijer.h"
|
|
|
-
|
|
|
+// STL includes
|
|
|
#include <fstream>
|
|
|
#include <iostream>
|
|
|
#include <exception>
|
|
|
+
|
|
|
+// nice-vislearning includes
|
|
|
#include "vislearning/baselib/ColorSpace.h"
|
|
|
|
|
|
+#include "vislearning/features/localfeatures/LocalFeatureColorWeijer.h"
|
|
|
+
|
|
|
+
|
|
|
using namespace OBJREC;
|
|
|
|
|
|
using namespace std;
|
|
@@ -28,23 +32,23 @@ const int colors[11][3] =
|
|
|
};
|
|
|
|
|
|
|
|
|
-LFColorWeijer::LFColorWeijer( const Config *c )
|
|
|
+LocalFeatureColorWeijer::LocalFeatureColorWeijer( const Config *c )
|
|
|
{
|
|
|
conf = c;
|
|
|
- tfile = conf->gS( "LFColorWeijer", "table", "/home/dbv/bilder/colorWeijer/w2c.txt");
|
|
|
+ tfile = conf->gS( "LocalFeatureColorWeijer", "table", "/home/dbv/bilder/colorWeijer/w2c.txt");
|
|
|
restore();
|
|
|
}
|
|
|
|
|
|
-LFColorWeijer::~LFColorWeijer()
|
|
|
+LocalFeatureColorWeijer::~LocalFeatureColorWeijer()
|
|
|
{
|
|
|
}
|
|
|
|
|
|
-int LFColorWeijer::getDescSize() const
|
|
|
+int LocalFeatureColorWeijer::getDescSize() const
|
|
|
{
|
|
|
return LASTCOLOR;
|
|
|
}
|
|
|
|
|
|
-void LFColorWeijer::restore()
|
|
|
+void LocalFeatureColorWeijer::restore()
|
|
|
{
|
|
|
ifstream fin( tfile.c_str() );
|
|
|
if(!fin.is_open())
|
|
@@ -85,13 +89,12 @@ void LFColorWeijer::restore()
|
|
|
} */
|
|
|
}
|
|
|
|
|
|
-int LFColorWeijer::getDescriptors( const NICE::Image & img, VVector & positions, VVector & features ) const
|
|
|
+int LocalFeatureColorWeijer::getDescriptors( const NICE::Image & img, VVector & positions, VVector & features ) const
|
|
|
{
|
|
|
- cerr << "this are COLOR Features, they won't work on gray value images" << endl;
|
|
|
- exit( -1 );
|
|
|
+ throw NICE::Exception ( "LocalFeatureColorWeijer extracts COLOR Features, it won't work on gray value images");
|
|
|
}
|
|
|
|
|
|
-int LFColorWeijer::getDescriptors( const NICE::ColorImage & img, VVector & positions, VVector & features ) const
|
|
|
+int LocalFeatureColorWeijer::getDescriptors( const NICE::ColorImage & img, VVector & positions, VVector & features ) const
|
|
|
{
|
|
|
int width = ( int )img.width();
|
|
|
int height = ( int )img.height();
|
|
@@ -115,12 +118,12 @@ int LFColorWeijer::getDescriptors( const NICE::ColorImage & img, VVector & posit
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
-void LFColorWeijer::visualizeFeatures( NICE::Image & mark, const VVector & positions, size_t color ) const
|
|
|
+void LocalFeatureColorWeijer::visualizeFeatures( NICE::Image & mark, const VVector & positions, size_t color ) const
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
-int LFColorWeijer::findColor( string &fn )
|
|
|
+int LocalFeatureColorWeijer::findColor( string &fn )
|
|
|
{
|
|
|
if ( fn.find( "black" ) != string::npos )
|
|
|
return BLACK;
|
|
@@ -148,7 +151,7 @@ int LFColorWeijer::findColor( string &fn )
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
-void LFColorWeijer::visualizeFeatures( NICE::ColorImage & out, const VVector & features, const VVector & position ) const
|
|
|
+void LocalFeatureColorWeijer::visualizeFeatures( NICE::ColorImage & out, const VVector & features, const VVector & position ) const
|
|
|
{
|
|
|
for ( int i = 0; i < ( int )position.size(); i++ )
|
|
|
{
|
|
@@ -167,13 +170,13 @@ void LFColorWeijer::visualizeFeatures( NICE::ColorImage & out, const VVector & f
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void LFColorWeijer::visualizeFeatures( const NICE::ColorImage & cimg ) const
|
|
|
+void LocalFeatureColorWeijer::visualizeFeatures( const NICE::ColorImage & cimg ) const
|
|
|
{
|
|
|
ColorImage out;
|
|
|
visualizeFeatures( cimg, out );
|
|
|
}
|
|
|
|
|
|
-void LFColorWeijer::visualizeFeatures( const NICE::ColorImage & cimg, NICE::ColorImage &out ) const
|
|
|
+void LocalFeatureColorWeijer::visualizeFeatures( const NICE::ColorImage & cimg, NICE::ColorImage &out ) const
|
|
|
{
|
|
|
VVector pos, feats;
|
|
|
for ( int y = 0; y < cimg.height(); y++ )
|
|
@@ -223,7 +226,7 @@ void LFColorWeijer::visualizeFeatures( const NICE::ColorImage & cimg, NICE::Colo
|
|
|
showImage( combinedout, "result" );
|
|
|
}
|
|
|
|
|
|
-void LFColorWeijer::getFeats( const ColorImage &img, MultiChannelImageT<double> &feats )
|
|
|
+void LocalFeatureColorWeijer::getFeats( const ColorImage &img, MultiChannelImageT<double> &feats )
|
|
|
{
|
|
|
int width = ( int )img.width();
|
|
|
int height = ( int )img.height();
|