changeset 424:e74a09bddb6d

new fields
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 31 Oct 2013 15:25:21 -0400
parents f738fa1b69f0
children a31dde19caa8
files python/metadata.py
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/python/metadata.py	Mon Oct 21 23:58:40 2013 -0400
+++ b/python/metadata.py	Thu Oct 31 15:25:21 2013 -0400
@@ -59,15 +59,16 @@
     homographyFilename = Column(String) # path to homograph filename, relative to the site name
     cameraCalibrationFilename = Column(String) # path to full camera calibration, relative to the site name
     siteId = Column(Integer, ForeignKey('sites.id'))
-    homographyDistanceUnit = Column(String, default = 'm')
-    # TODO default config filename
+    homographyDistanceUnit = Column(String, default = 'm') # make sure it is default in the database
+    configurationFilename = Column(String) # path to configuration .cfg file, relative to site name
 
     site = relationship("Site", backref=backref('camera_views', order_by = id))
 
-    def __init__(self, frameRate, homographyFilename, cameraCalibrationFilename, site):
+    def __init__(self, frameRate, homographyFilename, cameraCalibrationFilename, site, configurationFilename):
         self.frameRate = frameRate
         self.homographyFilename = homographyFilename
         self.site = site
+        self.configurationFilename = configurationFilename
 
     def getHomographyFilename(self, relativeToSiteFilename = True):
         if relativeToSiteFilename:
@@ -84,17 +85,19 @@
     durationUnit = Column(String, default = 's')
     siteId = Column(Integer, ForeignKey('sites.id'))
     cameraViewId = Column(Integer, ForeignKey('camera_views.id'))
+    configurationFilename = Column(String)
 
     site = relationship("Site", backref=backref('video_sequences', order_by = id))
     cameraView = relationship("CameraView", backref=backref('video_sequences', order_by = id))
 
-    def __init__(self, name, startTime, duration, site, cameraView):
+    def __init__(self, name, startTime, duration, site, cameraView, configurationFilename = None):
         'startTime is passed as string in utils.datetimeFormat, eg 2011-06-22 10:00:39'
         self.name = name
         self.startTime = datetime.strptime(startTime, datetimeFormat)
         self.duration = duration
         self.site = site
         self.cameraView = cameraView
+        self.configurationFilename = configurationFilename
 
     def getVideoSequenceFilename(self, relativeToSiteFilename = True):
         if relativeToSiteFilename:
@@ -102,12 +105,16 @@
         else:
             return self.name
 
+        #def getConfigurationFilename(self):
+        #'returns the local configuration filename, or the one of the camera view otherwise'
+
 # add class for Analysis: foreign key VideoSequenceId, dataFilename, configFilename (get the one from camera view by default), mask? (no, can be referenced in the tracking cfg file)
 
 # class SiteDescription(Base): # list of lines and polygons describing the site, eg for sidewalks, center lines
 
 # class Analysis(Base): # parameters necessary for processing the data: free form
 # eg bounding box depends on camera view, tracking configuration depends on camera view 
+# results: sqlite
 
 def createDatabases(engine):
     Base.metadata.create_all(engine)