Mercurial > hg > nsaunier > traffic-intelligence
comparison python/storage.py @ 586:ff4f0ce46ca6
modified name for loading bounding boxes (only for display)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 04 Dec 2014 17:21:45 -0500 |
| parents | aab2242ea88c |
| children | cf578ba866da |
comparison
equal
deleted
inserted
replaced
| 585:aab2242ea88c | 586:ff4f0ce46ca6 |
|---|---|
| 478 except sqlite3.OperationalError as error: | 478 except sqlite3.OperationalError as error: |
| 479 printDBError(error) | 479 printDBError(error) |
| 480 connection.commit() | 480 connection.commit() |
| 481 connection.close() | 481 connection.close() |
| 482 | 482 |
| 483 def loadBoundingBoxTable(filename): | 483 def loadBoundingBoxTableForDisplay(filename): |
| 484 connection = sqlite3.connect(filename) | 484 connection = sqlite3.connect(filename) |
| 485 cursor = connection.cursor() | 485 cursor = connection.cursor() |
| 486 boundingBoxes = {} # list of bounding boxes for each instant | 486 boundingBoxes = {} # list of bounding boxes for each instant |
| 487 try: | 487 try: |
| 488 cursor.execute('SELECT name FROM sqlite_master WHERE type=\'table\' AND name=\'bounding_boxes\'') | 488 cursor.execute('SELECT name FROM sqlite_master WHERE type=\'table\' AND name=\'bounding_boxes\'') |
| 489 result = [row for row in cursor] | 489 result = [row for row in cursor] |
| 490 if len(result) > 0: | 490 if len(result) > 0: |
| 491 cursor.execute('SELECT * FROM bounding_boxes') | 491 cursor.execute('SELECT * FROM bounding_boxes') |
| 492 #objId = -1 | |
| 493 for row in cursor: | 492 for row in cursor: |
| 494 #if row[0] != objId: | |
| 495 boundingBoxes.setdefault(row[1], []).append([moving.Point(row[2], row[3]), moving.Point(row[4], row[5])]) | 493 boundingBoxes.setdefault(row[1], []).append([moving.Point(row[2], row[3]), moving.Point(row[4], row[5])]) |
| 496 except sqlite3.OperationalError as error: | 494 except sqlite3.OperationalError as error: |
| 497 printDBError(error) | 495 printDBError(error) |
| 498 return boundingBoxes | 496 return boundingBoxes |
| 499 connection.close() | 497 connection.close() |
