diff 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
line wrap: on
line diff
--- a/python/display-trajectories.py	Fri Jun 14 09:53:32 2013 -0400
+++ b/python/display-trajectories.py	Fri Jun 14 10:25:00 2013 -0400
@@ -2,13 +2,10 @@
 
 import sys,getopt
 
-import storage
-import cvutils
-from utils import FakeSecHead
+import storage, cvutils, utils
 
 from numpy.linalg.linalg import inv
 from numpy import loadtxt
-from ConfigParser import ConfigParser
 
 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='
@@ -29,13 +26,12 @@
     objectType = options['-t']
 
 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')
+    params = utils.TrackingParameters()
+    params.loadConfigFile(args[0])
+    videoFilename = params.videoFilename
+    databaseFilename = params.databaseFilename
+    homography = inv(params.homography)
+    firstFrameNum = params.firstFrameNum
 else:
     videoFilename = options['-i']
     databaseFilename = options['-d']