imagestorage.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef _OPENCV_IMAGESTORAGE_H_
  2. #define _OPENCV_IMAGESTORAGE_H_
  3. class CvCascadeImageReader
  4. {
  5. public:
  6. bool create( const std::string _posFilename, const std::string _negFilename, cv::Size _winSize );
  7. void restart() { posReader.restart(); }
  8. bool getNeg(cv::Mat &_img) { return negReader.get( _img ); }
  9. bool getPos(cv::Mat &_img) { return posReader.get( _img ); }
  10. private:
  11. class PosReader
  12. {
  13. public:
  14. PosReader();
  15. virtual ~PosReader();
  16. bool create( const std::string _filename );
  17. bool get( cv::Mat &_img );
  18. void restart();
  19. short* vec;
  20. FILE* file;
  21. int count;
  22. int vecSize;
  23. int last;
  24. int base;
  25. } posReader;
  26. class NegReader
  27. {
  28. public:
  29. NegReader();
  30. bool create( const std::string _filename, cv::Size _winSize );
  31. bool get( cv::Mat& _img );
  32. bool nextImg();
  33. cv::Mat src, img;
  34. std::vector<std::string> imgFilenames;
  35. cv::Point offset, point;
  36. float scale;
  37. float scaleFactor;
  38. float stepFactor;
  39. size_t last, round;
  40. cv::Size winSize;
  41. } negReader;
  42. };
  43. #endif