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