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
9164ccba
Commit
9164ccba
authored
Mar 14, 2012
by
Gary Bradski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added 0xFF & in front of every waitKey so that it works on linux
parent
ade7394e
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
25 additions
and
30 deletions
+25
-30
camshift.py
samples/python2/camshift.py
+1
-1
coherence.py
samples/python2/coherence.py
+1
-1
color_histogram.py
samples/python2/color_histogram.py
+1
-1
contours.py
samples/python2/contours.py
+1
-2
distrans.py
samples/python2/distrans.py
+1
-1
facedetect.py
samples/python2/facedetect.py
+1
-1
feature_homography.py
samples/python2/feature_homography.py
+1
-1
find_obj.py
samples/python2/find_obj.py
+1
-2
floodfill.py
samples/python2/floodfill.py
+1
-1
gaussian_mix.py
samples/python2/gaussian_mix.py
+1
-1
inpaint.py
samples/python2/inpaint.py
+1
-1
lk_homography.py
samples/python2/lk_homography.py
+1
-1
lk_track.py
samples/python2/lk_track.py
+1
-1
morphology.py
samples/python2/morphology.py
+1
-1
motempl.py
samples/python2/motempl.py
+2
-3
mser.py
samples/python2/mser.py
+2
-3
opt_flow.py
samples/python2/opt_flow.py
+1
-1
peopledetect.py
samples/python2/peopledetect.py
+1
-1
squares.py
samples/python2/squares.py
+2
-3
turing.py
samples/python2/turing.py
+1
-1
video.py
samples/python2/video.py
+1
-1
watershed.py
samples/python2/watershed.py
+1
-1
No files found.
samples/python2/camshift.py
View file @
9164ccba
...
@@ -101,7 +101,7 @@ class App(object):
...
@@ -101,7 +101,7 @@ class App(object):
cv2
.
imshow
(
'camshift'
,
vis
)
cv2
.
imshow
(
'camshift'
,
vis
)
ch
=
cv2
.
waitKey
(
5
)
ch
=
0xFF
&
cv2
.
waitKey
(
5
)
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
==
ord
(
'b'
):
if
ch
==
ord
(
'b'
):
...
...
samples/python2/coherence.py
View file @
9164ccba
...
@@ -65,7 +65,7 @@ if __name__ == '__main__':
...
@@ -65,7 +65,7 @@ if __name__ == '__main__':
cv2
.
imshow
(
'src'
,
src
)
cv2
.
imshow
(
'src'
,
src
)
update
()
update
()
while
True
:
while
True
:
ch
=
cv2
.
waitKey
()
ch
=
0xFF
&
cv2
.
waitKey
()
if
ch
==
ord
(
' '
):
if
ch
==
ord
(
' '
):
update
()
update
()
if
ch
==
27
:
if
ch
==
27
:
...
...
samples/python2/color_histogram.py
View file @
9164ccba
...
@@ -42,6 +42,6 @@ if __name__ == '__main__':
...
@@ -42,6 +42,6 @@ if __name__ == '__main__':
vis
=
hsv_map
*
h
[:,:,
np
.
newaxis
]
/
255.0
vis
=
hsv_map
*
h
[:,:,
np
.
newaxis
]
/
255.0
cv2
.
imshow
(
'hist'
,
vis
)
cv2
.
imshow
(
'hist'
,
vis
)
ch
=
cv2
.
waitKey
(
1
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
if
ch
==
27
:
if
ch
==
27
:
break
break
samples/python2/contours.py
View file @
9164ccba
...
@@ -45,4 +45,4 @@ if __name__ == '__main__':
...
@@ -45,4 +45,4 @@ if __name__ == '__main__':
update
(
3
)
update
(
3
)
cv2
.
createTrackbar
(
"levels+3"
,
"contours"
,
3
,
7
,
update
)
cv2
.
createTrackbar
(
"levels+3"
,
"contours"
,
3
,
7
,
update
)
cv2
.
imshow
(
'image'
,
img
)
cv2
.
imshow
(
'image'
,
img
)
cv2
.
waitKey
()
0xFF
&
cv2
.
waitKey
()
\ No newline at end of file
samples/python2/distrans.py
View file @
9164ccba
...
@@ -44,7 +44,7 @@ if __name__ == '__main__':
...
@@ -44,7 +44,7 @@ if __name__ == '__main__':
while
True
:
while
True
:
ch
=
cv2
.
waitKey
(
50
)
ch
=
0xFF
&
cv2
.
waitKey
(
50
)
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
==
ord
(
'v'
):
if
ch
==
ord
(
'v'
):
...
...
samples/python2/facedetect.py
View file @
9164ccba
...
@@ -54,6 +54,6 @@ if __name__ == '__main__':
...
@@ -54,6 +54,6 @@ if __name__ == '__main__':
draw_str
(
vis
,
(
20
,
20
),
'time:
%.1
f ms'
%
(
dt
*
1000
))
draw_str
(
vis
,
(
20
,
20
),
'time:
%.1
f ms'
%
(
dt
*
1000
))
cv2
.
imshow
(
'facedetect'
,
vis
)
cv2
.
imshow
(
'facedetect'
,
vis
)
if
cv2
.
waitKey
(
5
)
==
27
:
if
0xFF
&
cv2
.
waitKey
(
5
)
==
27
:
break
break
samples/python2/feature_homography.py
View file @
9164ccba
...
@@ -85,7 +85,7 @@ if __name__ == '__main__':
...
@@ -85,7 +85,7 @@ if __name__ == '__main__':
draw_str
(
vis
,
(
20
,
40
),
'matched:
%
d (
%
d outliers )'
%
(
match_n
,
match_n
-
inlier_n
))
draw_str
(
vis
,
(
20
,
40
),
'matched:
%
d (
%
d outliers )'
%
(
match_n
,
match_n
-
inlier_n
))
cv2
.
imshow
(
'img'
,
vis
)
cv2
.
imshow
(
'img'
,
vis
)
ch
=
cv2
.
waitKey
(
1
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
if
ch
==
ord
(
' '
):
if
ch
==
ord
(
' '
):
matcher
.
clear
()
matcher
.
clear
()
matcher
.
add
([
desc
])
matcher
.
add
([
desc
])
...
...
samples/python2/find_obj.py
View file @
9164ccba
...
@@ -99,4 +99,4 @@ if __name__ == '__main__':
...
@@ -99,4 +99,4 @@ if __name__ == '__main__':
# neighbours, so r_threshold is decreased
# neighbours, so r_threshold is decreased
cv2
.
imshow
(
'find_obj SURF'
,
vis_brute
)
cv2
.
imshow
(
'find_obj SURF'
,
vis_brute
)
cv2
.
imshow
(
'find_obj SURF flann'
,
vis_flann
)
cv2
.
imshow
(
'find_obj SURF flann'
,
vis_flann
)
cv2
.
waitKey
()
0xFF
&
cv2
.
waitKey
()
\ No newline at end of file
samples/python2/floodfill.py
View file @
9164ccba
...
@@ -51,7 +51,7 @@ if __name__ == '__main__':
...
@@ -51,7 +51,7 @@ if __name__ == '__main__':
cv2
.
createTrackbar
(
'hi'
,
'floodfill'
,
20
,
255
,
update
)
cv2
.
createTrackbar
(
'hi'
,
'floodfill'
,
20
,
255
,
update
)
while
True
:
while
True
:
ch
=
cv2
.
waitKey
()
ch
=
0xFF
&
cv2
.
waitKey
()
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
==
ord
(
'f'
):
if
ch
==
ord
(
'f'
):
...
...
samples/python2/gaussian_mix.py
View file @
9164ccba
...
@@ -51,6 +51,6 @@ if __name__ == '__main__':
...
@@ -51,6 +51,6 @@ if __name__ == '__main__':
draw_gaussain
(
img
,
m
,
cov
,
(
0
,
0
,
255
))
draw_gaussain
(
img
,
m
,
cov
,
(
0
,
0
,
255
))
cv2
.
imshow
(
'gaussian mixture'
,
img
)
cv2
.
imshow
(
'gaussian mixture'
,
img
)
ch
=
cv2
.
waitKey
(
0
)
ch
=
0xFF
&
cv2
.
waitKey
(
0
)
if
ch
==
27
:
if
ch
==
27
:
break
break
samples/python2/inpaint.py
View file @
9164ccba
...
@@ -22,7 +22,7 @@ if __name__ == '__main__':
...
@@ -22,7 +22,7 @@ if __name__ == '__main__':
sketch
=
Sketcher
(
'img'
,
[
img_mark
,
mark
],
lambda
:
((
255
,
255
,
255
),
255
))
sketch
=
Sketcher
(
'img'
,
[
img_mark
,
mark
],
lambda
:
((
255
,
255
,
255
),
255
))
while
True
:
while
True
:
ch
=
cv2
.
waitKey
()
ch
=
0xFF
&
cv2
.
waitKey
()
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
==
ord
(
' '
):
if
ch
==
ord
(
' '
):
...
...
samples/python2/lk_homography.py
View file @
9164ccba
...
@@ -85,7 +85,7 @@ class App:
...
@@ -85,7 +85,7 @@ class App:
cv2
.
imshow
(
'lk_homography'
,
vis
)
cv2
.
imshow
(
'lk_homography'
,
vis
)
ch
=
cv2
.
waitKey
(
1
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
==
ord
(
' '
):
if
ch
==
ord
(
' '
):
...
...
samples/python2/lk_track.py
View file @
9164ccba
...
@@ -81,7 +81,7 @@ class App:
...
@@ -81,7 +81,7 @@ class App:
self
.
prev_gray
=
frame_gray
self
.
prev_gray
=
frame_gray
cv2
.
imshow
(
'lk_track'
,
vis
)
cv2
.
imshow
(
'lk_track'
,
vis
)
ch
=
cv2
.
waitKey
(
1
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
if
ch
==
27
:
if
ch
==
27
:
break
break
...
...
samples/python2/morphology.py
View file @
9164ccba
...
@@ -48,7 +48,7 @@ if __name__ == '__main__':
...
@@ -48,7 +48,7 @@ if __name__ == '__main__':
print
" 2 - change structure element shape"
print
" 2 - change structure element shape"
print
print
while
True
:
while
True
:
ch
=
cv2
.
waitKey
()
ch
=
0xFF
&
cv2
.
waitKey
()
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
==
ord
(
'1'
):
if
ch
==
ord
(
'1'
):
...
...
samples/python2/motempl.py
View file @
9164ccba
...
@@ -76,5 +76,5 @@ if __name__ == '__main__':
...
@@ -76,5 +76,5 @@ if __name__ == '__main__':
cv2
.
imshow
(
'motempl'
,
vis
)
cv2
.
imshow
(
'motempl'
,
vis
)
prev_frame
=
frame
.
copy
()
prev_frame
=
frame
.
copy
()
if
cv2
.
waitKey
(
5
)
==
27
:
if
0xFF
&
cv2
.
waitKey
(
5
)
==
27
:
break
break
\ No newline at end of file
samples/python2/mser.py
View file @
9164ccba
...
@@ -33,5 +33,5 @@ if __name__ == '__main__':
...
@@ -33,5 +33,5 @@ if __name__ == '__main__':
cv2
.
polylines
(
vis
,
hulls
,
1
,
(
0
,
255
,
0
))
cv2
.
polylines
(
vis
,
hulls
,
1
,
(
0
,
255
,
0
))
cv2
.
imshow
(
'img'
,
vis
)
cv2
.
imshow
(
'img'
,
vis
)
if
cv2
.
waitKey
(
5
)
==
27
:
if
0xFF
&
cv2
.
waitKey
(
5
)
==
27
:
break
break
\ No newline at end of file
samples/python2/opt_flow.py
View file @
9164ccba
...
@@ -69,7 +69,7 @@ if __name__ == '__main__':
...
@@ -69,7 +69,7 @@ if __name__ == '__main__':
cur_glitch
=
warp_flow
(
cur_glitch
,
flow
)
cur_glitch
=
warp_flow
(
cur_glitch
,
flow
)
cv2
.
imshow
(
'glitch'
,
cur_glitch
)
cv2
.
imshow
(
'glitch'
,
cur_glitch
)
ch
=
cv2
.
waitKey
(
5
)
ch
=
0xFF
&
cv2
.
waitKey
(
5
)
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
==
ord
(
'1'
):
if
ch
==
ord
(
'1'
):
...
...
samples/python2/peopledetect.py
View file @
9164ccba
...
@@ -50,6 +50,6 @@ if __name__ == '__main__':
...
@@ -50,6 +50,6 @@ if __name__ == '__main__':
draw_detections
(
img
,
found_filtered
,
3
)
draw_detections
(
img
,
found_filtered
,
3
)
print
'
%
d (
%
d) found'
%
(
len
(
found_filtered
),
len
(
found
))
print
'
%
d (
%
d) found'
%
(
len
(
found_filtered
),
len
(
found
))
cv2
.
imshow
(
'img'
,
img
)
cv2
.
imshow
(
'img'
,
img
)
ch
=
cv2
.
waitKey
()
ch
=
0xFF
&
cv2
.
waitKey
()
if
ch
==
27
:
if
ch
==
27
:
break
break
samples/python2/squares.py
View file @
9164ccba
...
@@ -34,6 +34,6 @@ if __name__ == '__main__':
...
@@ -34,6 +34,6 @@ if __name__ == '__main__':
squares
=
find_squares
(
img
)
squares
=
find_squares
(
img
)
cv2
.
drawContours
(
img
,
squares
,
-
1
,
(
0
,
255
,
0
),
3
)
cv2
.
drawContours
(
img
,
squares
,
-
1
,
(
0
,
255
,
0
),
3
)
cv2
.
imshow
(
'squares'
,
img
)
cv2
.
imshow
(
'squares'
,
img
)
ch
=
cv2
.
waitKey
()
ch
=
0xFF
&
cv2
.
waitKey
()
if
ch
==
27
:
if
ch
==
27
:
break
break
\ No newline at end of file
samples/python2/turing.py
View file @
9164ccba
...
@@ -60,5 +60,5 @@ if __name__ == '__main__':
...
@@ -60,5 +60,5 @@ if __name__ == '__main__':
vis
=
a
.
copy
()
vis
=
a
.
copy
()
draw_str
(
vis
,
(
20
,
20
),
'frame
%
d'
%
frame_i
)
draw_str
(
vis
,
(
20
,
20
),
'frame
%
d'
%
frame_i
)
cv2
.
imshow
(
'a'
,
vis
)
cv2
.
imshow
(
'a'
,
vis
)
if
cv2
.
waitKey
(
5
)
==
27
:
if
0xFF
&
cv2
.
waitKey
(
5
)
==
27
:
break
break
samples/python2/video.py
View file @
9164ccba
...
@@ -156,7 +156,7 @@ if __name__ == '__main__':
...
@@ -156,7 +156,7 @@ if __name__ == '__main__':
ret
,
img
=
cap
.
read
()
ret
,
img
=
cap
.
read
()
imgs
.
append
(
img
)
imgs
.
append
(
img
)
cv2
.
imshow
(
'capture
%
d'
%
i
,
img
)
cv2
.
imshow
(
'capture
%
d'
%
i
,
img
)
ch
=
cv2
.
waitKey
(
1
)
ch
=
0xFF
&
cv2
.
waitKey
(
1
)
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
==
ord
(
' '
):
if
ch
==
ord
(
' '
):
...
...
samples/python2/watershed.py
View file @
9164ccba
...
@@ -37,7 +37,7 @@ class App:
...
@@ -37,7 +37,7 @@ class App:
def
run
(
self
):
def
run
(
self
):
while
True
:
while
True
:
ch
=
cv2
.
waitKey
(
50
)
ch
=
0xFF
&
cv2
.
waitKey
(
50
)
if
ch
==
27
:
if
ch
==
27
:
break
break
if
ch
>=
ord
(
'1'
)
and
ch
<=
ord
(
'7'
):
if
ch
>=
ord
(
'1'
)
and
ch
<=
ord
(
'7'
):
...
...
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