#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/videostab/optical_flow.hpp"
+#include "opencv2/opencv_modules.hpp"
#if HAVE_OPENCV_GPU
#include "opencv2/gpu/gpu.hpp"
{
MM_TRANSLATION = 0,
MM_TRANSLATION_AND_SCALE = 1,
- MM_LINEAR_SIMILARITY = 2,
+ MM_SIMILARITY = 2,
MM_AFFINE = 3,
MM_HOMOGRAPHY = 4,
MM_UNKNOWN = 5
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_LINEAR_SIMILARITY)
+ 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);
#include "precomp.hpp"
#include "opencv2/videostab/global_motion.hpp"
#include "opencv2/videostab/ring_buffer.hpp"
+#include "opencv2/opencv_modules.hpp"
using namespace std;
}
-static Mat estimateGlobMotionLeastSquaresLinearSimilarity(
+static Mat estimateGlobMotionLeastSquaresSimilarity(
int npoints, Point2f *points0, Point2f *points1, float *rmse)
{
Mat_<float> T0 = normalizePoints(npoints, points0);
a1 = A[2*i+1];
p0 = points0[i];
p1 = points1[i];
- a0[0] = p0.x; a0[1] = p0.y; a0[2] = 1; a0[3] = 0;
+ a0[0] = p0.x; a0[1] = p0.y; a0[2] = 1; a0[3] = 0;
a1[0] = p0.y; a1[1] = -p0.x; a1[2] = 0; a1[3] = 1;
b(2*i,0) = p1.x;
b(2*i+1,0) = p1.y;
typedef Mat (*Impl)(int, Point2f*, Point2f*, float*);
static Impl impls[] = { estimateGlobMotionLeastSquaresTranslation,
estimateGlobMotionLeastSquaresTranslationAndScale,
- estimateGlobMotionLeastSquaresLinearSimilarity,
+ estimateGlobMotionLeastSquaresSimilarity,
estimateGlobMotionLeastSquaresAffine };
return impls[model](npoints, points0, points1, rmse);
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/videostab/videostab.hpp"
+#include "opencv2/opencv_modules.hpp"
#define arg(name) cmd.get<string>(name)
#define argb(name) cmd.get<bool>(name)
return 0;
}
-#ifdef HAVE_OPENCV_GPU
+#if HAVE_OPENCV_GPU
if (arg("gpu") == "yes")
{
cout << "initializing GPU..."; cout.flush();
else if (arg("ws-model") == "transl_and_scale")
est = new PyrLkRobustMotionEstimator(MM_TRANSLATION_AND_SCALE);
else if (arg("ws-model") == "linear_sim")
- est = new PyrLkRobustMotionEstimator(MM_LINEAR_SIMILARITY);
+ est = new PyrLkRobustMotionEstimator(MM_SIMILARITY);
else if (arg("ws-model") == "affine")
est = new PyrLkRobustMotionEstimator(MM_AFFINE);
else if (arg("ws-model") == "homography")
}
else if (arg("gpu") == "yes")
{
-#ifdef HAVE_OPENCV_GPU
+#if HAVE_OPENCV_GPU
PyrLkRobustMotionEstimatorGpu *est = 0;
if (arg("ws-model") == "transl")
else if (arg("ws-model") == "transl_and_scale")
est = new PyrLkRobustMotionEstimatorGpu(MM_TRANSLATION_AND_SCALE);
else if (arg("ws-model") == "linear_sim")
- est = new PyrLkRobustMotionEstimatorGpu(MM_LINEAR_SIMILARITY);
+ est = new PyrLkRobustMotionEstimatorGpu(MM_SIMILARITY);
else if (arg("ws-model") == "affine")
est = new PyrLkRobustMotionEstimatorGpu(MM_AFFINE);
else if (arg("ws-model") == "homography")
else if (arg("model") == "transl_and_scale")
est = new PyrLkRobustMotionEstimator(MM_TRANSLATION_AND_SCALE);
else if (arg("model") == "linear_sim")
- est = new PyrLkRobustMotionEstimator(MM_LINEAR_SIMILARITY);
+ est = new PyrLkRobustMotionEstimator(MM_SIMILARITY);
else if (arg("model") == "affine")
est = new PyrLkRobustMotionEstimator(MM_AFFINE);
else if (arg("model") == "homography")
}
else if (arg("gpu") == "yes")
{
-#ifdef HAVE_OPENCV_GPU
+#if HAVE_OPENCV_GPU
PyrLkRobustMotionEstimatorGpu *est = 0;
if (arg("ws-model") == "transl")
else if (arg("ws-model") == "transl_and_scale")
est = new PyrLkRobustMotionEstimatorGpu(MM_TRANSLATION_AND_SCALE);
else if (arg("ws-model") == "linear_sim")
- est = new PyrLkRobustMotionEstimatorGpu(MM_LINEAR_SIMILARITY);
+ est = new PyrLkRobustMotionEstimatorGpu(MM_SIMILARITY);
else if (arg("ws-model") == "affine")
est = new PyrLkRobustMotionEstimatorGpu(MM_AFFINE);
else if (arg("ws-model") == "homography")