updated video_threaded.py sample:

- switch btw threaded and non-threaded mode
- performance counters
- description
This commit is contained in:
Alexander Mordvintsev
2012-05-28 08:51:50 +00:00
parent addcd16d8f
commit e0c1fb5f76
2 changed files with 74 additions and 10 deletions

View File

@@ -126,6 +126,17 @@ def Timer(msg):
finally:
print "%.2f ms" % ((clock()-start)*1000)
class StatValue:
def __init__(self, smooth_coef = 0.5):
self.value = None
self.smooth_coef = smooth_coef
def update(self, v):
if self.value is None:
self.value = v
else:
c = self.smooth_coef
self.value = c * self.value + (1.0-c) * v
class RectSelector:
def __init__(self, win, callback):
self.win = win