|
@@ -0,0 +1,76 @@
|
|
|
+/**
|
|
|
+* @file testSift.cpp
|
|
|
+* @brief test sift implementation
|
|
|
+* @author Björn Fröhlich
|
|
|
+* @date 06/08/2010
|
|
|
+*/
|
|
|
+#include "objrec/nice.h"
|
|
|
+
|
|
|
+#include "objrec/baselib/Config.h"
|
|
|
+
|
|
|
+#include "objrec/features/localfeatures/LocalFeatureSift.h"
|
|
|
+#include "objrec/features/localfeatures/LocalFeatureOpponnentSift.h"
|
|
|
+#include "objrec/features/localfeatures/LocalFeatureRGBSift.h"
|
|
|
+
|
|
|
+#include "objrec/features/localfeatures/LFColorSande.h"
|
|
|
+#include "objrec/features/localfeatures/LocalFeatureLFInterface.h"
|
|
|
+
|
|
|
+
|
|
|
+#include "objrec/baselib/Globals.h"
|
|
|
+
|
|
|
+using namespace OBJREC;
|
|
|
+using namespace NICE;
|
|
|
+using namespace std;
|
|
|
+
|
|
|
+int main (int argc, char **argv)
|
|
|
+{
|
|
|
+ if(argc < 1)
|
|
|
+ {
|
|
|
+ cerr << "Bitte Bild angeben" << endl;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ string filename;
|
|
|
+ filename += argv[1];
|
|
|
+
|
|
|
+ Image img(filename);
|
|
|
+ ColorImage cimg(filename);
|
|
|
+
|
|
|
+ Globals::setCurrentImgFN ( filename );
|
|
|
+
|
|
|
+ Config *conf = new Config();
|
|
|
+ string section = "SIFT";
|
|
|
+ conf->sS(section, "scales", "1");
|
|
|
+ conf->sI(section, "descriptor_size", 128);
|
|
|
+ conf->sI(section, "grid", 100);
|
|
|
+ conf->sB(section, "usegrid", true);
|
|
|
+ conf->sS(section, "params", "--descriptor sift");
|
|
|
+
|
|
|
+ //LocalFeatureOpponnentSift *oSIFT = new LocalFeatureOpponnentSift (conf);
|
|
|
+ LocalFeatureRepresentation *cSIFT = new LFColorSande ( conf, section );
|
|
|
+ LocalFeature *lSIFT = new LocalFeatureLFInterface(conf, cSIFT);
|
|
|
+ LocalFeature *oSIFT = new LocalFeatureSift (conf);
|
|
|
+
|
|
|
+
|
|
|
+ VVector features1;
|
|
|
+ VVector features2;
|
|
|
+ VVector positions;
|
|
|
+ //cSIFT->extractFeatures ( cimg, features1, positions );
|
|
|
+ lSIFT->getDescriptors( img, positions, features1 );
|
|
|
+ //showImage(cimg);
|
|
|
+ oSIFT->getDescriptors( img, positions, features2 );
|
|
|
+ cout << "f1.size: " << features1.size() << " f2.size: " << features2.size() << " p.size() " << positions.size() << endl;
|
|
|
+
|
|
|
+
|
|
|
+ double max[2] = {0.0,0.0};
|
|
|
+ int feat = 1;
|
|
|
+ for(int i = 0; i < (int)features1[feat].size(); i++)
|
|
|
+ {
|
|
|
+ max[0] = std::max(max[0], features1[feat][i]);
|
|
|
+ max[1] = std::max(max[1], features2[feat][i]);
|
|
|
+ cout << features1[feat][i] << "\t" << features2[feat][i] << endl;
|
|
|
+ }
|
|
|
+ cout << "max: " << max[0] << "\t" << max[1] << endl;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|