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
251918e1
Commit
251918e1
authored
Feb 13, 2011
by
Gary Bradski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
just added frame saving
parent
82856150
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
starter_video.cpp
samples/cpp/starter_video.cpp
+13
-1
No files found.
samples/cpp/starter_video.cpp
View file @
251918e1
...
...
@@ -10,15 +10,20 @@
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <vector>
#include <stdio.h>
using
namespace
cv
;
using
namespace
std
;
//hide the local functions in an anon namespace
namespace
{
void
help
(
char
**
av
)
{
cout
<<
"
\n
This program justs gets you started reading images from video
\n
"
"Usage:
\n
./"
<<
av
[
0
]
<<
" <video device number>
\n
"
<<
"q,Q,esc -- quit
\n
"
<<
"space -- save frame
\n\n
"
<<
"
\t
This is a starter sample, to get you up and going in a copy pasta fashion
\n
"
<<
"
\t
The program captures frames from a camera connected to your computer.
\n
"
<<
"
\t
To find the video device number, try ls /dev/video*
\n
"
...
...
@@ -27,8 +32,10 @@ namespace {
}
int
process
(
VideoCapture
&
capture
)
{
int
n
=
0
;
char
filename
[
200
];
string
window_name
=
"video | q or esc to quit"
;
cout
<<
"press q or esc to quit"
<<
endl
;
cout
<<
"press
space to save a picture.
q or esc to quit"
<<
endl
;
namedWindow
(
window_name
,
CV_WINDOW_KEEPRATIO
);
//resizable window;
Mat
frame
;
for
(;;)
{
...
...
@@ -42,6 +49,11 @@ namespace {
case
'Q'
:
case
27
:
//escape key
return
0
;
case
' '
:
//Save an image
sprintf
(
filename
,
"filename%.3d.jpg"
,
n
++
);
imwrite
(
filename
,
frame
);
cout
<<
"Saved "
<<
filename
<<
endl
;
break
;
default
:
break
;
}
...
...
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