testColorWeijer.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // STL includes
  2. #include <fstream>
  3. #include <getopt.h>
  4. #include <iostream>
  5. // nice-core includes
  6. #include <core/vector/VectorT.h>
  7. #include <core/vector/MatrixT.h>
  8. //
  9. #include <core/image/ImageT.h>
  10. #include <core/imagedisplay/ImageDisplay.h>
  11. // nice-vislearning includes
  12. #include <vislearning/features/localfeatures/LocalFeatureColorWeijer.h>
  13. using namespace std;
  14. using namespace NICE;
  15. using namespace OBJREC;
  16. /**
  17. * @brief Printing main menu.
  18. * @author Alexander Freytag
  19. * @date 13-02-2013
  20. *
  21. * @return void
  22. **/
  23. void print_main_menu()
  24. {
  25. std::cerr << "=====================================================================================" << std::endl;
  26. std::cerr << "||This is a small programm demonstrating the computation of 11-dim color features. ||" << std::endl;
  27. std::cerr << "=====================================================================================" << std::endl;
  28. std::cout << std::endl << "Input options:" << std::endl;
  29. std::cout << " -i <filename> the name of the image which shall be transformed"<< std::endl;
  30. return;
  31. }
  32. //post-process active learning segmentation results, such that the given images are normalized to be visualized in the same range
  33. int main( int argc, char* argv[] )
  34. {
  35. int rc;
  36. if (argc<2)
  37. {
  38. print_main_menu();
  39. return -1;
  40. }
  41. if ( (argc+1)%2 != 0 )
  42. {
  43. std::cerr << " WARNING -- even number of inputs required (specifier + value ) -- aborting... " << std::endl;
  44. return -1;
  45. }
  46. std::string filename("");
  47. while ((rc=getopt(argc,argv,"i:h"))>=0)
  48. {
  49. switch(rc)
  50. {
  51. case 'i': filename = optarg; break;
  52. default: print_main_menu();
  53. }
  54. }
  55. NICE::Config *conf = new NICE::Config();
  56. OBJREC::LocalFeatureColorWeijer lfc(conf);
  57. //! testen
  58. NICE::ColorImage cimg;
  59. cimg.read( filename );
  60. NICE::ColorImage out;
  61. lfc.visualizeFeatures (cimg, out);
  62. cimg.writePPM("org.ppm");
  63. out.writePPM("out.ppm");
  64. delete conf;
  65. return 0;
  66. }