Mercurial Hosting > traffic-intelligence
comparison python/display-trajectories.py @ 333:c9201f6b143a
moved the config parser to utils
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 14 Jun 2013 10:25:00 -0400 |
parents | 20f9cd972dde |
children |
comparison
equal
deleted
inserted
replaced
332:a6ca86107f27 | 333:c9201f6b143a |
---|---|
1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
2 | 2 |
3 import sys,getopt | 3 import sys,getopt |
4 | 4 |
5 import storage | 5 import storage, cvutils, utils |
6 import cvutils | |
7 from utils import FakeSecHead | |
8 | 6 |
9 from numpy.linalg.linalg import inv | 7 from numpy.linalg.linalg import inv |
10 from numpy import loadtxt | 8 from numpy import loadtxt |
11 from ConfigParser import ConfigParser | |
12 | 9 |
13 options, args = getopt.getopt(sys.argv[1:], 'hi:d:t:o:f:',['help']) | 10 options, args = getopt.getopt(sys.argv[1:], 'hi:d:t:o:f:',['help']) |
14 # alternative long names are a pain to support ,'video-filename=','database-filename=', 'type=' | 11 # alternative long names are a pain to support ,'video-filename=','database-filename=', 'type=' |
15 | 12 |
16 options = dict(options) | 13 options = dict(options) |
27 objectType = 'feature' | 24 objectType = 'feature' |
28 if '-t' in options.keys(): | 25 if '-t' in options.keys(): |
29 objectType = options['-t'] | 26 objectType = options['-t'] |
30 | 27 |
31 if len(args)>0: # consider there is a configuration file | 28 if len(args)>0: # consider there is a configuration file |
32 config = ConfigParser() | 29 params = utils.TrackingParameters() |
33 config.readfp(FakeSecHead(open(args[0]))) | 30 params.loadConfigFile(args[0]) |
34 sectionHeader = config.sections()[0] | 31 videoFilename = params.videoFilename |
35 videoFilename = config.get(sectionHeader, 'video-filename') | 32 databaseFilename = params.databaseFilename |
36 databaseFilename = config.get(sectionHeader, 'database-filename') | 33 homography = inv(params.homography) |
37 homography = inv(loadtxt(config.get(sectionHeader, 'homography-filename'))) | 34 firstFrameNum = params.firstFrameNum |
38 firstFrameNum = config.getint(sectionHeader, 'frame1') | |
39 else: | 35 else: |
40 videoFilename = options['-i'] | 36 videoFilename = options['-i'] |
41 databaseFilename = options['-d'] | 37 databaseFilename = options['-d'] |
42 homography = None | 38 homography = None |
43 if '-o' in options.keys(): | 39 if '-o' in options.keys(): |