FeaturePoolClassifier.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. using namespace OBJREC;
  11. using namespace std;
  12. // refactor-nice.pl: check this substitution
  13. // old: using namespace ice;
  14. using namespace NICE;
  15. FeaturePoolClassifier::FeaturePoolClassifier() : maxClassNo(-1)
  16. {
  17. }
  18. FeaturePoolClassifier::~FeaturePoolClassifier()
  19. {
  20. }
  21. // refactor-nice.pl: check this substitution
  22. // old: ClassificationResult FeaturePoolClassifier::classify ( const Image & img )
  23. ClassificationResult FeaturePoolClassifier::classify ( const NICE::Image & img )
  24. {
  25. CachedExample ce ( img );
  26. // refactor-nice.pl: check this substitution
  27. // old: Example pce ( &ce, img->xsize/2, img->ysize/2 );
  28. Example pce ( &ce, img.width()/2, img.height()/2 );
  29. // refactor-nice.pl: check this substitution
  30. // old: pce.width = img->xsize;
  31. pce.width = img.width();
  32. // refactor-nice.pl: check this substitution
  33. // old: pce.height = img->ysize;
  34. pce.height = img.height();
  35. return classify ( pce );
  36. }
  37. // refactor-nice.pl: check this substitution
  38. // old: ClassificationResult FeaturePoolClassifier::classifyRGB ( const ImageRGB & img )
  39. ClassificationResult FeaturePoolClassifier::classifyRGB ( const NICE::ColorImage & img )
  40. {
  41. CachedExample ce ( img );
  42. // refactor-nice.pl: check this substitution
  43. // old: Example pce ( &ce, img.xsize()/2, img.ysize()/2 );
  44. Example pce ( &ce, img.width()/2, img.height()/2 );
  45. // refactor-nice.pl: check this substitution
  46. // old: pce.width = img.xsize();
  47. pce.width = img.width();
  48. // refactor-nice.pl: check this substitution
  49. // old: pce.height = img.ysize();
  50. pce.height = img.height();
  51. return classify ( pce );
  52. }
  53. void FeaturePoolClassifier::setMaxClassNo( int classno )
  54. {
  55. maxClassNo = classno;
  56. }
  57. int FeaturePoolClassifier::getMaxClassNo () const
  58. {
  59. return maxClassNo;
  60. }
  61. void FeaturePoolClassifier::setComplexity ( int size )
  62. {
  63. fprintf (stderr, "FeaturePoolClassifier::setComplexity: not yet implemented in subordinate class\n");
  64. exit(-1);
  65. }