Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
536d36b0
Commit
536d36b0
authored
Apr 18, 2012
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring (videostab)
parent
1569c1ed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
13 deletions
+17
-13
global_motion.hpp
...les/videostab/include/opencv2/videostab/global_motion.hpp
+3
-2
motion_stabilizing.hpp
...ideostab/include/opencv2/videostab/motion_stabilizing.hpp
+1
-1
global_motion.cpp
modules/videostab/src/global_motion.cpp
+4
-3
inpainting.cpp
modules/videostab/src/inpainting.cpp
+1
-0
videostab.cpp
samples/cpp/videostab.cpp
+8
-7
No files found.
modules/videostab/include/opencv2/videostab/global_motion.hpp
View file @
536d36b0
...
...
@@ -49,6 +49,7 @@
#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"
...
...
@@ -63,7 +64,7 @@ enum MotionModel
{
MM_TRANSLATION
=
0
,
MM_TRANSLATION_AND_SCALE
=
1
,
MM_
LINEAR_
SIMILARITY
=
2
,
MM_SIMILARITY
=
2
,
MM_AFFINE
=
3
,
MM_HOMOGRAPHY
=
4
,
MM_UNKNOWN
=
5
...
...
@@ -90,7 +91,7 @@ struct CV_EXPORTS RansacParams
return
RansacParams
(
1
,
0.5
f
,
0.5
f
,
0.99
f
);
if
(
model
==
MM_TRANSLATION_AND_SCALE
)
return
RansacParams
(
2
,
0.5
f
,
0.5
f
,
0.99
f
);
if
(
model
==
MM_
LINEAR_
SIMILARITY
)
if
(
model
==
MM_SIMILARITY
)
return
RansacParams
(
2
,
0.5
f
,
0.5
f
,
0.99
f
);
if
(
model
==
MM_AFFINE
)
return
RansacParams
(
3
,
0.5
f
,
0.5
f
,
0.99
f
);
...
...
modules/videostab/include/opencv2/videostab/motion_stabilizing.hpp
View file @
536d36b0
...
...
@@ -112,7 +112,7 @@ private:
class
CV_EXPORTS
LpMotionStabilizer
:
public
IMotionStabilizer
{
public
:
LpMotionStabilizer
(
MotionModel
model
=
MM_
LINEAR_
SIMILARITY
);
LpMotionStabilizer
(
MotionModel
model
=
MM_SIMILARITY
);
void
setMotionModel
(
MotionModel
val
)
{
model_
=
val
;
}
MotionModel
motionModel
()
const
{
return
model_
;
}
...
...
modules/videostab/src/global_motion.cpp
View file @
536d36b0
...
...
@@ -43,6 +43,7 @@
#include "precomp.hpp"
#include "opencv2/videostab/global_motion.hpp"
#include "opencv2/videostab/ring_buffer.hpp"
#include "opencv2/opencv_modules.hpp"
using
namespace
std
;
...
...
@@ -149,7 +150,7 @@ static Mat estimateGlobMotionLeastSquaresTranslationAndScale(
}
static
Mat
estimateGlobMotionLeastSquares
Linear
Similarity
(
static
Mat
estimateGlobMotionLeastSquaresSimilarity
(
int
npoints
,
Point2f
*
points0
,
Point2f
*
points1
,
float
*
rmse
)
{
Mat_
<
float
>
T0
=
normalizePoints
(
npoints
,
points0
);
...
...
@@ -165,7 +166,7 @@ static Mat estimateGlobMotionLeastSquaresLinearSimilarity(
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
;
...
...
@@ -233,7 +234,7 @@ Mat estimateGlobalMotionLeastSquares(
typedef
Mat
(
*
Impl
)(
int
,
Point2f
*
,
Point2f
*
,
float
*
);
static
Impl
impls
[]
=
{
estimateGlobMotionLeastSquaresTranslation
,
estimateGlobMotionLeastSquaresTranslationAndScale
,
estimateGlobMotionLeastSquares
Linear
Similarity
,
estimateGlobMotionLeastSquaresSimilarity
,
estimateGlobMotionLeastSquaresAffine
};
return
impls
[
model
](
npoints
,
points0
,
points1
,
rmse
);
...
...
modules/videostab/src/inpainting.cpp
View file @
536d36b0
...
...
@@ -46,6 +46,7 @@
#include "opencv2/videostab/global_motion.hpp"
#include "opencv2/videostab/fast_marching.hpp"
#include "opencv2/videostab/ring_buffer.hpp"
#include "opencv2/opencv_modules.hpp"
using
namespace
std
;
...
...
samples/cpp/videostab.cpp
View file @
536d36b0
...
...
@@ -8,6 +8,7 @@
#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)
...
...
@@ -223,7 +224,7 @@ int main(int argc, const char **argv)
return
0
;
}
#if
def
HAVE_OPENCV_GPU
#if HAVE_OPENCV_GPU
if
(
arg
(
"gpu"
)
==
"yes"
)
{
cout
<<
"initializing GPU..."
;
cout
.
flush
();
...
...
@@ -281,7 +282,7 @@ int main(int argc, const char **argv)
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"
)
...
...
@@ -306,7 +307,7 @@ int main(int argc, const char **argv)
}
else
if
(
arg
(
"gpu"
)
==
"yes"
)
{
#if
def
HAVE_OPENCV_GPU
#if HAVE_OPENCV_GPU
PyrLkRobustMotionEstimatorGpu
*
est
=
0
;
if
(
arg
(
"ws-model"
)
==
"transl"
)
...
...
@@ -314,7 +315,7 @@ int main(int argc, const char **argv)
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"
)
...
...
@@ -377,7 +378,7 @@ int main(int argc, const char **argv)
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"
)
...
...
@@ -401,7 +402,7 @@ int main(int argc, const char **argv)
}
else
if
(
arg
(
"gpu"
)
==
"yes"
)
{
#if
def
HAVE_OPENCV_GPU
#if HAVE_OPENCV_GPU
PyrLkRobustMotionEstimatorGpu
*
est
=
0
;
if
(
arg
(
"ws-model"
)
==
"transl"
)
...
...
@@ -409,7 +410,7 @@ int main(int argc, const char **argv)
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"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment