fix leading zeros issue

This commit is contained in:
David PAGNON 2022-06-10 13:03:51 +02:00 committed by GitHub
parent 2113aa5f4a
commit 7d645e907d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@
Please correct in the resulting .toml file if needed. Take your image size as a reference. Please correct in the resulting .toml file if needed. Take your image size as a reference.
Usage: Usage:
from Pose2Sim.Utilities import calib_yml_to_toml; calib_yml_to_toml.calib_yml_to_toml_func(r'<intrinsic_yml_file>', r'<extrinsic_yml_file>') import calib_yml_to_toml; calib_yml_to_toml.calib_yml_to_toml_func(r'<intrinsic_yml_file>', r'<extrinsic_yml_file>')
OR python -m calib_yml_to_toml -i <intrinsic_yml_file> -e <extrinsic_yml_file> OR python -m calib_yml_to_toml -i <intrinsic_yml_file> -e <extrinsic_yml_file>
OR python -m calib_yml_to_toml -i <intrinsic_yml_file> -e <extrinsic_yml_file> -o "<output_toml_file>" OR python -m calib_yml_to_toml -i <intrinsic_yml_file> -e <extrinsic_yml_file> -o "<output_toml_file>"
''' '''
@ -53,8 +53,9 @@ def read_intrinsic_yml(intrinsic_path):
N = intrinsic_yml.getNode('names').size() N = intrinsic_yml.getNode('names').size()
S, D, K = [], [], [] S, D, K = [], [], []
for i in range(N): for i in range(N):
K.append(intrinsic_yml.getNode(f'K_{i+1}').mat()) name = intrinsic_yml.getNode('names').at(i).string()
D.append(intrinsic_yml.getNode(f'dist_{i+1}').mat().flatten()[:-1]) K.append(intrinsic_yml.getNode(f'K_{name}').mat())
D.append(intrinsic_yml.getNode(f'dist_{name}').mat().flatten()[:-1])
S.append([K[i][0,2]*2, K[i][1,2]*2]) S.append([K[i][0,2]*2, K[i][1,2]*2])
return S, K, D return S, K, D
@ -70,8 +71,9 @@ def read_extrinsic_yml(extrinsic_path):
N = extrinsic_yml.getNode('names').size() N = extrinsic_yml.getNode('names').size()
R, T = [], [] R, T = [], []
for i in range(N): for i in range(N):
R.append(extrinsic_yml.getNode(f'R_{i+1}').mat().flatten()) # R_1 pour Rodrigues, Rot_1 pour matrice name = extrinsic_yml.getNode('names').at(i).string()
T.append(extrinsic_yml.getNode(f'T_{i+1}').mat().flatten()) R.append(extrinsic_yml.getNode(f'R_{name}').mat().flatten()) # R_1 pour Rodrigues, Rot_1 pour matrice
T.append(extrinsic_yml.getNode(f'T_{name}').mat().flatten())
return R, T return R, T