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
39cd1358
Commit
39cd1358
authored
Apr 09, 2012
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in motion stabilization pipeline and updated wobble stabilizer (videostab)
parent
30b461a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
6 deletions
+35
-6
motion_stabilizing.cpp
modules/videostab/src/motion_stabilizing.cpp
+4
-1
stabilizer.cpp
modules/videostab/src/stabilizer.cpp
+25
-0
wobble_suppression.cpp
modules/videostab/src/wobble_suppression.cpp
+6
-5
No files found.
modules/videostab/src/motion_stabilizing.cpp
View file @
39cd1358
...
...
@@ -56,7 +56,10 @@ void MotionStabilizationPipeline::stabilize(
int
size
,
const
vector
<
Mat
>
&
motions
,
pair
<
int
,
int
>
range
,
Mat
*
stabilizationMotions
)
const
{
vector
<
Mat
>
updatedMotions
(
motions
);
vector
<
Mat
>
updatedMotions
(
motions
.
size
());
for
(
size_t
i
=
0
;
i
<
motions
.
size
();
++
i
)
updatedMotions
[
i
]
=
motions
[
i
].
clone
();
vector
<
Mat
>
stabilizationMotions_
(
size
);
for
(
int
i
=
0
;
i
<
size
;
++
i
)
...
...
modules/videostab/src/stabilizer.cpp
View file @
39cd1358
...
...
@@ -371,6 +371,31 @@ void TwoPassStabilizer::runPrePassIfNecessary()
motionStabilizer_
->
stabilize
(
frameCount_
,
motions_
,
make_pair
(
0
,
frameCount_
-
1
),
&
stabilizationMotions_
[
0
]);
/*ofstream fm("log_motions.csv");
for (int i = 0; i < frameCount_ - 1; ++i)
{
Mat_<float> M = at(i, motions_);
fm << M(0,0) << " " << M(0,1) << " " << M(0,2) << " "
<< M(1,0) << " " << M(1,1) << " " << M(1,2) << " "
<< M(2,0) << " " << M(2,1) << " " << M(2,2) << endl;
}
ofstream fo("log_orig.csv");
for (int i = 0; i < frameCount_; ++i)
{
Mat_<float> M = getMotion(0, i, motions_);
fo << M(0,0) << " " << M(0,1) << " " << M(0,2) << " "
<< M(1,0) << " " << M(1,1) << " " << M(1,2) << " "
<< M(2,0) << " " << M(2,1) << " " << M(2,2) << endl;
}
ofstream fs("log_stab.csv");
for (int i = 0; i < frameCount_; ++i)
{
Mat_<float> M = stabilizationMotions_[i] * getMotion(0, i, motions_);
fs << M(0,0) << " " << M(0,1) << " " << M(0,2) << " "
<< M(1,0) << " " << M(1,1) << " " << M(1,2) << " "
<< M(2,0) << " " << M(2,1) << " " << M(2,2) << endl;
}*/
if
(
mustEstTrimRatio_
)
{
trimRatio_
=
0
;
...
...
modules/videostab/src/wobble_suppression.cpp
View file @
39cd1358
...
...
@@ -104,24 +104,25 @@ void MoreAccurateMotionWobbleSuppressor::suppress(int idx, const Mat &frame, Mat
yl
=
ML
(
1
,
0
)
*
x
+
ML
(
1
,
1
)
*
y
+
ML
(
1
,
2
);
zl
=
ML
(
2
,
0
)
*
x
+
ML
(
2
,
1
)
*
y
+
ML
(
2
,
2
);
xl
/=
zl
;
yl
/=
zl
;
wl
=
1.
f
/
(
sqrt
(
sqr
(
x
-
xl
)
+
sqr
(
y
-
yl
))
+
1e-5
f
)
;
wl
=
idx
-
k1
;
xr
=
MR
(
0
,
0
)
*
x
+
MR
(
0
,
1
)
*
y
+
MR
(
0
,
2
);
yr
=
MR
(
1
,
0
)
*
x
+
MR
(
1
,
1
)
*
y
+
MR
(
1
,
2
);
zr
=
MR
(
2
,
0
)
*
x
+
MR
(
2
,
1
)
*
y
+
MR
(
2
,
2
);
xr
/=
zr
;
yr
/=
zr
;
wr
=
1.
f
/
(
sqrt
(
sqr
(
x
-
xr
)
+
sqr
(
y
-
yr
))
+
1e-5
f
)
;
wr
=
k2
-
idx
;
mapx_
(
y
,
x
)
=
(
w
l
*
xl
+
wr
*
xr
)
/
(
wl
+
wr
);
mapy_
(
y
,
x
)
=
(
w
l
*
yl
+
wr
*
yr
)
/
(
wl
+
wr
);
mapx_
(
y
,
x
)
=
(
w
r
*
xl
+
wl
*
xr
)
/
(
wl
+
wr
);
mapy_
(
y
,
x
)
=
(
w
r
*
yl
+
wl
*
yr
)
/
(
wl
+
wr
);
}
}
if
(
result
.
data
==
frame
.
data
)
result
=
Mat
(
frame
.
size
(),
frame
.
type
());
remap
(
frame
,
result
,
mapx_
,
mapy_
,
INTER_L
INEAR
);
remap
(
frame
,
result
,
mapx_
,
mapy_
,
INTER_L
ANCZOS4
,
BORDER_REPLICATE
);
}
}
// namespace videostab
}
// namespace cv
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