summaryrefslogtreecommitdiff
path: root/thirdparty/includes/OpenCV/opencv2/videostab
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/includes/OpenCV/opencv2/videostab')
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/deblurring.hpp110
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/fast_marching.hpp103
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/fast_marching_inl.hpp166
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/frame_source.hpp91
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/global_motion.hpp141
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/inpainting.hpp200
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/log.hpp75
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/motion_stabilizing.hpp106
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/optical_flow.hpp120
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/stabilizer.hpp187
-rw-r--r--thirdparty/includes/OpenCV/opencv2/videostab/videostab.hpp48
11 files changed, 1347 insertions, 0 deletions
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/deblurring.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/deblurring.hpp
new file mode 100644
index 0000000..a61f9ce
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/deblurring.hpp
@@ -0,0 +1,110 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_DEBLURRING_HPP__
+#define __OPENCV_VIDEOSTAB_DEBLURRING_HPP__
+
+#include <vector>
+#include "opencv2/core/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+CV_EXPORTS float calcBlurriness(const Mat &frame);
+
+class CV_EXPORTS DeblurerBase
+{
+public:
+ DeblurerBase() : radius_(0), frames_(0), motions_(0) {}
+
+ virtual ~DeblurerBase() {}
+
+ virtual void setRadius(int val) { radius_ = val; }
+ virtual int radius() const { return radius_; }
+
+ virtual void setFrames(const std::vector<Mat> &val) { frames_ = &val; }
+ virtual const std::vector<Mat>& frames() const { return *frames_; }
+
+ virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+ virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+ virtual void setBlurrinessRates(const std::vector<float> &val) { blurrinessRates_ = &val; }
+ virtual const std::vector<float>& blurrinessRates() const { return *blurrinessRates_; }
+
+ virtual void update() {}
+
+ virtual void deblur(int idx, Mat &frame) = 0;
+
+protected:
+ int radius_;
+ const std::vector<Mat> *frames_;
+ const std::vector<Mat> *motions_;
+ const std::vector<float> *blurrinessRates_;
+};
+
+class CV_EXPORTS NullDeblurer : public DeblurerBase
+{
+public:
+ virtual void deblur(int /*idx*/, Mat &/*frame*/) {}
+};
+
+class CV_EXPORTS WeightingDeblurer : public DeblurerBase
+{
+public:
+ WeightingDeblurer();
+
+ void setSensitivity(float val) { sensitivity_ = val; }
+ float sensitivity() const { return sensitivity_; }
+
+ virtual void deblur(int idx, Mat &frame);
+
+private:
+ float sensitivity_;
+ Mat_<float> bSum_, gSum_, rSum_, wSum_;
+};
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/fast_marching.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/fast_marching.hpp
new file mode 100644
index 0000000..23c5df3
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/fast_marching.hpp
@@ -0,0 +1,103 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_FAST_MARCHING_HPP__
+#define __OPENCV_VIDEOSTAB_FAST_MARCHING_HPP__
+
+#include <cmath>
+#include <queue>
+#include <algorithm>
+#include "opencv2/core/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+// See http://iwi.eldoc.ub.rug.nl/FILES/root/2004/JGraphToolsTelea/2004JGraphToolsTelea.pdf
+class CV_EXPORTS FastMarchingMethod
+{
+public:
+ FastMarchingMethod() : inf_(1e6f) {}
+
+ template <typename Inpaint>
+ Inpaint run(const Mat &mask, Inpaint inpaint);
+
+ Mat distanceMap() const { return dist_; }
+
+private:
+ enum { INSIDE = 0, BAND = 1, KNOWN = 255 };
+
+ struct DXY
+ {
+ float dist;
+ int x, y;
+
+ DXY() : dist(0), x(0), y(0) {}
+ DXY(float _dist, int _x, int _y) : dist(_dist), x(_x), y(_y) {}
+ bool operator <(const DXY &dxy) const { return dist < dxy.dist; }
+ };
+
+ float solve(int x1, int y1, int x2, int y2) const;
+ int& indexOf(const DXY &dxy) { return index_(dxy.y, dxy.x); }
+
+ void heapUp(int idx);
+ void heapDown(int idx);
+ void heapAdd(const DXY &dxy);
+ void heapRemoveMin();
+
+ float inf_;
+
+ cv::Mat_<uchar> flag_; // flag map
+ cv::Mat_<float> dist_; // distance map
+
+ cv::Mat_<int> index_; // index of point in the narrow band
+ std::vector<DXY> narrowBand_; // narrow band heap
+ int size_; // narrow band size
+};
+
+} // namespace videostab
+} // namespace cv
+
+#include "fast_marching_inl.hpp"
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/fast_marching_inl.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/fast_marching_inl.hpp
new file mode 100644
index 0000000..dc860c2
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/fast_marching_inl.hpp
@@ -0,0 +1,166 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_FAST_MARCHING_INL_HPP__
+#define __OPENCV_VIDEOSTAB_FAST_MARCHING_INL_HPP__
+
+#include "opencv2/videostab/fast_marching.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+template <typename Inpaint>
+Inpaint FastMarchingMethod::run(const cv::Mat &mask, Inpaint inpaint)
+{
+ using namespace std;
+ using namespace cv;
+
+ CV_Assert(mask.type() == CV_8U);
+
+ static const int lut[4][2] = {{-1,0}, {0,-1}, {1,0}, {0,1}};
+
+ mask.copyTo(flag_);
+ flag_.create(mask.size());
+ dist_.create(mask.size());
+ index_.create(mask.size());
+ narrowBand_.clear();
+ size_ = 0;
+
+ // init
+ for (int y = 0; y < flag_.rows; ++y)
+ {
+ for (int x = 0; x < flag_.cols; ++x)
+ {
+ if (flag_(y,x) == KNOWN)
+ dist_(y,x) = 0.f;
+ else
+ {
+ int n = 0;
+ int nunknown = 0;
+
+ for (int i = 0; i < 4; ++i)
+ {
+ int xn = x + lut[i][0];
+ int yn = y + lut[i][1];
+
+ if (xn >= 0 && xn < flag_.cols && yn >= 0 && yn < flag_.rows)
+ {
+ n++;
+ if (flag_(yn,xn) != KNOWN)
+ nunknown++;
+ }
+ }
+
+ if (n>0 && nunknown == n)
+ {
+ dist_(y,x) = inf_;
+ flag_(y,x) = INSIDE;
+ }
+ else
+ {
+ dist_(y,x) = 0.f;
+ flag_(y,x) = BAND;
+ inpaint(x, y);
+
+ narrowBand_.push_back(DXY(0.f,x,y));
+ index_(y,x) = size_++;
+ }
+ }
+ }
+ }
+
+ // make heap
+ for (int i = size_/2-1; i >= 0; --i)
+ heapDown(i);
+
+ // main cycle
+ while (size_ > 0)
+ {
+ int x = narrowBand_[0].x;
+ int y = narrowBand_[0].y;
+ heapRemoveMin();
+
+ flag_(y,x) = KNOWN;
+ for (int n = 0; n < 4; ++n)
+ {
+ int xn = x + lut[n][0];
+ int yn = y + lut[n][1];
+
+ if (xn >= 0 && xn < flag_.cols && yn >= 0 && yn < flag_.rows && flag_(yn,xn) != KNOWN)
+ {
+ dist_(yn,xn) = min(min(solve(xn-1, yn, xn, yn-1), solve(xn+1, yn, xn, yn-1)),
+ min(solve(xn-1, yn, xn, yn+1), solve(xn+1, yn, xn, yn+1)));
+
+ if (flag_(yn,xn) == INSIDE)
+ {
+ flag_(yn,xn) = BAND;
+ inpaint(xn, yn);
+ heapAdd(DXY(dist_(yn,xn),xn,yn));
+ }
+ else
+ {
+ int i = index_(yn,xn);
+ if (dist_(yn,xn) < narrowBand_[i].dist)
+ {
+ narrowBand_[i].dist = dist_(yn,xn);
+ heapUp(i);
+ }
+ // works better if it's commented out
+ /*else if (dist(yn,xn) > narrowBand[i].dist)
+ {
+ narrowBand[i].dist = dist(yn,xn);
+ heapDown(i);
+ }*/
+ }
+ }
+ }
+ }
+
+ return inpaint;
+}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/frame_source.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/frame_source.hpp
new file mode 100644
index 0000000..c22c0a4
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/frame_source.hpp
@@ -0,0 +1,91 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP__
+#define __OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP__
+
+#include <vector>
+#include <string>
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+class CV_EXPORTS IFrameSource
+{
+public:
+ virtual ~IFrameSource() {}
+ virtual void reset() = 0;
+ virtual Mat nextFrame() = 0;
+};
+
+class CV_EXPORTS NullFrameSource : public IFrameSource
+{
+public:
+ virtual void reset() {}
+ virtual Mat nextFrame() { return Mat(); }
+};
+
+class CV_EXPORTS VideoFileSource : public IFrameSource
+{
+public:
+ VideoFileSource(const std::string &path, bool volatileFrame = false);
+
+ virtual void reset();
+ virtual Mat nextFrame();
+
+ int frameCount() { return static_cast<int>(reader_.get(CV_CAP_PROP_FRAME_COUNT)); }
+ double fps() { return reader_.get(CV_CAP_PROP_FPS); }
+
+private:
+ std::string path_;
+ bool volatileFrame_;
+ VideoCapture reader_;
+};
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/global_motion.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/global_motion.hpp
new file mode 100644
index 0000000..f5f34b9
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/global_motion.hpp
@@ -0,0 +1,141 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_GLOBAL_MOTION_HPP__
+#define __OPENCV_VIDEOSTAB_GLOBAL_MOTION_HPP__
+
+#include <vector>
+#include "opencv2/core/core.hpp"
+#include "opencv2/features2d/features2d.hpp"
+#include "opencv2/videostab/optical_flow.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+enum MotionModel
+{
+ TRANSLATION = 0,
+ TRANSLATION_AND_SCALE = 1,
+ LINEAR_SIMILARITY = 2,
+ AFFINE = 3
+};
+
+CV_EXPORTS Mat estimateGlobalMotionLeastSquares(
+ const std::vector<Point2f> &points0, const std::vector<Point2f> &points1,
+ int model = AFFINE, float *rmse = 0);
+
+struct CV_EXPORTS RansacParams
+{
+ int size; // subset size
+ float thresh; // max error to classify as inlier
+ float eps; // max outliers ratio
+ float prob; // probability of success
+
+ RansacParams(int _size, float _thresh, float _eps, float _prob)
+ : size(_size), thresh(_thresh), eps(_eps), prob(_prob) {}
+
+ static RansacParams translationMotionStd() { return RansacParams(2, 0.5f, 0.5f, 0.99f); }
+ static RansacParams translationAndScale2dMotionStd() { return RansacParams(3, 0.5f, 0.5f, 0.99f); }
+ static RansacParams linearSimilarityMotionStd() { return RansacParams(4, 0.5f, 0.5f, 0.99f); }
+ static RansacParams affine2dMotionStd() { return RansacParams(6, 0.5f, 0.5f, 0.99f); }
+};
+
+CV_EXPORTS Mat estimateGlobalMotionRobust(
+ const std::vector<Point2f> &points0, const std::vector<Point2f> &points1,
+ int model = AFFINE, const RansacParams &params = RansacParams::affine2dMotionStd(),
+ float *rmse = 0, int *ninliers = 0);
+
+class CV_EXPORTS IGlobalMotionEstimator
+{
+public:
+ virtual ~IGlobalMotionEstimator() {}
+ virtual Mat estimate(const Mat &frame0, const Mat &frame1) = 0;
+};
+
+class CV_EXPORTS PyrLkRobustMotionEstimator : public IGlobalMotionEstimator
+{
+public:
+ PyrLkRobustMotionEstimator();
+
+ void setDetector(Ptr<FeatureDetector> val) { detector_ = val; }
+ Ptr<FeatureDetector> detector() const { return detector_; }
+
+ void setOptFlowEstimator(Ptr<ISparseOptFlowEstimator> val) { optFlowEstimator_ = val; }
+ Ptr<ISparseOptFlowEstimator> optFlowEstimator() const { return optFlowEstimator_; }
+
+ void setMotionModel(MotionModel val) { motionModel_ = val; }
+ MotionModel motionModel() const { return motionModel_; }
+
+ void setRansacParams(const RansacParams &val) { ransacParams_ = val; }
+ RansacParams ransacParams() const { return ransacParams_; }
+
+ void setMaxRmse(float val) { maxRmse_ = val; }
+ float maxRmse() const { return maxRmse_; }
+
+ void setMinInlierRatio(float val) { minInlierRatio_ = val; }
+ float minInlierRatio() const { return minInlierRatio_; }
+
+ virtual Mat estimate(const Mat &frame0, const Mat &frame1);
+
+private:
+ Ptr<FeatureDetector> detector_;
+ Ptr<ISparseOptFlowEstimator> optFlowEstimator_;
+ MotionModel motionModel_;
+ RansacParams ransacParams_;
+ std::vector<uchar> status_;
+ std::vector<KeyPoint> keypointsPrev_;
+ std::vector<Point2f> pointsPrev_, points_;
+ std::vector<Point2f> pointsPrevGood_, pointsGood_;
+ float maxRmse_;
+ float minInlierRatio_;
+};
+
+CV_EXPORTS Mat getMotion(int from, int to, const Mat *motions, int size);
+
+CV_EXPORTS Mat getMotion(int from, int to, const std::vector<Mat> &motions);
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/inpainting.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/inpainting.hpp
new file mode 100644
index 0000000..8df60f7
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/inpainting.hpp
@@ -0,0 +1,200 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_INPAINTINT_HPP__
+#define __OPENCV_VIDEOSTAB_INPAINTINT_HPP__
+
+#include <vector>
+#include "opencv2/core/core.hpp"
+#include "opencv2/videostab/optical_flow.hpp"
+#include "opencv2/videostab/fast_marching.hpp"
+#include "opencv2/photo/photo.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+class CV_EXPORTS InpainterBase
+{
+public:
+ InpainterBase()
+ : radius_(0), frames_(0), motions_(0),
+ stabilizedFrames_(0), stabilizationMotions_(0) {}
+
+ virtual ~InpainterBase() {}
+
+ virtual void setRadius(int val) { radius_ = val; }
+ virtual int radius() const { return radius_; }
+
+ virtual void setFrames(const std::vector<Mat> &val) { frames_ = &val; }
+ virtual const std::vector<Mat>& frames() const { return *frames_; }
+
+ virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+ virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+ virtual void setStabilizedFrames(const std::vector<Mat> &val) { stabilizedFrames_ = &val; }
+ virtual const std::vector<Mat>& stabilizedFrames() const { return *stabilizedFrames_; }
+
+ virtual void setStabilizationMotions(const std::vector<Mat> &val) { stabilizationMotions_ = &val; }
+ virtual const std::vector<Mat>& stabilizationMotions() const { return *stabilizationMotions_; }
+
+ virtual void update() {}
+
+ virtual void inpaint(int idx, Mat &frame, Mat &mask) = 0;
+
+protected:
+ int radius_;
+ const std::vector<Mat> *frames_;
+ const std::vector<Mat> *motions_;
+ const std::vector<Mat> *stabilizedFrames_;
+ const std::vector<Mat> *stabilizationMotions_;
+};
+
+class CV_EXPORTS NullInpainter : public InpainterBase
+{
+public:
+ virtual void inpaint(int /*idx*/, Mat &/*frame*/, Mat &/*mask*/) {}
+};
+
+class CV_EXPORTS InpaintingPipeline : public InpainterBase
+{
+public:
+ void pushBack(Ptr<InpainterBase> inpainter) { inpainters_.push_back(inpainter); }
+ bool empty() const { return inpainters_.empty(); }
+
+ virtual void setRadius(int val);
+ virtual void setFrames(const std::vector<Mat> &val);
+ virtual void setMotions(const std::vector<Mat> &val);
+ virtual void setStabilizedFrames(const std::vector<Mat> &val);
+ virtual void setStabilizationMotions(const std::vector<Mat> &val);
+
+ virtual void update();
+
+ virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+ std::vector<Ptr<InpainterBase> > inpainters_;
+};
+
+class CV_EXPORTS ConsistentMosaicInpainter : public InpainterBase
+{
+public:
+ ConsistentMosaicInpainter();
+
+ void setStdevThresh(float val) { stdevThresh_ = val; }
+ float stdevThresh() const { return stdevThresh_; }
+
+ virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+ float stdevThresh_;
+};
+
+class CV_EXPORTS MotionInpainter : public InpainterBase
+{
+public:
+ MotionInpainter();
+
+ void setOptFlowEstimator(Ptr<IDenseOptFlowEstimator> val) { optFlowEstimator_ = val; }
+ Ptr<IDenseOptFlowEstimator> optFlowEstimator() const { return optFlowEstimator_; }
+
+ void setFlowErrorThreshold(float val) { flowErrorThreshold_ = val; }
+ float flowErrorThreshold() const { return flowErrorThreshold_; }
+
+ void setDistThreshold(float val) { distThresh_ = val; }
+ float distThresh() const { return distThresh_; }
+
+ void setBorderMode(int val) { borderMode_ = val; }
+ int borderMode() const { return borderMode_; }
+
+ virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+ FastMarchingMethod fmm_;
+ Ptr<IDenseOptFlowEstimator> optFlowEstimator_;
+ float flowErrorThreshold_;
+ float distThresh_;
+ int borderMode_;
+
+ Mat frame1_, transformedFrame1_;
+ Mat_<uchar> grayFrame_, transformedGrayFrame1_;
+ Mat_<uchar> mask1_, transformedMask1_;
+ Mat_<float> flowX_, flowY_, flowErrors_;
+ Mat_<uchar> flowMask_;
+};
+
+class CV_EXPORTS ColorAverageInpainter : public InpainterBase
+{
+public:
+ virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+ FastMarchingMethod fmm_;
+};
+
+class CV_EXPORTS ColorInpainter : public InpainterBase
+{
+public:
+ ColorInpainter(int method = INPAINT_TELEA, double _radius = 2.)
+ : method_(method), radius_(_radius) {}
+
+ virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+ int method_;
+ double radius_;
+ Mat invMask_;
+};
+
+CV_EXPORTS void calcFlowMask(
+ const Mat &flowX, const Mat &flowY, const Mat &errors, float maxError,
+ const Mat &mask0, const Mat &mask1, Mat &flowMask);
+
+CV_EXPORTS void completeFrameAccordingToFlow(
+ const Mat &flowMask, const Mat &flowX, const Mat &flowY, const Mat &frame1, const Mat &mask1,
+ float distThresh, Mat& frame0, Mat &mask0);
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/log.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/log.hpp
new file mode 100644
index 0000000..ce6fadf
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/log.hpp
@@ -0,0 +1,75 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_LOG_HPP__
+#define __OPENCV_VIDEOSTAB_LOG_HPP__
+
+#include "opencv2/core/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+class CV_EXPORTS ILog
+{
+public:
+ virtual ~ILog() {}
+ virtual void print(const char *format, ...) = 0;
+};
+
+class CV_EXPORTS NullLog : public ILog
+{
+public:
+ virtual void print(const char * /*format*/, ...) {}
+};
+
+class CV_EXPORTS LogToStdout : public ILog
+{
+public:
+ virtual void print(const char *format, ...);
+};
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/motion_stabilizing.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/motion_stabilizing.hpp
new file mode 100644
index 0000000..de05ad2
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/motion_stabilizing.hpp
@@ -0,0 +1,106 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_MOTION_STABILIZING_HPP__
+#define __OPENCV_VIDEOSTAB_MOTION_STABILIZING_HPP__
+
+#include <vector>
+#include "opencv2/core/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+class CV_EXPORTS IMotionStabilizer
+{
+public:
+ virtual void stabilize(const Mat *motions, int size, Mat *stabilizationMotions) const = 0;
+
+#ifdef OPENCV_CAN_BREAK_BINARY_COMPATIBILITY
+ virtual ~IMotionStabilizer() {}
+#endif
+};
+
+class CV_EXPORTS MotionFilterBase : public IMotionStabilizer
+{
+public:
+ MotionFilterBase() : radius_(0) {}
+ virtual ~MotionFilterBase() {}
+
+ virtual void setRadius(int val) { radius_ = val; }
+ virtual int radius() const { return radius_; }
+
+ virtual void update() {}
+
+ virtual Mat stabilize(int index, const Mat *motions, int size) const = 0;
+ virtual void stabilize(const Mat *motions, int size, Mat *stabilizationMotions) const;
+
+protected:
+ int radius_;
+};
+
+class CV_EXPORTS GaussianMotionFilter : public MotionFilterBase
+{
+public:
+ GaussianMotionFilter() : stdev_(-1.f) {}
+
+ void setStdev(float val) { stdev_ = val; }
+ float stdev() const { return stdev_; }
+
+ virtual void update();
+
+ virtual Mat stabilize(int index, const Mat *motions, int size) const;
+
+private:
+ float stdev_;
+ std::vector<float> weight_;
+};
+
+CV_EXPORTS Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio);
+
+CV_EXPORTS float estimateOptimalTrimRatio(const Mat &M, Size size);
+
+} // namespace videostab
+} // namespace
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/optical_flow.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/optical_flow.hpp
new file mode 100644
index 0000000..2c1742f
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/optical_flow.hpp
@@ -0,0 +1,120 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
+#define __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
+
+#include "opencv2/core/core.hpp"
+#include "opencv2/opencv_modules.hpp"
+
+#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+# include "opencv2/gpu/gpu.hpp"
+#endif
+
+namespace cv
+{
+namespace videostab
+{
+
+class CV_EXPORTS ISparseOptFlowEstimator
+{
+public:
+ virtual ~ISparseOptFlowEstimator() {}
+ virtual void run(
+ InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+ OutputArray status, OutputArray errors) = 0;
+};
+
+class CV_EXPORTS IDenseOptFlowEstimator
+{
+public:
+ virtual ~IDenseOptFlowEstimator() {}
+ virtual void run(
+ InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
+ OutputArray errors) = 0;
+};
+
+class CV_EXPORTS PyrLkOptFlowEstimatorBase
+{
+public:
+ PyrLkOptFlowEstimatorBase() { setWinSize(Size(21, 21)); setMaxLevel(3); }
+
+ void setWinSize(Size val) { winSize_ = val; }
+ Size winSize() const { return winSize_; }
+
+ void setMaxLevel(int val) { maxLevel_ = val; }
+ int maxLevel() const { return maxLevel_; }
+
+protected:
+ Size winSize_;
+ int maxLevel_;
+};
+
+class CV_EXPORTS SparsePyrLkOptFlowEstimator
+ : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator
+{
+public:
+ virtual void run(
+ InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+ OutputArray status, OutputArray errors);
+};
+
+#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
+class CV_EXPORTS DensePyrLkOptFlowEstimatorGpu
+ : public PyrLkOptFlowEstimatorBase, public IDenseOptFlowEstimator
+{
+public:
+ DensePyrLkOptFlowEstimatorGpu();
+
+ virtual void run(
+ InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
+ OutputArray errors);
+private:
+ gpu::PyrLKOpticalFlow optFlowEstimator_;
+ gpu::GpuMat frame0_, frame1_, flowX_, flowY_, errors_;
+};
+#endif
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/stabilizer.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/stabilizer.hpp
new file mode 100644
index 0000000..d1d5388
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/stabilizer.hpp
@@ -0,0 +1,187 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_STABILIZER_HPP__
+#define __OPENCV_VIDEOSTAB_STABILIZER_HPP__
+
+#include <vector>
+#include "opencv2/core/core.hpp"
+#include "opencv2/imgproc/imgproc.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/videostab/motion_stabilizing.hpp"
+#include "opencv2/videostab/frame_source.hpp"
+#include "opencv2/videostab/log.hpp"
+#include "opencv2/videostab/inpainting.hpp"
+#include "opencv2/videostab/deblurring.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+class CV_EXPORTS StabilizerBase
+{
+public:
+ virtual ~StabilizerBase() {}
+
+ void setLog(Ptr<ILog> _log) { log_ = _log; }
+ Ptr<ILog> log() const { return log_; }
+
+ void setRadius(int val) { radius_ = val; }
+ int radius() const { return radius_; }
+
+ void setFrameSource(Ptr<IFrameSource> val) { frameSource_ = val; }
+ Ptr<IFrameSource> frameSource() const { return frameSource_; }
+
+ void setMotionEstimator(Ptr<IGlobalMotionEstimator> val) { motionEstimator_ = val; }
+ Ptr<IGlobalMotionEstimator> motionEstimator() const { return motionEstimator_; }
+
+ void setDeblurer(Ptr<DeblurerBase> val) { deblurer_ = val; }
+ Ptr<DeblurerBase> deblurrer() const { return deblurer_; }
+
+ void setTrimRatio(float val) { trimRatio_ = val; }
+ float trimRatio() const { return trimRatio_; }
+
+ void setCorrectionForInclusion(bool val) { doCorrectionForInclusion_ = val; }
+ bool doCorrectionForInclusion() const { return doCorrectionForInclusion_; }
+
+ void setBorderMode(int val) { borderMode_ = val; }
+ int borderMode() const { return borderMode_; }
+
+ void setInpainter(Ptr<InpainterBase> val) { inpainter_ = val; }
+ Ptr<InpainterBase> inpainter() const { return inpainter_; }
+
+protected:
+ StabilizerBase();
+
+ void setUp(int cacheSize, const Mat &frame);
+ Mat nextStabilizedFrame();
+ bool doOneIteration();
+ void stabilizeFrame(const Mat &stabilizationMotion);
+
+ virtual void setUp(Mat &firstFrame) = 0;
+ virtual void stabilizeFrame() = 0;
+ virtual void estimateMotion() = 0;
+
+ Ptr<ILog> log_;
+ Ptr<IFrameSource> frameSource_;
+ Ptr<IGlobalMotionEstimator> motionEstimator_;
+ Ptr<DeblurerBase> deblurer_;
+ Ptr<InpainterBase> inpainter_;
+ int radius_;
+ float trimRatio_;
+ bool doCorrectionForInclusion_;
+ int borderMode_;
+
+ Size frameSize_;
+ Mat frameMask_;
+ int curPos_;
+ int curStabilizedPos_;
+ bool doDeblurring_;
+ Mat preProcessedFrame_;
+ bool doInpainting_;
+ Mat inpaintingMask_;
+ std::vector<Mat> frames_;
+ std::vector<Mat> motions_; // motions_[i] is the motion from i-th to i+1-th frame
+ std::vector<float> blurrinessRates_;
+ std::vector<Mat> stabilizedFrames_;
+ std::vector<Mat> stabilizedMasks_;
+ std::vector<Mat> stabilizationMotions_;
+};
+
+class CV_EXPORTS OnePassStabilizer : public StabilizerBase, public IFrameSource
+{
+public:
+ OnePassStabilizer();
+
+ void setMotionFilter(Ptr<MotionFilterBase> val) { motionFilter_ = val; }
+ Ptr<MotionFilterBase> motionFilter() const { return motionFilter_; }
+
+ virtual void reset() { resetImpl(); }
+ virtual Mat nextFrame() { return nextStabilizedFrame(); }
+
+private:
+ void resetImpl();
+
+ virtual void setUp(Mat &firstFrame);
+ virtual void estimateMotion();
+ virtual void stabilizeFrame();
+
+ Ptr<MotionFilterBase> motionFilter_;
+};
+
+class CV_EXPORTS TwoPassStabilizer : public StabilizerBase, public IFrameSource
+{
+public:
+ TwoPassStabilizer();
+
+ void setMotionStabilizer(Ptr<IMotionStabilizer> val) { motionStabilizer_ = val; }
+ Ptr<IMotionStabilizer> motionStabilizer() const { return motionStabilizer_; }
+
+ void setEstimateTrimRatio(bool val) { mustEstTrimRatio_ = val; }
+ bool mustEstimateTrimaRatio() const { return mustEstTrimRatio_; }
+
+ virtual void reset() { resetImpl(); }
+ virtual Mat nextFrame();
+
+ // available after pre-pass, before it's empty
+ std::vector<Mat> motions() const;
+
+private:
+ void resetImpl();
+ void runPrePassIfNecessary();
+
+ virtual void setUp(Mat &firstFrame);
+ virtual void estimateMotion() { /* do nothing as motion was estimation in pre-pass */ }
+ virtual void stabilizeFrame();
+
+ Ptr<IMotionStabilizer> motionStabilizer_;
+ bool mustEstTrimRatio_;
+
+ int frameCount_;
+ bool isPrePassDone_;
+};
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty/includes/OpenCV/opencv2/videostab/videostab.hpp b/thirdparty/includes/OpenCV/opencv2/videostab/videostab.hpp
new file mode 100644
index 0000000..3ea34a8
--- /dev/null
+++ b/thirdparty/includes/OpenCV/opencv2/videostab/videostab.hpp
@@ -0,0 +1,48 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef __OPENCV_VIDEOSTAB_HPP__
+#define __OPENCV_VIDEOSTAB_HPP__
+
+#include "opencv2/videostab/stabilizer.hpp"
+
+#endif