Mercurial Hosting > traffic-intelligence
diff python/play-video.py @ 305:ca9131968bce
added sample to replay video
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 29 Mar 2013 21:20:12 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/play-video.py Fri Mar 29 21:20:12 2013 -0400 @@ -0,0 +1,22 @@ +#! /usr/bin/env python + +import sys,getopt +import cvutils + +options, args = getopt.getopt(sys.argv[1:], 'hi:f:',['help', 'fps=']) +options = dict(options) +print options + +if '--help' in options.keys() or '-h' in options.keys() or len(sys.argv) == 1: + print('Usage: '+sys.argv[0]+' --help|-h -i video-filename [-f first_frame] [--fps frame_rate]') + sys.exit() + +firstFrameNum = 0 +if '-f' in options.keys(): + firstFrameNum = int(options['-f']) + +frameRate = -1 +if '--fps' in options.keys(): + frameRate = int(options['--fps']) + +cvutils.playVideo(options['-i'], firstFrameNum, frameRate)