Mercurial > hg > nsaunier > traffic-intelligence
comparison python/metadata.py @ 424:e74a09bddb6d
new fields
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 31 Oct 2013 15:25:21 -0400 |
| parents | 67c7ff5d6b26 |
| children | a31dde19caa8 |
comparison
equal
deleted
inserted
replaced
| 423:f738fa1b69f0 | 424:e74a09bddb6d |
|---|---|
| 57 id = Column(Integer, primary_key=True) | 57 id = Column(Integer, primary_key=True) |
| 58 frameRate = Column(Float) | 58 frameRate = Column(Float) |
| 59 homographyFilename = Column(String) # path to homograph filename, relative to the site name | 59 homographyFilename = Column(String) # path to homograph filename, relative to the site name |
| 60 cameraCalibrationFilename = Column(String) # path to full camera calibration, relative to the site name | 60 cameraCalibrationFilename = Column(String) # path to full camera calibration, relative to the site name |
| 61 siteId = Column(Integer, ForeignKey('sites.id')) | 61 siteId = Column(Integer, ForeignKey('sites.id')) |
| 62 homographyDistanceUnit = Column(String, default = 'm') | 62 homographyDistanceUnit = Column(String, default = 'm') # make sure it is default in the database |
| 63 # TODO default config filename | 63 configurationFilename = Column(String) # path to configuration .cfg file, relative to site name |
| 64 | 64 |
| 65 site = relationship("Site", backref=backref('camera_views', order_by = id)) | 65 site = relationship("Site", backref=backref('camera_views', order_by = id)) |
| 66 | 66 |
| 67 def __init__(self, frameRate, homographyFilename, cameraCalibrationFilename, site): | 67 def __init__(self, frameRate, homographyFilename, cameraCalibrationFilename, site, configurationFilename): |
| 68 self.frameRate = frameRate | 68 self.frameRate = frameRate |
| 69 self.homographyFilename = homographyFilename | 69 self.homographyFilename = homographyFilename |
| 70 self.site = site | 70 self.site = site |
| 71 self.configurationFilename = configurationFilename | |
| 71 | 72 |
| 72 def getHomographyFilename(self, relativeToSiteFilename = True): | 73 def getHomographyFilename(self, relativeToSiteFilename = True): |
| 73 if relativeToSiteFilename: | 74 if relativeToSiteFilename: |
| 74 return self.site.getFilename()+path.sep+self.homographyFilename | 75 return self.site.getFilename()+path.sep+self.homographyFilename |
| 75 else: | 76 else: |
| 82 startTime = Column(DateTime) | 83 startTime = Column(DateTime) |
| 83 duration = Column(Float) # video sequence duration | 84 duration = Column(Float) # video sequence duration |
| 84 durationUnit = Column(String, default = 's') | 85 durationUnit = Column(String, default = 's') |
| 85 siteId = Column(Integer, ForeignKey('sites.id')) | 86 siteId = Column(Integer, ForeignKey('sites.id')) |
| 86 cameraViewId = Column(Integer, ForeignKey('camera_views.id')) | 87 cameraViewId = Column(Integer, ForeignKey('camera_views.id')) |
| 88 configurationFilename = Column(String) | |
| 87 | 89 |
| 88 site = relationship("Site", backref=backref('video_sequences', order_by = id)) | 90 site = relationship("Site", backref=backref('video_sequences', order_by = id)) |
| 89 cameraView = relationship("CameraView", backref=backref('video_sequences', order_by = id)) | 91 cameraView = relationship("CameraView", backref=backref('video_sequences', order_by = id)) |
| 90 | 92 |
| 91 def __init__(self, name, startTime, duration, site, cameraView): | 93 def __init__(self, name, startTime, duration, site, cameraView, configurationFilename = None): |
| 92 'startTime is passed as string in utils.datetimeFormat, eg 2011-06-22 10:00:39' | 94 'startTime is passed as string in utils.datetimeFormat, eg 2011-06-22 10:00:39' |
| 93 self.name = name | 95 self.name = name |
| 94 self.startTime = datetime.strptime(startTime, datetimeFormat) | 96 self.startTime = datetime.strptime(startTime, datetimeFormat) |
| 95 self.duration = duration | 97 self.duration = duration |
| 96 self.site = site | 98 self.site = site |
| 97 self.cameraView = cameraView | 99 self.cameraView = cameraView |
| 100 self.configurationFilename = configurationFilename | |
| 98 | 101 |
| 99 def getVideoSequenceFilename(self, relativeToSiteFilename = True): | 102 def getVideoSequenceFilename(self, relativeToSiteFilename = True): |
| 100 if relativeToSiteFilename: | 103 if relativeToSiteFilename: |
| 101 return self.site.getFilename()+path.sep+self.name | 104 return self.site.getFilename()+path.sep+self.name |
| 102 else: | 105 else: |
| 103 return self.name | 106 return self.name |
| 104 | 107 |
| 108 #def getConfigurationFilename(self): | |
| 109 #'returns the local configuration filename, or the one of the camera view otherwise' | |
| 110 | |
| 105 # 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) | 111 # 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) |
| 106 | 112 |
| 107 # class SiteDescription(Base): # list of lines and polygons describing the site, eg for sidewalks, center lines | 113 # class SiteDescription(Base): # list of lines and polygons describing the site, eg for sidewalks, center lines |
| 108 | 114 |
| 109 # class Analysis(Base): # parameters necessary for processing the data: free form | 115 # class Analysis(Base): # parameters necessary for processing the data: free form |
| 110 # eg bounding box depends on camera view, tracking configuration depends on camera view | 116 # eg bounding box depends on camera view, tracking configuration depends on camera view |
| 117 # results: sqlite | |
| 111 | 118 |
| 112 def createDatabases(engine): | 119 def createDatabases(engine): |
| 113 Base.metadata.create_all(engine) | 120 Base.metadata.create_all(engine) |
