2010-05-12 01:44:00 +08:00
|
|
|
#ifndef _OPENCV_IMAGESTORAGE_H_
|
|
|
|
#define _OPENCV_IMAGESTORAGE_H_
|
|
|
|
|
2011-05-22 02:32:34 +08:00
|
|
|
#include "highgui.h"
|
2010-05-12 01:44:00 +08:00
|
|
|
|
|
|
|
using namespace cv;
|
|
|
|
|
|
|
|
class CvCascadeImageReader
|
|
|
|
{
|
|
|
|
public:
|
2013-02-25 00:14:01 +08:00
|
|
|
bool create( const std::string _posFilename, const std::string _negFilename, Size _winSize );
|
2010-05-12 01:44:00 +08:00
|
|
|
void restart() { posReader.restart(); }
|
|
|
|
bool getNeg(Mat &_img) { return negReader.get( _img ); }
|
|
|
|
bool getPos(Mat &_img) { return posReader.get( _img ); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
class PosReader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PosReader();
|
|
|
|
virtual ~PosReader();
|
2013-02-25 00:14:01 +08:00
|
|
|
bool create( const std::string _filename );
|
2010-05-12 01:44:00 +08:00
|
|
|
bool get( Mat &_img );
|
|
|
|
void restart();
|
|
|
|
|
|
|
|
short* vec;
|
|
|
|
FILE* file;
|
|
|
|
int count;
|
|
|
|
int vecSize;
|
|
|
|
int last;
|
|
|
|
int base;
|
|
|
|
} posReader;
|
|
|
|
|
|
|
|
class NegReader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NegReader();
|
2013-02-25 00:14:01 +08:00
|
|
|
bool create( const std::string _filename, Size _winSize );
|
2010-05-12 01:44:00 +08:00
|
|
|
bool get( Mat& _img );
|
|
|
|
bool nextImg();
|
|
|
|
|
|
|
|
Mat src, img;
|
2013-02-25 00:14:01 +08:00
|
|
|
std::vector<std::string> imgFilenames;
|
2010-05-12 01:44:00 +08:00
|
|
|
Point offset, point;
|
|
|
|
float scale;
|
|
|
|
float scaleFactor;
|
|
|
|
float stepFactor;
|
|
|
|
size_t last, round;
|
|
|
|
Size winSize;
|
|
|
|
} negReader;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|