changeset 328:5e43b7389c25

script for safety analysis
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 12 Jun 2013 18:23:16 -0400
parents 42f2b46ec210
children a70c205ebdd9
files python/safety-analysis.py
diffstat 1 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/safety-analysis.py	Wed Jun 12 18:23:16 2013 -0400
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+
+import sys,getopt
+
+import matplotlib.pyplot as plt
+import numpy as np
+
+from ConfigParser import ConfigParser
+
+options, args = getopt.getopt(sys.argv[1:], 'hi:d:t:o:f:',['help']) 
+
+options = dict(options)
+
+print options, args
+
+if '--help' in options.keys() or '-h' in options.keys() or len(sys.argv) == 1:
+    print('Usage: '+sys.argv[0]+' --help|-h config_file.cfg\n'
+          'The program processes indicators for all pairs of road users in the scene\n\n'
+          'Order matters between positional and named arguments')
+    sys.exit()
+
+# TODO work on the way to indicate an interaction definition
+
+if len(args)>0: # consider there is a configuration file
+    config = ConfigParser()
+    config.readfp(FakeSecHead(open(args[0])))
+    sectionHeader = config.sections()[0]
+    videoFilename = config.get(sectionHeader, 'video-filename')
+    databaseFilename = config.get(sectionHeader, 'database-filename')
+    homography = inv(loadtxt(config.get(sectionHeader, 'homography-filename')))
+    firstFrameNum = config.getint(sectionHeader, 'frame1')
+
+