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