comparison python/metadata.py @ 420:def795d1120f

first work on video metadata
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 08 Oct 2013 18:26:20 -0400
parents
children 4fce27946c60
comparison
equal deleted inserted replaced
419:17c5f378c283 420:def795d1120f
1 # from moving import Point
2
3 from sqlalchemy import create_engine, Column, Integer, Float, DateTime, String, ForeignKey
4 from sqlalchemy.orm import relationship, backref
5 from sqlalchemy.ext.declarative import declarative_base
6
7 Base = declarative_base()
8
9 class Site(Base):
10 __tablename__ = 'sites'
11 id = Column(Integer, primary_key=True)
12 name = Column(String) # same as path, relative to the database position
13 description = Column(String) # longer names, eg intersection of road1 and road2
14 xcoordinate = Column(Float) # ideally moving.Point, but needs to be
15 ycoordinate = Column(Float)
16
17 def __init__(self, name, description = "", xcoordinate = None, ycoordinate = None):
18 self.name = name
19 self.description = description
20 self.xcoordinate = xcoordinate
21 self.ycoordinate = ycoordinate
22
23 # def __repr__(self):
24 # return "<User('%s','%s', '%s')>" % (self.name, self.fullname, self.password)
25
26 class EnvironementalFactors(Base):
27 '''Represents any environmental factors that may affect the results, in particular
28 * changing weather conditions
29 * changing road configuration, geometry, signalization, etc.
30 ex: sunny, rainy, before counter-measure, after counter-measure'''
31 __tablename__ = 'environmental_factors'
32 id = Column(Integer, primary_key=True)
33 startTime = Column(DateTime)
34 endTime = Column(DateTime)
35 description = Column(String) # eg sunny, before, after
36 siteId = Column(Integer, ForeignKey('sites.id'))
37
38 site = relationship("Site", backref=backref('environmental_factors', order_by = id))
39
40 class CameraView(Base):
41 __tablename__ = 'camera_views'
42 id = Column(Integer, primary_key=True)
43 frameRate = Column(Float)
44 homographyFilename = Column(String) # path to homograph filename, relative to SiteId
45 siteId = Column(Integer, ForeignKey('sites.id'))
46
47 site = relationship("Site", backref=backref('camera_views', order_by = id))
48
49 class VideoSequence(Base):
50 __tablename__ = 'video_sequences'
51 id = Column(Integer, primary_key=True)
52 startTime = Column(DateTime)
53 name = Column(String) # path that can be composed with the site name
54 startTime = Column(DateTime)
55 duration = Column(Float) # video sequence duration
56 siteId = Column(Integer, ForeignKey('sites.id'))
57 cameraViewId = Column(Integer, ForeignKey('camera_views.id'))
58
59 site = relationship("Site", backref=backref('video_sequences', order_by = id))
60 cameraView = relationship("CameraView", backref=backref('video_sequences', order_by = id))
61
62 # class SiteDescription(Base): # list of lines and polygons describing the site, eg for sidewalks, center lines