|
@@ -12,7 +12,7 @@ using namespace std;
|
|
|
using namespace NICE;
|
|
|
|
|
|
|
|
|
-LocalFeatureRGBSift::LocalFeatureRGBSift (const Config *conf) : LocalFeatureSift (conf)
|
|
|
+LocalFeatureRGBSift::LocalFeatureRGBSift ( const Config *conf ) : LocalFeatureSift ( conf )
|
|
|
{
|
|
|
deletemode = false;
|
|
|
}
|
|
@@ -22,63 +22,63 @@ LocalFeatureRGBSift::~LocalFeatureRGBSift()
|
|
|
|
|
|
}
|
|
|
|
|
|
-int
|
|
|
-LocalFeatureRGBSift::getDescriptors (const NICE::ColorImage & img, VVector & positions, VVector & descriptors) const
|
|
|
+int
|
|
|
+LocalFeatureRGBSift::getDescriptors ( const NICE::ColorImage & img, VVector & positions, VVector & descriptors ) const
|
|
|
{
|
|
|
- sortPositions (positions);
|
|
|
- descriptors.clear();
|
|
|
- for (int i = 0; i < (int) positions.size(); i++)
|
|
|
- {
|
|
|
- NICE::Vector v;
|
|
|
- descriptors.push_back (v);
|
|
|
- }
|
|
|
+ sortPositions ( positions );
|
|
|
+ descriptors.clear();
|
|
|
+ for ( int i = 0; i < ( int ) positions.size(); i++ )
|
|
|
+ {
|
|
|
+ NICE::Vector v;
|
|
|
+ descriptors.push_back ( v );
|
|
|
+ }
|
|
|
|
|
|
- vector<VVector> desc (3);
|
|
|
+ vector<VVector> desc ( 3 );
|
|
|
|
|
|
#ifdef NICE_USELIB_OPENMP
|
|
|
-
|
|
|
- int numberOfCPU = omp_get_num_procs();
|
|
|
- int numberOfThreads = 0;
|
|
|
- if (isGpuUsed())
|
|
|
- {
|
|
|
-
|
|
|
- numberOfThreads = 1;
|
|
|
- clog << "[log] LocalFeatureRGBSift: no multithreading" << endl;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
- numberOfThreads = numberOfCPU;
|
|
|
- clog << "[log] LocalFeatureRGBSift: multithreading with (max) " << numberOfCPU << " threads" << endl;
|
|
|
- }
|
|
|
+
|
|
|
+ int numberOfCPU = omp_get_num_procs();
|
|
|
+ int numberOfThreads = 0;
|
|
|
+ if ( isGpuUsed() )
|
|
|
+ {
|
|
|
+
|
|
|
+ numberOfThreads = 1;
|
|
|
+ clog << "[log] LocalFeatureRGBSift: no multithreading" << endl;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ numberOfThreads = numberOfCPU;
|
|
|
+ clog << "[log] LocalFeatureRGBSift: multithreading with (max) " << numberOfCPU << " threads" << endl;
|
|
|
+ }
|
|
|
#endif
|
|
|
|
|
|
#pragma omp parallel for num_threads(numberOfThreads)
|
|
|
- for (int i = 0; i < 3; i++) {
|
|
|
- NICE::Image tmp (img.width(), img.height());
|
|
|
+ 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));
|
|
|
+ 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 ) );
|
|
|
}
|
|
|
}
|
|
|
VVector pos = positions;
|
|
|
- computeDesc (tmp, pos, desc[i]);
|
|
|
+ computeDesc ( tmp, pos, desc[i] );
|
|
|
}
|
|
|
|
|
|
- for (int i = 0; i < 3; i++) {
|
|
|
- assert (desc[i].size() == descriptors.size());
|
|
|
+ for ( int i = 0; i < 3; i++ ) {
|
|
|
+ assert ( desc[i].size() == descriptors.size() );
|
|
|
|
|
|
- if (i == 0) {
|
|
|
+ if ( i == 0 ) {
|
|
|
#pragma omp parallel for num_threads( numberOfCPU )
|
|
|
- for (int j = 0; j < (int) desc[i].size(); j++) {
|
|
|
+ for ( int j = 0; j < ( int ) desc[i].size(); j++ ) {
|
|
|
descriptors[j] = desc[i][j];
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
#pragma omp parallel for num_threads( numberOfCPU )
|
|
|
- for (int j = 0; j < (int) desc[i].size(); j++) {
|
|
|
- descriptors[j].append (desc[i][j]);
|
|
|
+ for ( int j = 0; j < ( int ) desc[i].size(); j++ ) {
|
|
|
+ descriptors[j].append ( desc[i][j] );
|
|
|
}
|
|
|
}
|
|
|
}
|