Works on cropped videos.
This commit is contained in:
parent
41d377d9f9
commit
4fdec2eb10
@ -54,9 +54,11 @@ def read_qca(qca_path, binning_factor):
|
||||
C, S, D, K, R, T = [], [], [], [], [], []
|
||||
|
||||
# Camera name
|
||||
for tag in root.findall('cameras/camera'):
|
||||
for i, tag in enumerate(root.findall('cameras/camera')):
|
||||
ret += [float(tag.attrib.get('avg-residual'))/1000]
|
||||
C += [tag.attrib.get('serial')]
|
||||
if tag.attrib.get('model') in ('Miqus Video', 'Miqus Video UnderWater', 'none'):
|
||||
C += [tag.attrib.get('serial')]
|
||||
vid_id += [i]
|
||||
|
||||
# Image size
|
||||
for tag in root.findall('cameras/camera/fov_video'):
|
||||
@ -65,7 +67,7 @@ def read_qca(qca_path, binning_factor):
|
||||
S += [[w, h]]
|
||||
|
||||
# Intrinsic parameters: distorsion and intrinsic matrix
|
||||
for tag in root.findall('cameras/camera/intrinsic'):
|
||||
for i, tag in enumerate(root.findall('cameras/camera/intrinsic')):
|
||||
k1 = float(tag.get('radialDistortion1'))/64/binning_factor
|
||||
k2 = float(tag.get('radialDistortion2'))/64/binning_factor
|
||||
p1 = float(tag.get('tangentalDistortion1'))/64/binning_factor
|
||||
@ -74,15 +76,17 @@ def read_qca(qca_path, binning_factor):
|
||||
|
||||
fu = float(tag.get('focalLengthU'))/64/binning_factor
|
||||
fv = float(tag.get('focalLengthV'))/64/binning_factor
|
||||
cu = float(tag.get('centerPointU'))/64/binning_factor
|
||||
cv = float(tag.get('centerPointV'))/64/binning_factor
|
||||
cu = float(tag.get('centerPointU'))/64/binning_factor \
|
||||
- float(root.findall('cameras/camera/fov_video')[i].attrib.get('left'))
|
||||
cv = float(tag.get('centerPointV'))/64/binning_factor \
|
||||
- float(root.findall('cameras/camera/fov_video')[i].attrib.get('top'))
|
||||
K += [np.array([fu, 0., cu, 0., fv, cv, 0., 0., 1.]).reshape(3,3)]
|
||||
|
||||
# Extrinsic parameters: rotation matrix and translation vector
|
||||
for tag in root.findall('cameras/camera/transform'):
|
||||
tx = float(tag.get('x'))
|
||||
ty = float(tag.get('y'))
|
||||
tz = float(tag.get('z'))
|
||||
tx = float(tag.get('x'))/1000
|
||||
ty = float(tag.get('y'))/1000
|
||||
tz = float(tag.get('z'))/1000
|
||||
r11 = float(tag.get('r11'))
|
||||
r12 = float(tag.get('r12'))
|
||||
r13 = float(tag.get('r13'))
|
||||
@ -98,13 +102,16 @@ def read_qca(qca_path, binning_factor):
|
||||
T += [np.array([tx, ty, tz])]
|
||||
|
||||
# Cameras names by natural order
|
||||
C_index = [C.index(c) for c in natural_sort(C)]
|
||||
C = [C[c] for c in C_index]
|
||||
S = [S[c] for c in C_index]
|
||||
D = [D[c] for c in C_index]
|
||||
K = [K[c] for c in C_index]
|
||||
R = [R[c] for c in C_index]
|
||||
T = [T[c] for c in C_index]
|
||||
C_vid = [C[v] for v in vid_id]
|
||||
C_vid_id = [C_vid.index(c) for c in natural_sort(C_vid)]
|
||||
C_id = [vid_id[c] for c in C_vid_id]
|
||||
C = [C[c] for c in C_id]
|
||||
ret = [ret[c] for c in C_id]
|
||||
S = [S[c] for c in C_id]
|
||||
D = [D[c] for c in C_id]
|
||||
K = [K[c] for c in C_id]
|
||||
R = [R[c] for c in C_id]
|
||||
T = [T[c] for c in C_id]
|
||||
|
||||
return C, S, D, K, R, T
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user