diff --git a/modules/videoio/include/opencv2/videoio.hpp b/modules/videoio/include/opencv2/videoio.hpp index c38875f7d2..458e63d843 100644 --- a/modules/videoio/include/opencv2/videoio.hpp +++ b/modules/videoio/include/opencv2/videoio.hpp @@ -556,6 +556,20 @@ enum { CAP_PROP_GPHOTO2_PREVIEW = 17001, //!< Capture only preview fro //! @} gPhoto2 + +/** @name Images backend + @{ +*/ + +/** @brief Images backend properties + +*/ +enum { CAP_PROP_IMAGES_BASE = 18000, + CAP_PROP_IMAGES_LAST = 19000 // excluding + }; + +//! @} Images + //! @} videoio_flags_others diff --git a/modules/videoio/src/cap_images.cpp b/modules/videoio/src/cap_images.cpp index e379561593..f87c5544d2 100644 --- a/modules/videoio/src/cap_images.cpp +++ b/modules/videoio/src/cap_images.cpp @@ -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 params; }; bool CvVideoWriter_Images::writeFrame( const IplImage* image ) { char str[_MAX_PATH]; sprintf(str, filename, currentframe); - int ret = cvSaveImage(str, image); + std::vector 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( value ) ); + return true; + } + return false; // not supported +} + + CvVideoWriter* cvCreateVideoWriter_Images( const char* filename ) { CvVideoWriter_Images *writer = new CvVideoWriter_Images;