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
a7da9681
Commit
a7da9681
authored
Apr 04, 2012
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added motion stabilization pipeline (videostab module)
parent
5ee7596c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
motion_stabilizing.hpp
...ideostab/include/opencv2/videostab/motion_stabilizing.hpp
+15
-1
motion_stabilizing.cpp
modules/videostab/src/motion_stabilizing.cpp
+27
-0
No files found.
modules/videostab/include/opencv2/videostab/motion_stabilizing.hpp
View file @
a7da9681
...
...
@@ -57,12 +57,26 @@ class CV_EXPORTS IMotionStabilizer
public
:
virtual
~
IMotionStabilizer
()
{}
// assumes that [
range.first, range.second) is in or equals to [0, size-2]
// 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
)
const
=
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
)
const
;
private
:
std
::
vector
<
Ptr
<
IMotionStabilizer
>
>
stabilizers_
;
};
class
CV_EXPORTS
MotionFilterBase
:
public
IMotionStabilizer
{
public
:
...
...
modules/videostab/src/motion_stabilizing.cpp
View file @
a7da9681
...
...
@@ -52,6 +52,33 @@ namespace cv
namespace
videostab
{
void
MotionStabilizationPipeline
::
stabilize
(
int
size
,
const
vector
<
Mat
>
&
motions
,
pair
<
int
,
int
>
range
,
Mat
*
stabilizationMotions
)
const
{
vector
<
Mat
>
updatedMotions
(
motions
);
vector
<
Mat
>
stabilizationMotions_
(
size
);
for
(
int
i
=
0
;
i
<
size
;
++
i
)
stabilizationMotions
[
i
]
=
Mat
::
eye
(
3
,
3
,
CV_32F
);
for
(
size_t
i
=
0
;
i
<
stabilizers_
.
size
();
++
i
)
{
stabilizers_
[
i
]
->
stabilize
(
size
,
updatedMotions
,
range
,
&
stabilizationMotions_
[
0
]);
for
(
int
i
=
0
;
i
<
size
;
++
i
)
stabilizationMotions
[
i
]
=
stabilizationMotions_
[
i
]
*
stabilizationMotions
[
i
];
for
(
int
j
=
0
;
j
+
1
<
size
;
++
j
)
{
Mat
S0
=
stabilizationMotions
[
j
];
Mat
S1
=
stabilizationMotions
[
j
+
1
];
at
(
j
,
updatedMotions
)
=
S1
*
at
(
j
,
updatedMotions
)
*
S0
.
inv
();
}
}
}
void
MotionFilterBase
::
stabilize
(
int
size
,
const
vector
<
Mat
>
&
motions
,
pair
<
int
,
int
>
range
,
Mat
*
stabilizationMotions
)
const
{
...
...
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