Mercurial > hg > nsaunier > traffic-intelligence
comparison python/storage.py @ 862:2d6249fe905a
correcting bug
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 07 Nov 2016 11:11:10 -0500 |
| parents | f9c9457b60c2 |
| children | 6db83beb5350 |
comparison
equal
deleted
inserted
replaced
| 861:f9c9457b60c2 | 862:2d6249fe905a |
|---|---|
| 1256 from ConfigParser import ConfigParser | 1256 from ConfigParser import ConfigParser |
| 1257 | 1257 |
| 1258 config = ConfigParser() | 1258 config = ConfigParser() |
| 1259 config.readfp(FakeSecHead(openCheck(filename))) | 1259 config.readfp(FakeSecHead(openCheck(filename))) |
| 1260 # check if path contains directory names | 1260 # check if path contains directory names |
| 1261 dirname = path.split(filename)[0] | 1261 if len(path.split(filename)[0]) == 0: |
| 1262 dirname = '.'+path.sep | |
| 1263 else: | |
| 1264 dirname = path.split(filename)[0]+path.sep | |
| 1262 | 1265 |
| 1263 self.sectionHeader = config.sections()[0] | 1266 self.sectionHeader = config.sections()[0] |
| 1264 # Tracking/display parameters | 1267 # Tracking/display parameters |
| 1265 self.videoFilename = config.get(self.sectionHeader, 'video-filename') | 1268 self.videoFilename = config.get(self.sectionHeader, 'video-filename') |
| 1266 self.databaseFilename = config.get(self.sectionHeader, 'database-filename') | 1269 self.databaseFilename = config.get(self.sectionHeader, 'database-filename') |
| 1267 self.homographyFilename = config.get(self.sectionHeader, 'homography-filename') | 1270 self.homographyFilename = config.get(self.sectionHeader, 'homography-filename') |
| 1268 if (path.exists(self.homographyFilename)): | 1271 if path.exists(dirname+self.homographyFilename): |
| 1269 self.homography = loadtxt(self.homographyFilename) | 1272 self.homography = loadtxt(dirname+self.homographyFilename) |
| 1270 else: | 1273 else: |
| 1271 self.homography = None | 1274 self.homography = None |
| 1272 self.intrinsicCameraFilename = config.get(self.sectionHeader, 'intrinsic-camera-filename') | 1275 self.intrinsicCameraFilename = config.get(self.sectionHeader, 'intrinsic-camera-filename') |
| 1273 if (path.exists(dirname+path.sep+self.intrinsicCameraFilename)): | 1276 if path.exists(dirname+self.intrinsicCameraFilename): |
| 1274 self.intrinsicCameraMatrix = loadtxt(dirname+path.sep+self.intrinsicCameraFilename) | 1277 self.intrinsicCameraMatrix = loadtxt(dirname+self.intrinsicCameraFilename) |
| 1275 else: | 1278 else: |
| 1276 self.intrinsicCameraMatrix = None | 1279 self.intrinsicCameraMatrix = None |
| 1277 distortionCoefficients = getValuesFromINIFile(filename, 'distortion-coefficients', '=') | 1280 distortionCoefficients = getValuesFromINIFile(filename, 'distortion-coefficients', '=') |
| 1278 self.distortionCoefficients = [float(x) for x in distortionCoefficients] | 1281 self.distortionCoefficients = [float(x) for x in distortionCoefficients] |
| 1279 self.undistortedImageMultiplication = config.getfloat(self.sectionHeader, 'undistorted-size-multiplication') | 1282 self.undistortedImageMultiplication = config.getfloat(self.sectionHeader, 'undistorted-size-multiplication') |
