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
02788eb3
Commit
02788eb3
authored
Aug 27, 2011
by
Alexander Mordvintsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
camshift.py description
parent
714732e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
camshift.py
samples/python2/camshift.py
+21
-8
demo.py
samples/python2/demo.py
+2
-2
No files found.
samples/python2/camshift.py
View file @
02788eb3
import
numpy
as
np
import
cv2
import
video
'''
Camshift tracker
================
This is a demo that shows mean-shift based tracking
You select a color objects such as your face and it tracks it.
This reads from video camera (0 by default, or the camera number the user enters)
h
elp_message
=
'''USAGE: camshift.py [<video source>]
h
ttp://www.robinhewitt.com/research/track/camshift.html
Select a bright colored object to track.
Usage:
------
camshift.py [<video source>]
To initialize tracking, select the object with mouse
Keys:
ESC - exit
b - toggle back-projected probability visualization
-----
ESC - exit
b - toggle back-projected probability visualization
'''
import
numpy
as
np
import
cv2
import
video
class
App
(
object
):
def
__init__
(
self
,
video_src
):
...
...
@@ -99,6 +112,6 @@ if __name__ == '__main__':
import
sys
try
:
video_src
=
sys
.
argv
[
1
]
except
:
video_src
=
0
print
help_message
print
__doc__
App
(
video_src
)
.
run
()
samples/python2/demo.py
View file @
02788eb3
...
...
@@ -124,12 +124,12 @@ class App:
text
.
tag_add
(
tag
,
start
,
end
)
self
.
match_text
(
r'http://\S+'
,
add_link
)
def
match_text
(
self
,
pattern
,
tag_proc
):
def
match_text
(
self
,
pattern
,
tag_proc
,
regexp
=
True
):
text
=
self
.
text
text
.
mark_set
(
'matchPos'
,
'1.0'
)
count
=
tk
.
IntVar
()
while
True
:
match_index
=
text
.
search
(
pattern
,
'matchPos'
,
count
=
count
,
regexp
=
True
,
stopindex
=
'end'
)
match_index
=
text
.
search
(
pattern
,
'matchPos'
,
count
=
count
,
regexp
=
regexp
,
stopindex
=
'end'
)
if
not
match_index
:
break
end_index
=
text
.
index
(
"
%
s+
%
sc"
%
(
match_index
,
count
.
get
())
)
text
.
mark_set
(
'matchPos'
,
end_index
)
...
...
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