FeaturePoolClassifier.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**
  2. * @file FeaturePoolClassifier.cpp
  3. * @brief abstract interface for a classifier using feature selection
  4. * @author Erik Rodner
  5. * @date 04/21/2008
  6. */
  7. #include <iostream>
  8. #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
  9. #include "vislearning/baselib/ICETools.h"
  10. #ifdef NOVISUAL
  11. #include <vislearning/nice_nonvis.h>
  12. #else
  13. #include <vislearning/nice.h>
  14. #endif
  15. using namespace OBJREC;
  16. using namespace std;
  17. // refactor-nice.pl: check this substitution
  18. // old: using namespace ice;
  19. using namespace NICE;
  20. FeaturePoolClassifier::FeaturePoolClassifier() : maxClassNo(-1)
  21. {
  22. }
  23. FeaturePoolClassifier::~FeaturePoolClassifier()
  24. {
  25. }
  26. // refactor-nice.pl: check this substitution
  27. // old: ClassificationResult FeaturePoolClassifier::classify ( const Image & img )
  28. ClassificationResult FeaturePoolClassifier::classify ( const NICE::Image & img )
  29. {
  30. CachedExample ce ( img );
  31. // refactor-nice.pl: check this substitution
  32. // old: Example pce ( &ce, img->xsize/2, img->ysize/2 );
  33. Example pce ( &ce, img.width()/2, img.height()/2 );
  34. // refactor-nice.pl: check this substitution
  35. // old: pce.width = img->xsize;
  36. pce.width = img.width();
  37. // refactor-nice.pl: check this substitution
  38. // old: pce.height = img->ysize;
  39. pce.height = img.height();
  40. return classify ( pce );
  41. }
  42. // refactor-nice.pl: check this substitution
  43. // old: ClassificationResult FeaturePoolClassifier::classifyRGB ( const ImageRGB & img )
  44. ClassificationResult FeaturePoolClassifier::classifyRGB ( const NICE::ColorImage & img )
  45. {
  46. CachedExample ce ( img );
  47. // refactor-nice.pl: check this substitution
  48. // old: Example pce ( &ce, img.xsize()/2, img.ysize()/2 );
  49. Example pce ( &ce, img.width()/2, img.height()/2 );
  50. // refactor-nice.pl: check this substitution
  51. // old: pce.width = img.xsize();
  52. pce.width = img.width();
  53. // refactor-nice.pl: check this substitution
  54. // old: pce.height = img.ysize();
  55. pce.height = img.height();
  56. return classify ( pce );
  57. }
  58. void FeaturePoolClassifier::setMaxClassNo( int classno )
  59. {
  60. maxClassNo = classno;
  61. }
  62. int FeaturePoolClassifier::getMaxClassNo () const
  63. {
  64. return maxClassNo;
  65. }
  66. void FeaturePoolClassifier::setComplexity ( int size )
  67. {
  68. fprintf (stderr, "FeaturePoolClassifier::setComplexity: not yet implemented in subordinate class\n");
  69. exit(-1);
  70. }