Mercurial > hg > nsaunier > traffic-intelligence
annotate scripts/create-bounding-boxes.py @ 398:3399bd48cb40
Ajout d'une méthode pour obtenir le nombre de FPS
Méthode de capture des trames vidéos plus résistante aux erreur
Utilisation d'un dictionnaire pour les fichier de configuration afin de garder le nom des sections
| author | Jean-Philippe Jodoin <jpjodoin@gmail.com> |
|---|---|
| date | Mon, 29 Jul 2013 13:46:07 -0400 |
| parents | eaf7765221d9 |
| children | 6551a3cf1750 |
| rev | line source |
|---|---|
|
393
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
1 #! /usr/bin/env python |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
2 |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
3 import argparse |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
4 |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
5 import storage |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
6 |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
7 from numpy.linalg.linalg import inv |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
8 from numpy import loadtxt |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
9 |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
10 parser = argparse.ArgumentParser(description='The program creates bounding boxes in image space around all features (for display and for comparison to ground truth in the form of bouding boxes.') |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
11 parser.add_argument('-d', dest = 'databaseFilename', help = 'name of the Sqlite database file', required = True) |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
12 parser.add_argument('-o', dest = 'homography', help = 'name of the image to world homography') |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
13 |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
14 args = parser.parse_args() |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
15 |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
16 homography = None |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
17 if args.homography != None: |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
18 homography = inv(loadtxt(args.homography)) |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
19 |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
20 storage.createBoundingBoxTable(args.databaseFilename, homography) |
|
eaf7765221d9
added code to create bounding boxes and display them (inc scripts)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
21 |
