imagestorage.h 1.18 KB
Newer Older
1 2 3 4 5 6 7
#ifndef _OPENCV_IMAGESTORAGE_H_
#define _OPENCV_IMAGESTORAGE_H_


class CvCascadeImageReader
{
public:
8
    bool create( const std::string _posFilename, const std::string _negFilename, cv::Size _winSize );
9
    void restart() { posReader.restart(); }
10 11
    bool getNeg(cv::Mat &_img) { return negReader.get( _img ); }
    bool getPos(cv::Mat &_img) { return posReader.get( _img ); }
12 13 14 15 16 17 18

private:
    class PosReader
    {
    public:
        PosReader();
        virtual ~PosReader();
19
        bool create( const std::string _filename );
20
        bool get( cv::Mat &_img );
21 22 23 24 25 26 27 28 29 30 31 32 33 34
        void restart();

        short* vec;
        FILE*  file;
        int    count;
        int    vecSize;
        int    last;
        int    base;
    } posReader;

    class NegReader
    {
    public:
        NegReader();
35 36
        bool create( const std::string _filename, cv::Size _winSize );
        bool get( cv::Mat& _img );
37 38
        bool nextImg();

39
        cv::Mat     src, img;
40
        std::vector<std::string> imgFilenames;
41
        cv::Point   offset, point;
42 43 44 45
        float   scale;
        float   scaleFactor;
        float   stepFactor;
        size_t  last, round;
46
        cv::Size    winSize;
47 48 49 50
    } negReader;
};

#endif