Mercurial Hosting > traffic-intelligence
view python/display-trajectories.py @ 239:93c26e45efd8
modified functions to read velocities from sqlite database
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 11 Jul 2012 16:30:23 -0400 |
parents | eb4525853030 |
children | 20f9cd972dde |
line wrap: on
line source
#! /usr/bin/env python import sys,getopt import storage import cvutils from numpy.linalg.linalg import inv from numpy import loadtxt options, args = getopt.getopt(sys.argv[1:], 'hi:d:t:o:f:',['help']) # alternative long names are a pain to support ,'video-filename=','database-filename=', 'type=' # todo parse the cfg file (problem, python ConfigParser needs section headers) options = dict(options) if '--help' in options.keys() or '-h' in options.keys() or len(sys.argv) == 1 or not '-i' in options.keys() or not '-d' in options.keys(): print('Usage: {0} --help|-h -i video-filename -d database-filename [-t object_type] [-o image2world_homography] [-f first_frame]'.format(sys.argv[0])) sys.exit() objectType = 'feature' if '-t' in options.keys(): objectType = options['-t'] objects = storage.loadTrajectoriesFromSqlite(options['-d'], objectType) homography = None if '-o' in options.keys(): homography = inv(loadtxt(options['-o'])) firstFrameNum = 0 if '-f' in options.keys(): firstFrameNum = int(options['-f']) cvutils.displayTrajectories(options['-i'], objects, homography, firstFrameNum)