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
be73f8e2
Commit
be73f8e2
authored
Mar 20, 2012
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added quiet mode into videostab sample
parent
e4651fa6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
motion_filtering.cpp
modules/videostab/src/motion_filtering.cpp
+7
-3
videostab.cpp
samples/cpp/videostab.cpp
+13
-4
No files found.
modules/videostab/src/motion_filtering.cpp
View file @
be73f8e2
...
...
@@ -66,9 +66,13 @@ Mat GaussianMotionFilter::apply(int idx, vector<Mat> &motions) const
{
const
Mat
&
cur
=
at
(
idx
,
motions
);
Mat
res
=
Mat
::
zeros
(
cur
.
size
(),
cur
.
type
());
for
(
int
i
=
-
radius_
;
i
<=
radius_
;
++
i
)
res
+=
weight_
[
radius_
+
i
]
*
getMotion
(
idx
,
idx
+
i
,
motions
);
return
res
;
float
sum
=
0.
f
;
for
(
int
i
=
std
::
max
(
idx
-
radius_
,
0
);
i
<=
idx
+
radius_
;
++
i
)
{
res
+=
weight_
[
radius_
+
i
-
idx
]
*
getMotion
(
idx
,
i
,
motions
);
sum
+=
weight_
[
radius_
+
i
-
idx
];
}
return
res
/
sum
;
}
}
// namespace videostab
...
...
samples/cpp/videostab.cpp
View file @
be73f8e2
...
...
@@ -15,6 +15,7 @@ using namespace cv::videostab;
Ptr
<
Stabilizer
>
stabilizer
;
double
outputFps
;
string
outputPath
;
bool
quietMode
;
void
run
();
void
printHelp
();
...
...
@@ -32,10 +33,13 @@ void run()
writer
.
open
(
outputPath
,
CV_FOURCC
(
'X'
,
'V'
,
'I'
,
'D'
),
outputFps
,
stabilizedFrame
.
size
());
writer
<<
stabilizedFrame
;
}
imshow
(
"stabilizedFrame"
,
stabilizedFrame
);
char
key
=
static_cast
<
char
>
(
waitKey
(
3
));
if
(
key
==
27
)
break
;
if
(
!
quietMode
)
{
imshow
(
"stabilizedFrame"
,
stabilizedFrame
);
char
key
=
static_cast
<
char
>
(
waitKey
(
3
));
if
(
key
==
27
)
break
;
}
}
cout
<<
"
\n
finished
\n
"
;
...
...
@@ -83,6 +87,8 @@ void printHelp()
" Set output file path explicitely. The default is stabilized.avi.
\n
"
" --fps=<int_number>
\n
"
" Set output video FPS explicitely. By default the source FPS is used.
\n
"
" -q, --quiet
\n
"
" Don't show output video frames.
\n
"
" -h, --help
\n
"
" Print help.
\n
"
"
\n
"
;
...
...
@@ -112,6 +118,7 @@ int main(int argc, const char **argv)
"{ | color-inpaint | | }"
"{ o | output | stabilized.avi | }"
"{ | fps | | }"
"{ q | quiet | false | }"
"{ h | help | false | }"
;
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
...
...
@@ -213,6 +220,8 @@ int main(int argc, const char **argv)
if
(
!
cmd
.
get
<
string
>
(
"fps"
).
empty
())
outputFps
=
cmd
.
get
<
double
>
(
"fps"
);
quietMode
=
cmd
.
get
<
bool
>
(
"quiet"
);
// run video processing
run
();
}
...
...
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