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
69c626e7
Commit
69c626e7
authored
Apr 23, 2013
by
Kevin Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
starter_video.cpp hid local functions
parent
3441b2df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
40 deletions
+43
-40
starter_video.cpp
samples/cpp/starter_video.cpp
+43
-40
No files found.
samples/cpp/starter_video.cpp
View file @
69c626e7
...
...
@@ -19,50 +19,53 @@
using
namespace
cv
;
using
namespace
std
;
void
help
(
char
**
av
)
{
cout
<<
"The program captures frames from a video file, image sequence (01.jpg, 02.jpg ... 10.jpg) or camera connected to your computer."
<<
endl
<<
"Usage:
\n
"
<<
av
[
0
]
<<
" <video file, image sequence or device number>"
<<
endl
<<
"q,Q,esc -- quit"
<<
endl
<<
"space -- save frame"
<<
endl
<<
endl
<<
"
\t
To capture from a camera pass the device number. To find the device number, try ls /dev/video*"
<<
endl
<<
"
\t
example: "
<<
av
[
0
]
<<
" 0"
<<
endl
<<
"
\t
You may also pass a video file instead of a device number"
<<
endl
<<
"
\t
example: "
<<
av
[
0
]
<<
" video.avi"
<<
endl
<<
"
\t
You can also pass the path to an image sequence and OpenCV will treat the sequence just like a video."
<<
endl
<<
"
\t
example: "
<<
av
[
0
]
<<
" right%%02d.jpg"
<<
endl
;
}
//hide the local functions in an anon namespace
namespace
{
void
help
(
char
**
av
)
{
cout
<<
"The program captures frames from a video file, image sequence (01.jpg, 02.jpg ... 10.jpg) or camera connected to your computer."
<<
endl
<<
"Usage:
\n
"
<<
av
[
0
]
<<
" <video file, image sequence or device number>"
<<
endl
<<
"q,Q,esc -- quit"
<<
endl
<<
"space -- save frame"
<<
endl
<<
endl
<<
"
\t
To capture from a camera pass the device number. To find the device number, try ls /dev/video*"
<<
endl
<<
"
\t
example: "
<<
av
[
0
]
<<
" 0"
<<
endl
<<
"
\t
You may also pass a video file instead of a device number"
<<
endl
<<
"
\t
example: "
<<
av
[
0
]
<<
" video.avi"
<<
endl
<<
"
\t
You can also pass the path to an image sequence and OpenCV will treat the sequence just like a video."
<<
endl
<<
"
\t
example: "
<<
av
[
0
]
<<
" right%%02d.jpg"
<<
endl
;
}
int
process
(
VideoCapture
&
capture
)
{
int
n
=
0
;
char
filename
[
200
];
string
window_name
=
"video | q or esc to quit"
;
cout
<<
"press space to save a picture. q or esc to quit"
<<
endl
;
namedWindow
(
window_name
,
WINDOW_KEEPRATIO
);
//resizable window;
Mat
frame
;
for
(;;)
{
capture
>>
frame
;
if
(
frame
.
empty
())
break
;
imshow
(
window_name
,
frame
);
char
key
=
(
char
)
waitKey
(
30
);
//delay N millis, usually long enough to display and capture input
int
process
(
VideoCapture
&
capture
)
{
int
n
=
0
;
char
filename
[
200
];
string
window_name
=
"video | q or esc to quit"
;
cout
<<
"press space to save a picture. q or esc to quit"
<<
endl
;
namedWindow
(
window_name
,
WINDOW_KEEPRATIO
);
//resizable window;
Mat
frame
;
switch
(
key
)
{
case
'q'
:
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
;
for
(;;)
{
capture
>>
frame
;
if
(
frame
.
empty
())
break
;
imshow
(
window_name
,
frame
);
char
key
=
(
char
)
waitKey
(
30
);
//delay N millis, usually long enough to display and capture input
switch
(
key
)
{
case
'q'
:
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
;
}
}
return
0
;
}
return
0
;
}
int
main
(
int
ac
,
char
**
av
)
{
...
...
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