#ifdef NICE_USELIB_OPENMP #include #endif #include #include #include "vislearning/features/localfeatures/sift.h" #include "vislearning/features/localfeatures/LocalFeatureRGBSift.h" using namespace OBJREC; using namespace std; using namespace NICE; #undef DEBUG_show_one_picture_per_channel LocalFeatureRGBSift::LocalFeatureRGBSift( const Config *conf ):LocalFeatureSift(conf) { deletemode = false; } LocalFeatureRGBSift::~LocalFeatureRGBSift() { } int LocalFeatureRGBSift::getDescriptors ( const NICE::ColorImage & img, VVector & positions, VVector & descriptors ) const { sortPositions(positions); descriptors.clear(); // Fuer jede Position wird ein leerer NICE::Vector in descriptors eingefuegt for(int i = 0; i < (int) positions.size(); i++) { NICE::Vector v; descriptors.push_back(v); } vector desc( 3 ); #ifndef DEBUG_show_one_picture_per_channel #pragma omp parallel for #endif // Descriptor fuer jeden der 3 Kanaele berechnen for(int i = 0; i < 3; i++) { NICE::Image tmp(img.width(), img.height()); for(int y = 0; y < img.height(); y++) { for(int x = 0; x < img.width(); x++) { tmp.setPixel(x,y,img.getPixel(x,y,i)); } } #ifdef DEBUG_show_one_picture_per_channel showImage( tmp ); #endif VVector pos = positions; computeDesc(tmp, pos, desc[i]); } // ? //desc[0] = desc[2]; for(int i = 0; i < 3; i++) { assert(desc[i].size() == descriptors.size()); if(i == 0) { #ifndef DEBUG_show_one_picture_per_channel #pragma omp parallel for #endif for(int j = 0; j < (int)desc[i].size(); j++) { // kopiere den roten (1.)-Kanal in den Descriptorsvektor descriptors[j] = desc[i][j]; } } else { #ifndef DEBUG_show_one_picture_per_channel #pragma omp parallel for #endif for(int j = 0; j < (int)desc[i].size(); j++) { descriptors[j].append(desc[i][j]); } } } return positions.size(); }