comparison python/metadata.py @ 838:2918de3d40fc

first working version of display of merged tracking
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 06 Jul 2016 12:30:08 -0400
parents 7058a40a4bbc
children 37d14818db89
comparison
equal deleted inserted replaced
837:e01cabca4c55 838:2918de3d40fc
9 from sqlalchemy import orm, create_engine, Column, Integer, Float, DateTime, String, ForeignKey, Boolean, Interval 9 from sqlalchemy import orm, create_engine, Column, Integer, Float, DateTime, String, ForeignKey, Boolean, Interval
10 from sqlalchemy.orm import relationship, backref, sessionmaker 10 from sqlalchemy.orm import relationship, backref, sessionmaker
11 from sqlalchemy.ext.declarative import declarative_base 11 from sqlalchemy.ext.declarative import declarative_base
12 12
13 from utils import datetimeFormat, removeExtension 13 from utils import datetimeFormat, removeExtension
14 from cvutils import computeUndistortMaps
14 from moving import TimeInterval 15 from moving import TimeInterval
15 16
16 Base = declarative_base() 17 Base = declarative_base()
17 18
18 class Site(Base): 19 class Site(Base):
152 self.distortionCoefficients[2] = self.distortionCoefficients2 153 self.distortionCoefficients[2] = self.distortionCoefficients2
153 self.distortionCoefficients[3] = self.distortionCoefficients3 154 self.distortionCoefficients[3] = self.distortionCoefficients3
154 self.distortionCoefficients[4] = self.distortionCoefficients4 155 self.distortionCoefficients[4] = self.distortionCoefficients4
155 else: 156 else:
156 self.distortionCoefficients = None 157 self.distortionCoefficients = None
157 158
159 def computeUndistortMaps(self):
160 if self.undistortedImageMultiplication is not None and self.intrinsicCameraMatrix is not None and self.distortionCoefficients is not None:
161 self.map1, self.map2 = computeUndistortMaps(self.resX, self.resY, self.undistortedImageMultiplication, self.intrinsicCameraMatrix, self.distortionCoefficients)
162 else:
163 self.map1 = None
164 self.map2 = None
165
158 class CameraView(Base): 166 class CameraView(Base):
159 __tablename__ = 'camera_views' 167 __tablename__ = 'camera_views'
160 idx = Column(Integer, primary_key=True) 168 idx = Column(Integer, primary_key=True)
161 description = Column(String) 169 description = Column(String)
162 homographyFilename = Column(String) # path to homograph filename, relative to the site name 170 homographyFilename = Column(String) # path to homograph filename, relative to the site name