Mercurial Hosting > traffic-intelligence
comparison python/storage.py @ 895:739acd338cc0
added script to extract camera info from tacal file by Lund University (T analyst)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 01 Jun 2017 14:54:11 -0400 |
parents | ff92801e5c54 |
children | 1466a63dd1cf |
comparison
equal
deleted
inserted
replaced
894:0c1fed9e8862 | 895:739acd338cc0 |
---|---|
1207 | 1207 |
1208 print nObjectsPerType | 1208 print nObjectsPerType |
1209 | 1209 |
1210 out.close() | 1210 out.close() |
1211 | 1211 |
1212 def loadPinholeCameraModel(filename, tanalystFormat = True): | |
1213 '''Loads the data from a file containing the camera parameters | |
1214 (pinhole camera model, http://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html) | |
1215 and returns a dictionary''' | |
1216 if tanalystFormat: | |
1217 f = openCheck(filename, quitting = True) | |
1218 content = getLines(f) | |
1219 cameraData = {} | |
1220 for l in content: | |
1221 tmp = l.split(':') | |
1222 cameraData[tmp[0]] = float(tmp[1].strip().replace(',','.')) | |
1223 return cameraData | |
1224 else: | |
1225 print('Unknown camera model (not tanalyst format') | |
1226 return None | |
1227 | |
1212 def savePositionsToCsv(f, obj): | 1228 def savePositionsToCsv(f, obj): |
1213 timeInterval = obj.getTimeInterval() | 1229 timeInterval = obj.getTimeInterval() |
1214 positions = obj.getPositions() | 1230 positions = obj.getPositions() |
1215 curvilinearPositions = obj.getCurvilinearPositions() | 1231 curvilinearPositions = obj.getCurvilinearPositions() |
1216 for i in xrange(int(obj.length())): | 1232 for i in xrange(int(obj.length())): |