Mercurial Hosting > traffic-intelligence
diff scripts/polytracktopdtv.py @ 636:3058e00887bc
removed all issues because of tests with None, using is instead of == or !=
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 24 Mar 2015 18:11:28 +0100 |
parents | 4dd68b0765b1 |
children | 933670761a57 |
line wrap: on
line diff
--- a/scripts/polytracktopdtv.py Tue Mar 24 14:17:12 2015 +0100 +++ b/scripts/polytracktopdtv.py Tue Mar 24 18:11:28 2015 +0100 @@ -35,7 +35,7 @@ cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='objects_type'") data = cursor.fetchone() - if(data == None): + if(data is None): typeDict["0"] = "unknown" typeDict["1"] = "car" typeDict["2"] = "pedestrians" @@ -59,7 +59,7 @@ inc = 1000 #How many frame we fetch in the video at a time - if lastFrameNum != None: + if lastFrameNum is not None: delta = lastFrameNum-firstFrameNum if delta < inc: inc = delta @@ -74,7 +74,7 @@ time += datetime.timedelta(microseconds=deltaTimestamp*1000) currentIdx = currentIdx + inc - if lastFrameNum != None: + if lastFrameNum is not None: delta = lastFrameNum-currentIdx if delta < inc: inc = delta @@ -96,15 +96,15 @@ lastFrameNum is the last frame we want to extract (or None if we want to extract everything) ''' error = False - if sceneFilename != None: + if sceneFilename is not None: scene = utils.SceneParameters.loadConfigFile(os.path.join(workDirname, sceneFilename)) time = scene[sectionName].date inputDb = os.path.join(workDirname, scene[sectionName].databaseFilename) videoFile = os.path.join(workDirname, scene[sectionName].videoFilename) - if databaseFilename != None: + if databaseFilename is not None: inputDb = os.path.join(workDirname, databaseFilename) - if videoFilename != None: + if videoFilename is not None: videoFile = os.path.join(workDirname, videoFilename) # elif videoFolderExist == False: # print('No video path specified') @@ -113,7 +113,7 @@ videoFolderPath = os.path.join(workDirname, "videoframes/") fileName = sectionName - if videoFile != None: + if videoFile is not None: fps = cvutils.getFPS(videoFile) print('Video should run at ' + str(fps) + ' fps') deltaTimestamp = 1000.0/float(fps); @@ -147,7 +147,7 @@ zipFolder(videoFolderPath, inputZipVideoName) print('Zipping files...Done.') #We generate the structure for ZipVideo - if cameraCalibrationFilename != None: + if cameraCalibrationFilename is not None: calibrationFile = cameraCalibrationFilename else: calibrationFile = 'calib.json' @@ -189,7 +189,7 @@ #3) We read the bounding box table cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='bounding_boxes'") data = cursor.fetchone() - if data == None: + if data is None: print('No bounding box table. Maybe it was not generated ?') else: cursor.execute("SELECT object_id, frame_number, x_top_left, y_top_left, x_bottom_right, y_bottom_right FROM bounding_boxes")