From 785428546beb3903b61d2c0bd1866f8013e6027d Mon Sep 17 00:00:00 2001 From: Alexander Mordvintsev Date: Tue, 30 Aug 2011 09:34:06 +0000 Subject: [PATCH] lk_track.py description --- samples/python2/_coverage.py | 3 +++ samples/python2/lk_track.py | 27 +++++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/samples/python2/_coverage.py b/samples/python2/_coverage.py index cdad18af2..e64c7c9bc 100644 --- a/samples/python2/_coverage.py +++ b/samples/python2/_coverage.py @@ -11,6 +11,9 @@ for fn in glob('*.py'): found |= set(re.findall('cv2?\.\w+', code)) cv2_used = found & cv2_callable +cv2_unused = cv2_callable - cv2_used +with open('unused_api.txt', 'w') as f: + f.write('\n'.join(sorted(cv2_unused))) r = 1.0 * len(cv2_used) / len(cv2_callable) print '\ncv2 api coverage: %d / %d (%.1f%%)' % ( len(cv2_used), len(cv2_callable), r*100 ) diff --git a/samples/python2/lk_track.py b/samples/python2/lk_track.py index 10e396150..0cbd52edf 100644 --- a/samples/python2/lk_track.py +++ b/samples/python2/lk_track.py @@ -1,16 +1,27 @@ +''' +Lucas-Kanade tracker +==================== + +Lucas-Kanade sparse optical flow demo. Uses goodFeaturesToTrack +for track initialization and back-tracking for match verification +between frames. + +Usage +----- +lk_track.py [] + + +Keys +---- +ESC - exit +''' + import numpy as np import cv2 import video from common import anorm2, draw_str from time import clock -help_message = ''' -USAGE: lk_track.py [] - -Keys: - SPACE - reset features -''' - lk_params = dict( winSize = (15, 15), maxLevel = 2, criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03), @@ -79,7 +90,7 @@ def main(): try: video_src = sys.argv[1] except: video_src = 0 - print help_message + print __doc__ App(video_src).run() if __name__ == '__main__':