tvaLib
create-metadata.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # tvaLib Copyright (c) 2012-2016 Paul G. St-Aubin
3 # Ecole Polytechnique de Montreal, McGill University
4 # Python 2.7; (dt) Spyder Windows 10 64-bit; ipython Ubuntu 15.04 64-bit
5 version = 'R2.3.0 u. 2017-03-22'
6 
7 
8 
11 def main():
12 
16  import os
17  from site import addsitedir
18  #Add root directory from parent if available
19  if(os.path.isfile(os.path.join(os.getcwd(), os.pardir, 'main.py'))):
20  addsitedir(os.path.join(os.getcwd(), os.pardir))
21  os.chdir(os.path.join(os.getcwd(), os.pardir))
22 
23  import include.config as tvaConfig
24 
25  import lib.metadata as tvaMetaData
26 
27 
30  commands = tvaConfig.commands()
31  config = tvaConfig.Config(readonly=True)
32  if(commands.dir): config.dir = commands.dir
33  if(commands.file): config.dbn = commands.dbn
34 
35 
38  session = tvaMetaData.createDatabase(os.path.join(config.dir, config.dbn)) # if the tables were not created, need to do it
39 
40 
43  camTypes = session.query(tvaMetaData.CamType).all()
44  camTypes.append(tvaMetaData.CamType(name='Vivotek 1', resX=800, resY=600, frameRate=15.15, camera_matrix='[[539.01,0.0,400.0],[0.0,505.97,300.0],[0.0,0.0,1.0]]', dist_coeffs='[-0.35087995,0.16883034,0.0,0.0,-0.0514557]', FOV=1, freeScalingParameter=1.31, imageScalingFactor=1.31)) #0
45  camTypes.append(tvaMetaData.CamType(name='Vivotek 2', resX=800, resY=600, frameRate=30.00, camera_matrix='[[539.01,0.0,400.0],[0.0,505.97,300.0],[0.0,0.0,1.0]]', dist_coeffs='[-0.35087995,0.16883034,0.0,0.0,-0.0514557]', FOV=1, freeScalingParameter=1.31, imageScalingFactor=1.31)) #1
46  camTypes.append(tvaMetaData.CamType(name='Vivotek 3', resX=1280, resY=1024, frameRate=25.00, camera_matrix='[[947.44,0.0,640.0],[0.0,961.80,513.0],[0.0,0.0,1.0]]', dist_coeffs='[-0.42643172,0.17989202,0.0,-0.02,-0.05034053]', FOV=1, freeScalingParameter=1.31, imageScalingFactor=1.31)) #2
47  camTypes.append(tvaMetaData.CamType(name='GoProHero2/3 1', resX=1280, resY=960, frameRate=29.97, camera_matrix='[[377.42,0.0,640.0],[0.0,378.43,490.0],[0.0,0.0,1.0]]', dist_coeffs='[-0.11759321,0.0148536,0.0,0.0,-0.00091816]', FOV=1, freeScalingParameter=1.31, imageScalingFactor=1.31)) #3
48  camTypes.append(tvaMetaData.CamType(name='GoProHero2/3 2', resX=1280, resY=720, frameRate=29.97, camera_matrix='[[469.96,0.0,640.0],[0.0,467.68,360.0],[0.0,0.0,1.0]]', dist_coeffs='[-0.18957,0.037319,0.0,0.0,-0.00337]', FOV=1, freeScalingParameter=0.5, imageScalingFactor=1.31)) #4
49  camTypes.append(tvaMetaData.CamType(name='Generic/Lund', resX=640, resY=480, frameRate=15.0, camera_matrix='', dist_coeffs='', FOV=1, freeScalingParameter=1.0, imageScalingFactor=1.0)) #5
50  camTypes.append(tvaMetaData.CamType(name='AxisPTZ/Lund', resX=704, resY=576, frameRate=22.19, camera_matrix='', dist_coeffs='', FOV=1, freeScalingParameter=1.0, imageScalingFactor=1.0)) #6
51  session.add_all(camTypes)
52 
53 
56  sites = session.query(tvaMetaData.Site).all()
57  session.add_all(sites)
58 
59 
62  cameras = session.query(tvaMetaData.CameraView).all()
63  session.add_all(cameras)
64 
65 
68  sequences = session.query(tvaMetaData.VideoSequence).all()
69  session.add_all(sequences)
70 
71 
75  site_analyses = session.query(tvaMetaData.SiteAnalysis).all()
76  session.add_all(site_analyses)
77 
78 
81  analyses = session.query(tvaMetaData.Analysis).all()
82  analyses.append(tvaMetaData.Analysis('all', ''))
83  session.add_all(analyses)
84 
85 
88  session.commit()
89 
90 
93 if __name__ == "__main__":
94  main()
def main()
main()
Definition: main.py:1