Mercurial > hg > nsaunier > traffic-intelligence
comparison python/metadata.py @ 836:7058a40a4bbc
updated metadata and code to merge features from different cameras
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 06 Jul 2016 10:18:35 -0400 |
| parents | 2a5856961933 |
| children | 2918de3d40fc |
comparison
equal
deleted
inserted
replaced
| 835:f3ae72d86762 | 836:7058a40a4bbc |
|---|---|
| 162 homographyFilename = Column(String) # path to homograph filename, relative to the site name | 162 homographyFilename = Column(String) # path to homograph filename, relative to the site name |
| 163 siteIdx = Column(Integer, ForeignKey('sites.idx')) | 163 siteIdx = Column(Integer, ForeignKey('sites.idx')) |
| 164 cameraTypeIdx = Column(Integer, ForeignKey('camera_types.idx')) | 164 cameraTypeIdx = Column(Integer, ForeignKey('camera_types.idx')) |
| 165 trackingConfigurationFilename = Column(String) # path to configuration .cfg file, relative to site name | 165 trackingConfigurationFilename = Column(String) # path to configuration .cfg file, relative to site name |
| 166 maskFilename = Column(String) # path to mask file, relative to site name | 166 maskFilename = Column(String) # path to mask file, relative to site name |
| 167 virtual = Column(Boolean) # indicates it is not a real camera view, eg merged | |
| 167 | 168 |
| 168 site = relationship("Site", backref=backref('sites', order_by = idx)) | 169 site = relationship("Site", backref=backref('sites', order_by = idx)) |
| 169 cameraType = relationship('CameraType', backref=backref('camera_views', order_by = idx)) | 170 cameraType = relationship('CameraType', backref=backref('camera_views', order_by = idx)) |
| 170 | 171 |
| 171 def __init__(self, description, homographyFilename, site, cameraType, trackingConfigurationFilename, maskFilename): | 172 def __init__(self, description, homographyFilename, site, cameraType, trackingConfigurationFilename, maskFilename, virtual = False): |
| 172 self.description = description | 173 self.description = description |
| 173 self.homographyFilename = homographyFilename | 174 self.homographyFilename = homographyFilename |
| 174 self.site = site | 175 self.site = site |
| 175 self.cameraType = cameraType | 176 self.cameraType = cameraType |
| 176 self.trackingConfigurationFilename = trackingConfigurationFilename | 177 self.trackingConfigurationFilename = trackingConfigurationFilename |
| 177 self.maskFilename = maskFilename | 178 self.maskFilename = maskFilename |
| 179 self.virtual = virtual | |
| 178 | 180 |
| 179 def getHomographyFilename(self, relativeToSiteFilename = True): | 181 def getHomographyFilename(self, relativeToSiteFilename = True): |
| 180 if relativeToSiteFilename: | 182 if relativeToSiteFilename: |
| 181 return self.site.getFilename()+path.sep+self.homographyFilename | 183 return self.site.getFilename()+path.sep+self.homographyFilename |
| 182 else: | 184 else: |
| 230 idx = Column(Integer, primary_key=True) | 232 idx = Column(Integer, primary_key=True) |
| 231 name = Column(String) # path relative to the the site name | 233 name = Column(String) # path relative to the the site name |
| 232 startTime = Column(DateTime) | 234 startTime = Column(DateTime) |
| 233 duration = Column(Interval) # video sequence duration | 235 duration = Column(Interval) # video sequence duration |
| 234 databaseFilename = Column(String) # path relative to the the site name | 236 databaseFilename = Column(String) # path relative to the the site name |
| 237 virtual = Column(Boolean) # indicates it is not a real video sequence (no video file), eg merged | |
| 235 cameraViewIdx = Column(Integer, ForeignKey('camera_views.idx')) | 238 cameraViewIdx = Column(Integer, ForeignKey('camera_views.idx')) |
| 236 | 239 |
| 237 cameraView = relationship("CameraView", backref=backref('video_sequences', order_by = idx)) | 240 cameraView = relationship("CameraView", backref=backref('video_sequences', order_by = idx)) |
| 238 | 241 |
| 239 def __init__(self, name, startTime, duration, cameraView, databaseFilename = None): | 242 def __init__(self, name, startTime, duration, cameraView, databaseFilename = None, virtual = False): |
| 240 '''startTime is passed as string in utils.datetimeFormat, eg 2011-06-22 10:00:39 | 243 '''startTime is passed as string in utils.datetimeFormat, eg 2011-06-22 10:00:39 |
| 241 duration is a timedelta object''' | 244 duration is a timedelta object''' |
| 242 self.name = name | 245 self.name = name |
| 243 if isinstance(startTime, str): | 246 if isinstance(startTime, str): |
| 244 self.startTime = datetime.strptime(startTime, datetimeFormat) | 247 self.startTime = datetime.strptime(startTime, datetimeFormat) |
| 246 self.startTime = startTime | 249 self.startTime = startTime |
| 247 self.duration = duration | 250 self.duration = duration |
| 248 self.cameraView = cameraView | 251 self.cameraView = cameraView |
| 249 if databaseFilename is None and len(self.name) > 0: | 252 if databaseFilename is None and len(self.name) > 0: |
| 250 self.databaseFilename = removeExtension(self.name)+'.sqlite' | 253 self.databaseFilename = removeExtension(self.name)+'.sqlite' |
| 254 self.virtual = virtual | |
| 251 | 255 |
| 252 def getVideoSequenceFilename(self, relativeToSiteFilename = True): | 256 def getVideoSequenceFilename(self, relativeToSiteFilename = True): |
| 253 if relativeToSiteFilename: | 257 if relativeToSiteFilename: |
| 254 return self.cameraView.site.getFilename()+path.sep+self.name | 258 return self.cameraView.site.getFilename()+path.sep+self.name |
| 255 else: | 259 else: |
