Added missed file
This commit is contained in:
parent
f6e2ad6144
commit
404d66d4ef
32
modules/videostab/src/frame_source.cpp
Normal file
32
modules/videostab/src/frame_source.cpp
Normal file
@ -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…
x
Reference in New Issue
Block a user