parent
f6e2ad6144
commit
404d66d4ef
1 changed files with 32 additions and 0 deletions
@ -0,0 +1,32 @@ |
||||
#include "precomp.hpp" |
||||
#include "opencv2/videostab/frame_source.hpp" |
||||
|
||||
using namespace std; |
||||
|
||||
namespace cv |
||||
{ |
||||
namespace videostab |
||||
{ |
||||
|
||||
VideoFileSource::VideoFileSource(const string &path, bool volatileFrame) |
||||
: path_(path), volatileFrame_(volatileFrame) { reset(); } |
||||
|
||||
|
||||
void VideoFileSource::reset() |
||||
{ |
||||
reader_.release(); |
||||
reader_.open(path_); |
||||
if (!reader_.isOpened()) |
||||
throw runtime_error("can't open file: " + path_); |
||||
} |
||||
|
||||
|
||||
Mat VideoFileSource::nextFrame() |
||||
{ |
||||
Mat frame; |
||||
reader_ >> frame; |
||||
return volatileFrame_ ? frame : frame.clone(); |
||||
} |
||||
|
||||
} // namespace videostab
|
||||
} // namespace cv
|
Loading…
Reference in new issue