-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.py
65 lines (65 loc) · 2.4 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#'''
# Created on 2022 by Gonzalo Simarro, Daniel Calvete and Paola Souto
#'''
#
import os
import sys
#
sys.path.insert(0, 'ucalib')
import ucalib as ucalib
#
pathFolderMain = 'example'
assert os.path.exists(pathFolderMain)
#
#
#''' --------------------------------------------------------------------------
# Calibration of the basis
#''' --------------------------------------------------------------------------
#
pathFolderBasis = os.path.join(pathFolderMain, 'basis')
eCritical, calibrationModel = 5., 'parabolic' # eCritical expressed in pixels, calibrationModel in ['parabolic', 'quartic', 'full']
#givenVariablesDict = {}
givenVariablesDict = {'zc':142.5, 'k1a':-0.0025}
verbosePlot = True
#
print('Calibration of the basis')
ucalib.CalibrationOfBasisImages(pathFolderBasis, eCritical, calibrationModel, givenVariablesDict, verbosePlot)
print('Calibration of the basis forcing a unique camera position and intrinsic parameters')
ucalib.CalibrationOfBasisImagesConstantXYZAndIntrinsic(pathFolderBasis, calibrationModel, givenVariablesDict, verbosePlot)
#
#''' --------------------------------------------------------------------------
# (Auto)Calibration of the images
#''' --------------------------------------------------------------------------
#
#pathFolderBasis = os.path.join(pathFolderMain, 'basis')
pathFolderImages = os.path.join(pathFolderMain, 'images')
overwrite = False
verbosePlot = True
nORB, fC, KC = 10000, 5., 4
#
print('Autocalibration of the images')
ucalib.AutoCalibrationOfImages(pathFolderBasis, pathFolderImages, nORB, fC, KC, overwrite, verbosePlot)
#
#''' --------------------------------------------------------------------------
# Plot planviews
#''' --------------------------------------------------------------------------
#
#pathFolderImages = os.path.join(pathFolderMain, 'images')
pathFolderPlanviews = os.path.join(pathFolderMain, 'planviews')
z0, ppm = 3.2, 2.0
overwrite = False
verbosePlot = True
#
print('Generation of planviews')
ucalib.PlanviewsFromImages(pathFolderImages, pathFolderPlanviews, z0, ppm, overwrite, verbosePlot)
#
#''' --------------------------------------------------------------------------
# check basis images
#''' --------------------------------------------------------------------------
#
pathFolderBasisCheck = os.path.join(pathFolderMain, 'basis_check')
eCritical = 5. # eCritical expressed in pixels
#
print('Checking of the basis')
ucalib.CheckGCPs(pathFolderBasisCheck, eCritical)
#