Mercurial Hosting > traffic-intelligence
comparison python/storage.py @ 482:f6415f012640
adding functionalities (save images directly to display trajectories to create movies
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 02 Apr 2014 16:12:24 -0400 |
parents | a2ff03a52b73 |
children | 343cfd185ca6 |
comparison
equal
deleted
inserted
replaced
481:b6ad86ee7033 | 482:f6415f012640 |
---|---|
250 except sqlite3.OperationalError as error: | 250 except sqlite3.OperationalError as error: |
251 utils.printDBError(error) | 251 utils.printDBError(error) |
252 connection.commit() | 252 connection.commit() |
253 connection.close() | 253 connection.close() |
254 | 254 |
255 def loadIndicators(filename): | 255 def loadInteractions(filename): |
256 '''Loads interaction indicators | 256 '''Loads interaction and their indicators |
257 | 257 |
258 TODO choose the interactions to load''' | 258 TODO choose the interactions to load''' |
259 interactions = [] | 259 interactions = [] |
260 connection = sqlite3.connect(filename) | 260 connection = sqlite3.connect(filename) |
261 cursor = connection.cursor() | 261 cursor = connection.cursor() |
293 return interactions | 293 return interactions |
294 # load first and last object instants | 294 # load first and last object instants |
295 # CREATE TEMP TABLE IF NOT EXISTS object_instants AS SELECT OF.object_id, min(frame_number) as first_instant, max(frame_number) as last_instant from positions P, objects_features OF where P.trajectory_id = OF.trajectory_id group by OF.object_id order by OF.object_id | 295 # CREATE TEMP TABLE IF NOT EXISTS object_instants AS SELECT OF.object_id, min(frame_number) as first_instant, max(frame_number) as last_instant from positions P, objects_features OF where P.trajectory_id = OF.trajectory_id group by OF.object_id order by OF.object_id |
296 | 296 |
297 def createBoundingBoxTable(filename, invHomography = None): | 297 def createBoundingBoxTable(filename, invHomography = None): |
298 '''Create the table to store the object bounding boxes | 298 '''Create the table to store the object bounding boxes in image space |
299 ''' | 299 ''' |
300 connection = sqlite3.connect(filename) | 300 connection = sqlite3.connect(filename) |
301 cursor = connection.cursor() | 301 cursor = connection.cursor() |
302 try: | 302 try: |
303 cursor.execute('CREATE TABLE IF NOT EXISTS bounding_boxes (object_id INTEGER, frame_number INTEGER, x_top_left REAL, y_top_left REAL, x_bottom_right REAL, y_bottom_right REAL, PRIMARY KEY(object_id, frame_number))') | 303 cursor.execute('CREATE TABLE IF NOT EXISTS bounding_boxes (object_id INTEGER, frame_number INTEGER, x_top_left REAL, y_top_left REAL, x_bottom_right REAL, y_bottom_right REAL, PRIMARY KEY(object_id, frame_number))') |