Commit e250fe80 authored by Guillaume CLIVAZ's avatar Guillaume CLIVAZ
Browse files

[calibration] Calibration output in a JSON

parent a579145b
Pipeline #49905 failed with stage
in 4 minutes and 5 seconds
......@@ -362,6 +362,8 @@ def parse_arguments():
help="An absolute path to the JSON file containing the calibration configuration.")
parser.add_argument("-i", "--intrinsics-only", type=bool, default=False,
help="Compute intrinsics only.")
parser.add_argument("-o", "--output_file", type=str, default=None,
help="Output calibration JSON file.")
parser.add_argument("-v", "--verbosity", action="count", default=0,
help="Output verbosity: -v output calibration result, -vv output the dataframe, \
-vvv plots the target detection.")
......@@ -376,7 +378,6 @@ def main():
capture_dir_path = config['capture_directory']
data_config_path = config['stream_config']
frames = config['frames_list']
pattern_type = config['pattern_type']
square_size = config['square_size']
......@@ -487,5 +488,14 @@ def main():
poses[camera] = calibration[reference]["extrinsics_{}".format(camera)]
display_cameras_poses(poses, config['display'])
if args.output_file is not None:
data = {}
for camera in stream:
# As all value are ndarray, tolist() is used to serialized the values
data[camera] = {k:v.tolist() for k,v in calibration[camera].items() if "df_" not in k}
with open(args.output_file, 'w') as f:
json.dump(data, f, indent=4, sort_keys=True)
print("{} written.".format(args.output_file))
if __name__ == "__main__":
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment