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