diff 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
line wrap: on
line diff
--- a/python/metadata.py	Wed Jul 06 10:58:18 2016 -0400
+++ b/python/metadata.py	Wed Jul 06 12:30:08 2016 -0400
@@ -11,6 +11,7 @@
 from sqlalchemy.ext.declarative import declarative_base
 
 from utils import datetimeFormat, removeExtension
+from cvutils import computeUndistortMaps
 from moving import TimeInterval
 
 Base = declarative_base()
@@ -154,7 +155,14 @@
             self.distortionCoefficients[4] = self.distortionCoefficients4
         else:
             self.distortionCoefficients = None
-        
+
+    def computeUndistortMaps(self):
+        if self.undistortedImageMultiplication is not None and self.intrinsicCameraMatrix is not None and self.distortionCoefficients is not None:
+            self.map1, self.map2 = computeUndistortMaps(self.resX, self.resY, self.undistortedImageMultiplication, self.intrinsicCameraMatrix, self.distortionCoefficients)
+        else:
+            self.map1 = None
+            self.map2 = None
+    
 class CameraView(Base):
     __tablename__ = 'camera_views'
     idx = Column(Integer, primary_key=True)