summaryrefslogtreecommitdiff
path: root/thirdparty1/linux/include/opencv2/videostab
diff options
context:
space:
mode:
authorshamikam2017-01-16 02:56:17 +0530
committershamikam2017-01-16 02:56:17 +0530
commita6df67e8bcd5159cde27556f4f6a315f8dc2215f (patch)
treee806e966b06a53388fb300d89534354b222c2cad /thirdparty1/linux/include/opencv2/videostab
downloadFOSSEE_Image_Processing_Toolbox-a6df67e8bcd5159cde27556f4f6a315f8dc2215f.tar.gz
FOSSEE_Image_Processing_Toolbox-a6df67e8bcd5159cde27556f4f6a315f8dc2215f.tar.bz2
FOSSEE_Image_Processing_Toolbox-a6df67e8bcd5159cde27556f4f6a315f8dc2215f.zip
First CommitHEADmaster
Diffstat (limited to 'thirdparty1/linux/include/opencv2/videostab')
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/deblurring.hpp116
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/fast_marching.hpp121
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/fast_marching_inl.hpp165
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/frame_source.hpp94
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/global_motion.hpp299
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/inpainting.hpp212
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/log.hpp80
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/motion_core.hpp129
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/motion_stabilizing.hpp174
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/optical_flow.hpp150
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/outlier_rejection.hpp101
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/ring_buffer.hpp72
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/stabilizer.hpp200
-rw-r--r--thirdparty1/linux/include/opencv2/videostab/wobble_suppression.hpp140
14 files changed, 2053 insertions, 0 deletions
diff --git a/thirdparty1/linux/include/opencv2/videostab/deblurring.hpp b/thirdparty1/linux/include/opencv2/videostab/deblurring.hpp
new file mode 100644
index 0000000..b383f0d
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/deblurring.hpp
@@ -0,0 +1,116 @@
+/*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.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+CV_EXPORTS float calcBlurriness(const Mat &frame);
+
+class CV_EXPORTS DeblurerBase
+{
+public:
+ DeblurerBase() : radius_(0), frames_(0), motions_(0), blurrinessRates_(0) {}
+
+ virtual ~DeblurerBase() {}
+
+ virtual void setRadius(int val) { radius_ = val; }
+ virtual int radius() const { return radius_; }
+
+ virtual void deblur(int idx, Mat &frame) = 0;
+
+
+ // data from stabilizer
+
+ 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_; }
+
+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/thirdparty1/linux/include/opencv2/videostab/fast_marching.hpp b/thirdparty1/linux/include/opencv2/videostab/fast_marching.hpp
new file mode 100644
index 0000000..526b10b
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/fast_marching.hpp
@@ -0,0 +1,121 @@
+/*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.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_marching
+//! @{
+
+/** @brief Describes the Fast Marching Method implementation.
+
+ See http://iwi.eldoc.ub.rug.nl/FILES/root/2004/JGraphToolsTelea/2004JGraphToolsTelea.pdf
+ */
+class CV_EXPORTS FastMarchingMethod
+{
+public:
+ FastMarchingMethod() : inf_(1e6f) {}
+
+ /** @brief Template method that runs the Fast Marching Method.
+
+ @param mask Image mask. 0 value indicates that the pixel value must be inpainted, 255 indicates
+ that the pixel value is known, other values aren't acceptable.
+ @param inpaint Inpainting functor that overloads void operator ()(int x, int y).
+ @return Inpainting functor.
+ */
+ template <typename Inpaint>
+ Inpaint run(const Mat &mask, Inpaint inpaint);
+
+ /**
+ @return Distance map that's created during working of the method.
+ */
+ 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/thirdparty1/linux/include/opencv2/videostab/fast_marching_inl.hpp b/thirdparty1/linux/include/opencv2/videostab/fast_marching_inl.hpp
new file mode 100644
index 0000000..fdd488a
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/fast_marching_inl.hpp
@@ -0,0 +1,165 @@
+/*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 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) = std::min(std::min(solve(xn-1, yn, xn, yn-1), solve(xn+1, yn, xn, yn-1)),
+ std::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/thirdparty1/linux/include/opencv2/videostab/frame_source.hpp b/thirdparty1/linux/include/opencv2/videostab/frame_source.hpp
new file mode 100644
index 0000000..e4e00b5
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/frame_source.hpp
@@ -0,0 +1,94 @@
+/*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 "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup 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 String &path, bool volatileFrame = false);
+
+ virtual void reset();
+ virtual Mat nextFrame();
+
+ int width();
+ int height();
+ int count();
+ double fps();
+
+private:
+ Ptr<IFrameSource> impl;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty1/linux/include/opencv2/videostab/global_motion.hpp b/thirdparty1/linux/include/opencv2/videostab/global_motion.hpp
new file mode 100644
index 0000000..80b147a
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/global_motion.hpp
@@ -0,0 +1,299 @@
+/*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 <fstream>
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/opencv_modules.hpp"
+#include "opencv2/videostab/optical_flow.hpp"
+#include "opencv2/videostab/motion_core.hpp"
+#include "opencv2/videostab/outlier_rejection.hpp"
+
+#ifdef HAVE_OPENCV_CUDAIMGPROC
+# include "opencv2/cudaimgproc.hpp"
+#endif
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+/** @brief Estimates best global motion between two 2D point clouds in the least-squares sense.
+
+@note Works in-place and changes input point arrays.
+
+@param points0 Source set of 2D points (32F).
+@param points1 Destination set of 2D points (32F).
+@param model Motion model (up to MM_AFFINE).
+@param rmse Final root-mean-square error.
+@return 3x3 2D transformation matrix (32F).
+ */
+CV_EXPORTS Mat estimateGlobalMotionLeastSquares(
+ InputOutputArray points0, InputOutputArray points1, int model = MM_AFFINE,
+ float *rmse = 0);
+
+/** @brief Estimates best global motion between two 2D point clouds robustly (using RANSAC method).
+
+@param points0 Source set of 2D points (32F).
+@param points1 Destination set of 2D points (32F).
+@param model Motion model. See cv::videostab::MotionModel.
+@param params RANSAC method parameters. See videostab::RansacParams.
+@param rmse Final root-mean-square error.
+@param ninliers Final number of inliers.
+ */
+CV_EXPORTS Mat estimateGlobalMotionRansac(
+ InputArray points0, InputArray points1, int model = MM_AFFINE,
+ const RansacParams &params = RansacParams::default2dMotion(MM_AFFINE),
+ float *rmse = 0, int *ninliers = 0);
+
+/** @brief Base class for all global motion estimation methods.
+ */
+class CV_EXPORTS MotionEstimatorBase
+{
+public:
+ virtual ~MotionEstimatorBase() {}
+
+ /** @brief Sets motion model.
+
+ @param val Motion model. See cv::videostab::MotionModel.
+ */
+ virtual void setMotionModel(MotionModel val) { motionModel_ = val; }
+
+ /**
+ @return Motion model. See cv::videostab::MotionModel.
+ */
+ virtual MotionModel motionModel() const { return motionModel_; }
+
+ /** @brief Estimates global motion between two 2D point clouds.
+
+ @param points0 Source set of 2D points (32F).
+ @param points1 Destination set of 2D points (32F).
+ @param ok Indicates whether motion was estimated successfully.
+ @return 3x3 2D transformation matrix (32F).
+ */
+ virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0) = 0;
+
+protected:
+ MotionEstimatorBase(MotionModel model) { setMotionModel(model); }
+
+private:
+ MotionModel motionModel_;
+};
+
+/** @brief Describes a robust RANSAC-based global 2D motion estimation method which minimizes L2 error.
+ */
+class CV_EXPORTS MotionEstimatorRansacL2 : public MotionEstimatorBase
+{
+public:
+ MotionEstimatorRansacL2(MotionModel model = MM_AFFINE);
+
+ void setRansacParams(const RansacParams &val) { ransacParams_ = val; }
+ RansacParams ransacParams() const { return ransacParams_; }
+
+ void setMinInlierRatio(float val) { minInlierRatio_ = val; }
+ float minInlierRatio() const { return minInlierRatio_; }
+
+ virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0);
+
+private:
+ RansacParams ransacParams_;
+ float minInlierRatio_;
+};
+
+/** @brief Describes a global 2D motion estimation method which minimizes L1 error.
+
+@note To be able to use this method you must build OpenCV with CLP library support. :
+ */
+class CV_EXPORTS MotionEstimatorL1 : public MotionEstimatorBase
+{
+public:
+ MotionEstimatorL1(MotionModel model = MM_AFFINE);
+
+ virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0);
+
+private:
+ std::vector<double> obj_, collb_, colub_;
+ std::vector<double> elems_, rowlb_, rowub_;
+ std::vector<int> rows_, cols_;
+
+ void set(int row, int col, double coef)
+ {
+ rows_.push_back(row);
+ cols_.push_back(col);
+ elems_.push_back(coef);
+ }
+};
+
+/** @brief Base class for global 2D motion estimation methods which take frames as input.
+ */
+class CV_EXPORTS ImageMotionEstimatorBase
+{
+public:
+ virtual ~ImageMotionEstimatorBase() {}
+
+ virtual void setMotionModel(MotionModel val) { motionModel_ = val; }
+ virtual MotionModel motionModel() const { return motionModel_; }
+
+ virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) = 0;
+
+protected:
+ ImageMotionEstimatorBase(MotionModel model) { setMotionModel(model); }
+
+private:
+ MotionModel motionModel_;
+};
+
+class CV_EXPORTS FromFileMotionReader : public ImageMotionEstimatorBase
+{
+public:
+ FromFileMotionReader(const String &path);
+
+ virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+ std::ifstream file_;
+};
+
+class CV_EXPORTS ToFileMotionWriter : public ImageMotionEstimatorBase
+{
+public:
+ ToFileMotionWriter(const String &path, Ptr<ImageMotionEstimatorBase> estimator);
+
+ virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+ virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+ virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+ std::ofstream file_;
+ Ptr<ImageMotionEstimatorBase> motionEstimator_;
+};
+
+/** @brief Describes a global 2D motion estimation method which uses keypoints detection and optical flow for
+matching.
+ */
+class CV_EXPORTS KeypointBasedMotionEstimator : public ImageMotionEstimatorBase
+{
+public:
+ KeypointBasedMotionEstimator(Ptr<MotionEstimatorBase> estimator);
+
+ virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+ virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+ void setDetector(Ptr<FeatureDetector> val) { detector_ = val; }
+ Ptr<FeatureDetector> detector() const { return detector_; }
+
+ void setOpticalFlowEstimator(Ptr<ISparseOptFlowEstimator> val) { optFlowEstimator_ = val; }
+ Ptr<ISparseOptFlowEstimator> opticalFlowEstimator() const { return optFlowEstimator_; }
+
+ void setOutlierRejector(Ptr<IOutlierRejector> val) { outlierRejector_ = val; }
+ Ptr<IOutlierRejector> outlierRejector() const { return outlierRejector_; }
+
+ virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+ Ptr<MotionEstimatorBase> motionEstimator_;
+ Ptr<FeatureDetector> detector_;
+ Ptr<ISparseOptFlowEstimator> optFlowEstimator_;
+ Ptr<IOutlierRejector> outlierRejector_;
+
+ std::vector<uchar> status_;
+ std::vector<KeyPoint> keypointsPrev_;
+ std::vector<Point2f> pointsPrev_, points_;
+ std::vector<Point2f> pointsPrevGood_, pointsGood_;
+};
+
+#if defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW)
+
+class CV_EXPORTS KeypointBasedMotionEstimatorGpu : public ImageMotionEstimatorBase
+{
+public:
+ KeypointBasedMotionEstimatorGpu(Ptr<MotionEstimatorBase> estimator);
+
+ virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+ virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+ void setOutlierRejector(Ptr<IOutlierRejector> val) { outlierRejector_ = val; }
+ Ptr<IOutlierRejector> outlierRejector() const { return outlierRejector_; }
+
+ virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+ Mat estimate(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, bool *ok = 0);
+
+private:
+ Ptr<MotionEstimatorBase> motionEstimator_;
+ Ptr<cuda::CornersDetector> detector_;
+ SparsePyrLkOptFlowEstimatorGpu optFlowEstimator_;
+ Ptr<IOutlierRejector> outlierRejector_;
+
+ cuda::GpuMat frame0_, grayFrame0_, frame1_;
+ cuda::GpuMat pointsPrev_, points_;
+ cuda::GpuMat status_;
+
+ Mat hostPointsPrev_, hostPoints_;
+ std::vector<Point2f> hostPointsPrevTmp_, hostPointsTmp_;
+ std::vector<uchar> rejectionStatus_;
+};
+
+#endif // defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW)
+
+/** @brief Computes motion between two frames assuming that all the intermediate motions are known.
+
+@param from Source frame index.
+@param to Destination frame index.
+@param motions Pair-wise motions. motions[i] denotes motion from the frame i to the frame i+1
+@return Motion from the frame from to the frame to.
+ */
+CV_EXPORTS Mat getMotion(int from, int to, const std::vector<Mat> &motions);
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty1/linux/include/opencv2/videostab/inpainting.hpp b/thirdparty1/linux/include/opencv2/videostab/inpainting.hpp
new file mode 100644
index 0000000..61eeec3
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/inpainting.hpp
@@ -0,0 +1,212 @@
+/*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.hpp"
+#include "opencv2/videostab/optical_flow.hpp"
+#include "opencv2/videostab/fast_marching.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/photo.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS InpainterBase
+{
+public:
+ InpainterBase()
+ : radius_(0), motionModel_(MM_UNKNOWN), 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 setMotionModel(MotionModel val) { motionModel_ = val; }
+ virtual MotionModel motionModel() const { return motionModel_; }
+
+ virtual void inpaint(int idx, Mat &frame, Mat &mask) = 0;
+
+
+ // data from stabilizer
+
+ 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_; }
+
+protected:
+ int radius_;
+ MotionModel motionModel_;
+ 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 setMotionModel(MotionModel 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 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.);
+
+ virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+ int method_;
+ double radius_;
+ Mat invMask_;
+};
+
+inline ColorInpainter::ColorInpainter(int _method, double _radius)
+ : method_(_method), radius_(_radius) {}
+
+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/thirdparty1/linux/include/opencv2/videostab/log.hpp b/thirdparty1/linux/include/opencv2/videostab/log.hpp
new file mode 100644
index 0000000..81c634a
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/log.hpp
@@ -0,0 +1,80 @@
+/*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.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup 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/thirdparty1/linux/include/opencv2/videostab/motion_core.hpp b/thirdparty1/linux/include/opencv2/videostab/motion_core.hpp
new file mode 100644
index 0000000..4525cc7
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/motion_core.hpp
@@ -0,0 +1,129 @@
+/*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_CORE_HPP
+#define OPENCV_VIDEOSTAB_MOTION_CORE_HPP
+
+#include <cmath>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+/** @brief Describes motion model between two point clouds.
+ */
+enum MotionModel
+{
+ MM_TRANSLATION = 0,
+ MM_TRANSLATION_AND_SCALE = 1,
+ MM_ROTATION = 2,
+ MM_RIGID = 3,
+ MM_SIMILARITY = 4,
+ MM_AFFINE = 5,
+ MM_HOMOGRAPHY = 6,
+ MM_UNKNOWN = 7
+};
+
+/** @brief Describes RANSAC method parameters.
+ */
+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() : size(0), thresh(0), eps(0), prob(0) {}
+ /** @brief Constructor
+ @param size Subset size.
+ @param thresh Maximum re-projection error value to classify as inlier.
+ @param eps Maximum ratio of incorrect correspondences.
+ @param prob Required success probability.
+ */
+ RansacParams(int size, float thresh, float eps, float prob);
+
+ /**
+ @return Number of iterations that'll be performed by RANSAC method.
+ */
+ int niters() const
+ {
+ return static_cast<int>(
+ std::ceil(std::log(1 - prob) / std::log(1 - std::pow(1 - eps, size))));
+ }
+
+ /**
+ @param model Motion model. See cv::videostab::MotionModel.
+ @return Default RANSAC method parameters for the given motion model.
+ */
+ static RansacParams default2dMotion(MotionModel model)
+ {
+ CV_Assert(model < MM_UNKNOWN);
+ if (model == MM_TRANSLATION)
+ return RansacParams(1, 0.5f, 0.5f, 0.99f);
+ if (model == MM_TRANSLATION_AND_SCALE)
+ return RansacParams(2, 0.5f, 0.5f, 0.99f);
+ if (model == MM_ROTATION)
+ return RansacParams(1, 0.5f, 0.5f, 0.99f);
+ if (model == MM_RIGID)
+ return RansacParams(2, 0.5f, 0.5f, 0.99f);
+ if (model == MM_SIMILARITY)
+ return RansacParams(2, 0.5f, 0.5f, 0.99f);
+ if (model == MM_AFFINE)
+ return RansacParams(3, 0.5f, 0.5f, 0.99f);
+ return RansacParams(4, 0.5f, 0.5f, 0.99f);
+ }
+};
+
+inline RansacParams::RansacParams(int _size, float _thresh, float _eps, float _prob)
+ : size(_size), thresh(_thresh), eps(_eps), prob(_prob) {}
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty1/linux/include/opencv2/videostab/motion_stabilizing.hpp b/thirdparty1/linux/include/opencv2/videostab/motion_stabilizing.hpp
new file mode 100644
index 0000000..5ea5a65
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/motion_stabilizing.hpp
@@ -0,0 +1,174 @@
+/*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 <utility>
+#include "opencv2/core.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+class CV_EXPORTS IMotionStabilizer
+{
+public:
+ virtual ~IMotionStabilizer() {}
+
+ //! assumes that [0, size-1) is in or equals to [range.first, range.second)
+ virtual void stabilize(
+ int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+ Mat *stabilizationMotions) = 0;
+};
+
+class CV_EXPORTS MotionStabilizationPipeline : public IMotionStabilizer
+{
+public:
+ void pushBack(Ptr<IMotionStabilizer> stabilizer) { stabilizers_.push_back(stabilizer); }
+ bool empty() const { return stabilizers_.empty(); }
+
+ virtual void stabilize(
+ int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+ Mat *stabilizationMotions);
+
+private:
+ std::vector<Ptr<IMotionStabilizer> > stabilizers_;
+};
+
+class CV_EXPORTS MotionFilterBase : public IMotionStabilizer
+{
+public:
+ virtual ~MotionFilterBase() {}
+
+ virtual Mat stabilize(
+ int idx, const std::vector<Mat> &motions, std::pair<int,int> range) = 0;
+
+ virtual void stabilize(
+ int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+ Mat *stabilizationMotions);
+};
+
+class CV_EXPORTS GaussianMotionFilter : public MotionFilterBase
+{
+public:
+ GaussianMotionFilter(int radius = 15, float stdev = -1.f);
+
+ void setParams(int radius, float stdev = -1.f);
+ int radius() const { return radius_; }
+ float stdev() const { return stdev_; }
+
+ virtual Mat stabilize(
+ int idx, const std::vector<Mat> &motions, std::pair<int,int> range);
+
+private:
+ int radius_;
+ float stdev_;
+ std::vector<float> weight_;
+};
+
+inline GaussianMotionFilter::GaussianMotionFilter(int _radius, float _stdev) { setParams(_radius, _stdev); }
+
+class CV_EXPORTS LpMotionStabilizer : public IMotionStabilizer
+{
+public:
+ LpMotionStabilizer(MotionModel model = MM_SIMILARITY);
+
+ void setMotionModel(MotionModel val) { model_ = val; }
+ MotionModel motionModel() const { return model_; }
+
+ void setFrameSize(Size val) { frameSize_ = val; }
+ Size frameSize() const { return frameSize_; }
+
+ void setTrimRatio(float val) { trimRatio_ = val; }
+ float trimRatio() const { return trimRatio_; }
+
+ void setWeight1(float val) { w1_ = val; }
+ float weight1() const { return w1_; }
+
+ void setWeight2(float val) { w2_ = val; }
+ float weight2() const { return w2_; }
+
+ void setWeight3(float val) { w3_ = val; }
+ float weight3() const { return w3_; }
+
+ void setWeight4(float val) { w4_ = val; }
+ float weight4() const { return w4_; }
+
+ virtual void stabilize(
+ int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+ Mat *stabilizationMotions);
+
+private:
+ MotionModel model_;
+ Size frameSize_;
+ float trimRatio_;
+ float w1_, w2_, w3_, w4_;
+
+ std::vector<double> obj_, collb_, colub_;
+ std::vector<int> rows_, cols_;
+ std::vector<double> elems_, rowlb_, rowub_;
+
+ void set(int row, int col, double coef)
+ {
+ rows_.push_back(row);
+ cols_.push_back(col);
+ elems_.push_back(coef);
+ }
+};
+
+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/thirdparty1/linux/include/opencv2/videostab/optical_flow.hpp b/thirdparty1/linux/include/opencv2/videostab/optical_flow.hpp
new file mode 100644
index 0000000..d631488
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/optical_flow.hpp
@@ -0,0 +1,150 @@
+/*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.hpp"
+#include "opencv2/opencv_modules.hpp"
+
+#ifdef HAVE_OPENCV_CUDAOPTFLOW
+ #include "opencv2/cudaoptflow.hpp"
+#endif
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup 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); }
+
+ virtual void setWinSize(Size val) { winSize_ = val; }
+ virtual Size winSize() const { return winSize_; }
+
+ virtual void setMaxLevel(int val) { maxLevel_ = val; }
+ virtual int maxLevel() const { return maxLevel_; }
+ virtual ~PyrLkOptFlowEstimatorBase() {}
+
+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);
+};
+
+#ifdef HAVE_OPENCV_CUDAOPTFLOW
+
+class CV_EXPORTS SparsePyrLkOptFlowEstimatorGpu
+ : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator
+{
+public:
+ SparsePyrLkOptFlowEstimatorGpu();
+
+ virtual void run(
+ InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+ OutputArray status, OutputArray errors);
+
+ void run(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, const cuda::GpuMat &points0, cuda::GpuMat &points1,
+ cuda::GpuMat &status, cuda::GpuMat &errors);
+
+ void run(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, const cuda::GpuMat &points0, cuda::GpuMat &points1,
+ cuda::GpuMat &status);
+
+private:
+ Ptr<cuda::SparsePyrLKOpticalFlow> optFlowEstimator_;
+ cuda::GpuMat frame0_, frame1_, points0_, points1_, status_, errors_;
+};
+
+class CV_EXPORTS DensePyrLkOptFlowEstimatorGpu
+ : public PyrLkOptFlowEstimatorBase, public IDenseOptFlowEstimator
+{
+public:
+ DensePyrLkOptFlowEstimatorGpu();
+
+ virtual void run(
+ InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
+ OutputArray errors);
+
+private:
+ Ptr<cuda::DensePyrLKOpticalFlow> optFlowEstimator_;
+ cuda::GpuMat frame0_, frame1_, flowX_, flowY_, errors_;
+};
+
+#endif
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty1/linux/include/opencv2/videostab/outlier_rejection.hpp b/thirdparty1/linux/include/opencv2/videostab/outlier_rejection.hpp
new file mode 100644
index 0000000..9b9b384
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/outlier_rejection.hpp
@@ -0,0 +1,101 @@
+/*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_OUTLIER_REJECTION_HPP
+#define OPENCV_VIDEOSTAB_OUTLIER_REJECTION_HPP
+
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/videostab/motion_core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS IOutlierRejector
+{
+public:
+ virtual ~IOutlierRejector() {}
+
+ virtual void process(
+ Size frameSize, InputArray points0, InputArray points1, OutputArray mask) = 0;
+};
+
+class CV_EXPORTS NullOutlierRejector : public IOutlierRejector
+{
+public:
+ virtual void process(
+ Size frameSize, InputArray points0, InputArray points1, OutputArray mask);
+};
+
+class CV_EXPORTS TranslationBasedLocalOutlierRejector : public IOutlierRejector
+{
+public:
+ TranslationBasedLocalOutlierRejector();
+
+ void setCellSize(Size val) { cellSize_ = val; }
+ Size cellSize() const { return cellSize_; }
+
+ void setRansacParams(RansacParams val) { ransacParams_ = val; }
+ RansacParams ransacParams() const { return ransacParams_; }
+
+ virtual void process(
+ Size frameSize, InputArray points0, InputArray points1, OutputArray mask);
+
+private:
+ Size cellSize_;
+ RansacParams ransacParams_;
+
+ typedef std::vector<int> Cell;
+ std::vector<Cell> grid_;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty1/linux/include/opencv2/videostab/ring_buffer.hpp b/thirdparty1/linux/include/opencv2/videostab/ring_buffer.hpp
new file mode 100644
index 0000000..55d5244
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/ring_buffer.hpp
@@ -0,0 +1,72 @@
+/*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_RING_BUFFER_HPP
+#define OPENCV_VIDEOSTAB_RING_BUFFER_HPP
+
+#include <vector>
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+template <typename T> inline T& at(int idx, std::vector<T> &items)
+{
+ return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
+}
+
+template <typename T> inline const T& at(int idx, const std::vector<T> &items)
+{
+ return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
+}
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty1/linux/include/opencv2/videostab/stabilizer.hpp b/thirdparty1/linux/include/opencv2/videostab/stabilizer.hpp
new file mode 100644
index 0000000..b78b4ea
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/stabilizer.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_STABILIZER_HPP
+#define OPENCV_VIDEOSTAB_STABILIZER_HPP
+
+#include <vector>
+#include <ctime>
+#include "opencv2/core.hpp"
+#include "opencv2/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"
+#include "opencv2/videostab/wobble_suppression.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS StabilizerBase
+{
+public:
+ virtual ~StabilizerBase() {}
+
+ void setLog(Ptr<ILog> ilog) { log_ = ilog; }
+ 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<ImageMotionEstimatorBase> val) { motionEstimator_ = val; }
+ Ptr<ImageMotionEstimatorBase> 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 reset();
+ Mat nextStabilizedFrame();
+ bool doOneIteration();
+ virtual void setUp(const Mat &firstFrame);
+ virtual Mat estimateMotion() = 0;
+ virtual Mat estimateStabilizationMotion() = 0;
+ void stabilizeFrame();
+ virtual Mat postProcessFrame(const Mat &frame);
+ void logProcessingTime();
+
+ Ptr<ILog> log_;
+ Ptr<IFrameSource> frameSource_;
+ Ptr<ImageMotionEstimatorBase> 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_;
+ Mat finalFrame_;
+ 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_;
+ clock_t processingStartTime_;
+};
+
+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();
+ virtual Mat nextFrame() { return nextStabilizedFrame(); }
+
+protected:
+ virtual void setUp(const Mat &firstFrame);
+ virtual Mat estimateMotion();
+ virtual Mat estimateStabilizationMotion();
+ virtual Mat postProcessFrame(const Mat &frame);
+
+ 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 setWobbleSuppressor(Ptr<WobbleSuppressorBase> val) { wobbleSuppressor_ = val; }
+ Ptr<WobbleSuppressorBase> wobbleSuppressor() const { return wobbleSuppressor_; }
+
+ void setEstimateTrimRatio(bool val) { mustEstTrimRatio_ = val; }
+ bool mustEstimateTrimaRatio() const { return mustEstTrimRatio_; }
+
+ virtual void reset();
+ virtual Mat nextFrame();
+
+protected:
+ void runPrePassIfNecessary();
+
+ virtual void setUp(const Mat &firstFrame);
+ virtual Mat estimateMotion();
+ virtual Mat estimateStabilizationMotion();
+ virtual Mat postProcessFrame(const Mat &frame);
+
+ Ptr<IMotionStabilizer> motionStabilizer_;
+ Ptr<WobbleSuppressorBase> wobbleSuppressor_;
+ bool mustEstTrimRatio_;
+
+ int frameCount_;
+ bool isPrePassDone_;
+ bool doWobbleSuppression_;
+ std::vector<Mat> motions2_;
+ Mat suppressedFrame_;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/thirdparty1/linux/include/opencv2/videostab/wobble_suppression.hpp b/thirdparty1/linux/include/opencv2/videostab/wobble_suppression.hpp
new file mode 100644
index 0000000..a44410b
--- /dev/null
+++ b/thirdparty1/linux/include/opencv2/videostab/wobble_suppression.hpp
@@ -0,0 +1,140 @@
+/*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_WOBBLE_SUPPRESSION_HPP
+#define OPENCV_VIDEOSTAB_WOBBLE_SUPPRESSION_HPP
+
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/core/cuda.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/videostab/log.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS WobbleSuppressorBase
+{
+public:
+ WobbleSuppressorBase();
+
+ virtual ~WobbleSuppressorBase() {}
+
+ void setMotionEstimator(Ptr<ImageMotionEstimatorBase> val) { motionEstimator_ = val; }
+ Ptr<ImageMotionEstimatorBase> motionEstimator() const { return motionEstimator_; }
+
+ virtual void suppress(int idx, const Mat &frame, Mat &result) = 0;
+
+
+ // data from stabilizer
+
+ virtual void setFrameCount(int val) { frameCount_ = val; }
+ virtual int frameCount() const { return frameCount_; }
+
+ virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+ virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+ virtual void setMotions2(const std::vector<Mat> &val) { motions2_ = &val; }
+ virtual const std::vector<Mat>& motions2() const { return *motions2_; }
+
+ virtual void setStabilizationMotions(const std::vector<Mat> &val) { stabilizationMotions_ = &val; }
+ virtual const std::vector<Mat>& stabilizationMotions() const { return *stabilizationMotions_; }
+
+protected:
+ Ptr<ImageMotionEstimatorBase> motionEstimator_;
+ int frameCount_;
+ const std::vector<Mat> *motions_;
+ const std::vector<Mat> *motions2_;
+ const std::vector<Mat> *stabilizationMotions_;
+};
+
+class CV_EXPORTS NullWobbleSuppressor : public WobbleSuppressorBase
+{
+public:
+ virtual void suppress(int idx, const Mat &frame, Mat &result);
+};
+
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressorBase : public WobbleSuppressorBase
+{
+public:
+ virtual void setPeriod(int val) { period_ = val; }
+ virtual int period() const { return period_; }
+
+protected:
+ MoreAccurateMotionWobbleSuppressorBase() { setPeriod(30); }
+
+ int period_;
+};
+
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressor : public MoreAccurateMotionWobbleSuppressorBase
+{
+public:
+ virtual void suppress(int idx, const Mat &frame, Mat &result);
+
+private:
+ Mat_<float> mapx_, mapy_;
+};
+
+#if defined(HAVE_OPENCV_CUDAWARPING)
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressorGpu : public MoreAccurateMotionWobbleSuppressorBase
+{
+public:
+ void suppress(int idx, const cuda::GpuMat &frame, cuda::GpuMat &result);
+ virtual void suppress(int idx, const Mat &frame, Mat &result);
+
+private:
+ cuda::GpuMat frameDevice_, resultDevice_;
+ cuda::GpuMat mapx_, mapy_;
+};
+#endif
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif