Commit e4985f60 authored by Tsukasa Sugiura's avatar Tsukasa Sugiura

Add support image save parameters in VideoWriter

Add support image save parameters in cv::VideoWriter.
This change will become available setting same parameters as
cv::imwrite() to cv::VideoWriter::set( cv::IMWRITE_*, value ).
parent 46a333ed
...@@ -332,18 +332,20 @@ public: ...@@ -332,18 +332,20 @@ public:
virtual bool open( const char* _filename ); virtual bool open( const char* _filename );
virtual void close(); virtual void close();
virtual bool setProperty( int, double );
virtual bool writeFrame( const IplImage* ); virtual bool writeFrame( const IplImage* );
protected: protected:
char* filename; char* filename;
unsigned currentframe; unsigned currentframe;
std::vector<int> params;
}; };
bool CvVideoWriter_Images::writeFrame( const IplImage* image ) bool CvVideoWriter_Images::writeFrame( const IplImage* image )
{ {
char str[_MAX_PATH]; char str[_MAX_PATH];
sprintf(str, filename, currentframe); sprintf(str, filename, currentframe);
int ret = cvSaveImage(str, image); int ret = cvSaveImage(str, image, &params[0]);
currentframe++; currentframe++;
...@@ -358,6 +360,7 @@ void CvVideoWriter_Images::close() ...@@ -358,6 +360,7 @@ void CvVideoWriter_Images::close()
filename = 0; filename = 0;
} }
currentframe = 0; currentframe = 0;
params.clear();
} }
...@@ -380,6 +383,15 @@ bool CvVideoWriter_Images::open( const char* _filename ) ...@@ -380,6 +383,15 @@ bool CvVideoWriter_Images::open( const char* _filename )
} }
currentframe = offset; currentframe = offset;
params.clear();
return true;
}
bool CvVideoWriter_Images::setProperty( int id, double value )
{
params.push_back( id );
params.push_back( static_cast<int>( value ) );
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment