Mercurial Hosting > traffic-intelligence
diff python/storage.py @ 393:eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 26 Jul 2013 02:12:08 -0400 |
parents | 12be4a0cb9aa |
children | 6567fee37c16 |
line wrap: on
line diff
--- a/python/storage.py Thu Jul 25 18:59:35 2013 -0400 +++ b/python/storage.py Fri Jul 26 02:12:08 2013 -0400 @@ -307,6 +307,26 @@ connection.commit() connection.close() +def loadBoundingBoxTable(filename): + connection = sqlite3.connect(filename) + cursor = connection.cursor() + boundingBoxes = {} # list of bounding boxes for each instant + try: + cursor.execute('SELECT name FROM sqlite_master WHERE type=\'table\' AND name=\'boundingbox\'') + result = [row for row in cursor] + if len(result) > 0: + cursor.execute('SELECT * FROM boundingbox') + #objId = -1 + for row in cursor: + #if row[0] != objId: + boundingBoxes.setdefault(row[1], []).append([moving.Point(row[2], row[3]), moving.Point(row[4], row[5])]) + except sqlite3.OperationalError as error: + utils.printDBError(error) + return boundingBoxes + connection.close() + return boundingBoxes + + ######################### # txt files #########################