Browse Source

minor security fix for testColorWeijer

Alexander Freytag 11 years ago
parent
commit
af2d57268e

+ 4 - 4
features/localfeatures/LocalFeatureColorWeijer.cpp

@@ -82,7 +82,7 @@ void LocalFeatureColorWeijer::restoreLUT()
   {
     fthrow(Exception,"ColorWeijer: could not find lookup table file. Specify the path in the config, e.g., YOURNICEHOME/vislearning/features/localfeatures/input/colorWeijer/w2c.txt");
   }
-  
+    
   while( !fin.eof() )
   {
     double rd,gd,bd;
@@ -172,7 +172,7 @@ int LocalFeatureColorWeijer::findColor( string &fn )
     return WHITE;
   if ( fn.find( "yellow" ) != string::npos )
     return YELLOW;
-
+  
   return -1;
 }
 
@@ -203,7 +203,7 @@ void LocalFeatureColorWeijer::visualizeFeatures( const NICE::ColorImage & cimg )
 
 void LocalFeatureColorWeijer::visualizeFeatures( const NICE::ColorImage & cimg, NICE::ColorImage &out ) const
 {
-  VVector pos, feats;
+  NICE::VVector pos, feats;
   for ( int y = 0; y < cimg.height(); y++ )
   {
     for ( int x = 0; x < cimg.width(); x++ )
@@ -251,7 +251,7 @@ void LocalFeatureColorWeijer::visualizeFeatures( const NICE::ColorImage & cimg,
   showImage( combinedout, "result" );
 }
 
-void LocalFeatureColorWeijer::getFeats( const ColorImage &img, MultiChannelImageT<double> &feats )
+void LocalFeatureColorWeijer::getFeats( const NICE::ColorImage &img, MultiChannelImageT<double> &feats )
 {
   int width = ( int )img.width();
   int height = ( int )img.height();

+ 13 - 1
features/localfeatures/progs/testColorWeijer.cpp

@@ -49,6 +49,13 @@ int main( int argc, char* argv[] )
     return -1;
   }
   
+  if ( (argc+1)%2 != 0 )
+  {
+    std::cerr << " WARNING -- even number of inputs required (specifier + value ) -- aborting... " << std::endl;
+    return -1;
+  }
+   
+  
   std::string filename("");
   while ((rc=getopt(argc,argv,"i:h"))>=0)
   {
@@ -63,12 +70,17 @@ int main( int argc, char* argv[] )
   OBJREC::LocalFeatureColorWeijer lfc(conf);
 
   //! testen
-  NICE::ColorImage cimg(filename);
+  NICE::ColorImage cimg;
+  cimg.read( filename );
+  
   NICE::ColorImage out;
+  
   lfc.visualizeFeatures (cimg, out);
 
   cimg.writePPM("org.ppm");
   out.writePPM("out.ppm");
+  
+  delete conf;
 
   return 0;
 }