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
787fe6a9
Commit
787fe6a9
authored
Jun 10, 2011
by
Alexander Mordvintsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multiple cameras and frame saving in video.py
parent
fac61133
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
browse.py
samples/python2/browse.py
+1
-1
video.py
samples/python2/video.py
+22
-5
No files found.
samples/python2/browse.py
View file @
787fe6a9
...
...
@@ -16,7 +16,7 @@ if len(sys.argv) > 1:
img
=
cv2
.
imread
(
fn
)
else
:
sz
=
4096
print
'generating
%
dx
%
d proc
u
dural image ...'
%
(
sz
,
sz
)
print
'generating
%
dx
%
d proc
e
dural image ...'
%
(
sz
,
sz
)
img
=
np
.
zeros
((
sz
,
sz
),
np
.
uint8
)
track
=
np
.
cumsum
(
np
.
random
.
rand
(
500000
,
2
)
-
0.5
,
axis
=
0
)
track
=
np
.
int32
(
track
*
10
+
(
sz
/
2
,
sz
/
2
))
...
...
samples/python2/video.py
View file @
787fe6a9
...
...
@@ -49,13 +49,30 @@ def create_capture(source):
if
__name__
==
'__main__'
:
import
sys
try
:
fn
=
sys
.
argv
[
1
]
except
:
fn
=
'synth:bg=../cpp/lena.jpg:noise=0.1'
import
argparse
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'sources'
,
nargs
=
'*'
,
default
=
[
'synth:bg=../cpp/lena.jpg:noise=0.1'
])
parser
.
add_argument
(
'-shotdir'
,
nargs
=
1
,
default
=
'.'
)
args
=
parser
.
parse_args
()
print
args
cap
=
create_capture
(
fn
)
print
'Press SPACE to save current frame'
caps
=
map
(
create_capture
,
args
.
sources
)
shot_idx
=
0
while
True
:
ret
,
img
=
cap
.
read
()
cv2
.
imshow
(
'img'
,
img
)
imgs
=
[]
for
i
,
cap
in
enumerate
(
caps
):
ret
,
img
=
cap
.
read
()
imgs
.
append
(
img
)
cv2
.
imshow
(
'capture
%
d'
%
i
,
img
)
ch
=
cv2
.
waitKey
(
1
)
if
ch
==
27
:
break
if
ch
==
ord
(
' '
):
for
i
,
img
in
enumerate
(
imgs
):
fn
=
'
%
s/shot_
%
d_
%03
d.bmp'
%
(
args
.
shotdir
[
0
],
i
,
shot_idx
)
cv2
.
imwrite
(
fn
,
img
)
print
fn
,
'saved'
shot_idx
+=
1
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