Mercurial Hosting > traffic-intelligence
comparison python/safety-analysis.py @ 328:5e43b7389c25
script for safety analysis
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 12 Jun 2013 18:23:16 -0400 |
parents | |
children | c9201f6b143a |
comparison
equal
deleted
inserted
replaced
327:42f2b46ec210 | 328:5e43b7389c25 |
---|---|
1 #! /usr/bin/env python | |
2 | |
3 import sys,getopt | |
4 | |
5 import matplotlib.pyplot as plt | |
6 import numpy as np | |
7 | |
8 from ConfigParser import ConfigParser | |
9 | |
10 options, args = getopt.getopt(sys.argv[1:], 'hi:d:t:o:f:',['help']) | |
11 | |
12 options = dict(options) | |
13 | |
14 print options, args | |
15 | |
16 if '--help' in options.keys() or '-h' in options.keys() or len(sys.argv) == 1: | |
17 print('Usage: '+sys.argv[0]+' --help|-h config_file.cfg\n' | |
18 'The program processes indicators for all pairs of road users in the scene\n\n' | |
19 'Order matters between positional and named arguments') | |
20 sys.exit() | |
21 | |
22 # TODO work on the way to indicate an interaction definition | |
23 | |
24 if len(args)>0: # consider there is a configuration file | |
25 config = ConfigParser() | |
26 config.readfp(FakeSecHead(open(args[0]))) | |
27 sectionHeader = config.sections()[0] | |
28 videoFilename = config.get(sectionHeader, 'video-filename') | |
29 databaseFilename = config.get(sectionHeader, 'database-filename') | |
30 homography = inv(loadtxt(config.get(sectionHeader, 'homography-filename'))) | |
31 firstFrameNum = config.getint(sectionHeader, 'frame1') | |
32 | |
33 |