Mercurial Hosting > traffic-intelligence
view python/display-trajectories.py @ 307:8e66ced156dd
add delta to sample the time window in LCSS function
author | Mohamed Gomaa |
---|---|
date | Tue, 25 Dec 2012 02:16:10 -0500 |
parents | 93c26e45efd8 |
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)