Reverted some changes in videostab module
This commit is contained in:
parent
5715d9ef42
commit
a71797c0c4
@ -1,3 +1,3 @@
|
|||||||
set(the_description "Video stabilization")
|
set(the_description "Video stabilization")
|
||||||
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d OPTIONAL opencv_gpu opencv_highgui)
|
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d opencv_highgui OPTIONAL opencv_gpu)
|
||||||
|
|
||||||
|
@ -43,11 +43,6 @@
|
|||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/videostab/frame_source.hpp"
|
#include "opencv2/videostab/frame_source.hpp"
|
||||||
|
|
||||||
#include "opencv2/opencv_modules.hpp"
|
|
||||||
#ifdef HAVE_OPENCV_HIGHGUI
|
|
||||||
# include "opencv2/highgui/highgui.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
@ -55,74 +50,25 @@ namespace cv
|
|||||||
namespace videostab
|
namespace videostab
|
||||||
{
|
{
|
||||||
|
|
||||||
struct VideoFileSource::VideoReader
|
|
||||||
{
|
|
||||||
#ifdef HAVE_OPENCV_HIGHGUI
|
|
||||||
mutable VideoCapture vc;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
VideoFileSource::VideoFileSource(const string &path, bool volatileFrame)
|
VideoFileSource::VideoFileSource(const string &path, bool volatileFrame)
|
||||||
: path_(path), volatileFrame_(volatileFrame), reader_(VideoReader()) { reset(); }
|
: path_(path), volatileFrame_(volatileFrame) { reset(); }
|
||||||
|
|
||||||
|
|
||||||
void VideoFileSource::reset()
|
void VideoFileSource::reset()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OPENCV_HIGHGUI
|
reader_.release();
|
||||||
reader_.vc.release();
|
reader_.open(path_);
|
||||||
reader_.vc.open(path_);
|
if (!reader_.isOpened())
|
||||||
if (!reader_.vc.isOpened())
|
|
||||||
throw runtime_error("can't open file: " + path_);
|
throw runtime_error("can't open file: " + path_);
|
||||||
#else
|
|
||||||
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without video I/O support");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Mat VideoFileSource::nextFrame()
|
Mat VideoFileSource::nextFrame()
|
||||||
{
|
{
|
||||||
Mat frame;
|
Mat frame;
|
||||||
#ifdef HAVE_OPENCV_HIGHGUI
|
reader_ >> frame;
|
||||||
reader_.vc >> frame;
|
|
||||||
#endif
|
|
||||||
return volatileFrame_ ? frame : frame.clone();
|
return volatileFrame_ ? frame : frame.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
int VideoFileSource::width()
|
|
||||||
{
|
|
||||||
#ifdef HAVE_OPENCV_HIGHGUI
|
|
||||||
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_WIDTH));
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int VideoFileSource::height()
|
|
||||||
{
|
|
||||||
#ifdef HAVE_OPENCV_HIGHGUI
|
|
||||||
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_HEIGHT));
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int VideoFileSource::count()
|
|
||||||
{
|
|
||||||
#ifdef HAVE_OPENCV_HIGHGUI
|
|
||||||
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_COUNT));
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
double VideoFileSource::fps()
|
|
||||||
{
|
|
||||||
#ifdef HAVE_OPENCV_HIGHGUI
|
|
||||||
return reader_.vc.get(CV_CAP_PROP_FPS);
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace videostab
|
} // namespace videostab
|
||||||
} // namespace cv
|
} // namespace cv
|
||||||
|
Loading…
x
Reference in New Issue
Block a user