|
|
|
@ -332,18 +332,23 @@ public: |
|
|
|
|
|
|
|
|
|
virtual bool open( const char* _filename ); |
|
|
|
|
virtual void close(); |
|
|
|
|
virtual bool setProperty( int, double ); |
|
|
|
|
virtual bool writeFrame( const IplImage* ); |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
char* filename; |
|
|
|
|
unsigned currentframe; |
|
|
|
|
std::vector<int> params; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
bool CvVideoWriter_Images::writeFrame( const IplImage* image ) |
|
|
|
|
{ |
|
|
|
|
char str[_MAX_PATH]; |
|
|
|
|
sprintf(str, filename, currentframe); |
|
|
|
|
int ret = cvSaveImage(str, image); |
|
|
|
|
std::vector<int> image_params = params; |
|
|
|
|
image_params.push_back(0); // append parameters 'stop' mark
|
|
|
|
|
image_params.push_back(0); |
|
|
|
|
int ret = cvSaveImage(str, image, &image_params[0]); |
|
|
|
|
|
|
|
|
|
currentframe++; |
|
|
|
|
|
|
|
|
@ -358,6 +363,7 @@ void CvVideoWriter_Images::close() |
|
|
|
|
filename = 0; |
|
|
|
|
} |
|
|
|
|
currentframe = 0; |
|
|
|
|
params.clear(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -380,10 +386,23 @@ bool CvVideoWriter_Images::open( const char* _filename ) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
currentframe = offset; |
|
|
|
|
params.clear(); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CvVideoWriter_Images::setProperty( int id, double value ) |
|
|
|
|
{ |
|
|
|
|
if (id >= cv::CAP_PROP_IMAGES_BASE && id < cv::CAP_PROP_IMAGES_LAST) |
|
|
|
|
{ |
|
|
|
|
params.push_back( id - cv::CAP_PROP_IMAGES_BASE ); |
|
|
|
|
params.push_back( static_cast<int>( value ) ); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
return false; // not supported
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CvVideoWriter* cvCreateVideoWriter_Images( const char* filename ) |
|
|
|
|
{ |
|
|
|
|
CvVideoWriter_Images *writer = new CvVideoWriter_Images; |
|
|
|
|