| 36 | return define_args(sub) |
| 37 | |
| 38 | def parse_input_dir(input_dir): |
| 39 | cameras = None |
| 40 | calibrationJson = f"{input_dir}/calibration.json" |
| 41 | if os.path.exists(calibrationJson): |
| 42 | with open(calibrationJson) as f: |
| 43 | calibration = json.load(f) |
| 44 | if "cameras" in calibration: |
| 45 | cameras = calibration["cameras"] |
| 46 | device = None |
| 47 | metadataJson = f"{input_dir}/metadata.json" |
| 48 | if os.path.exists(metadataJson): |
| 49 | with open(metadataJson) as f: |
| 50 | metadata = json.load(f) |
| 51 | if metadata.get("platform") == "ios": |
| 52 | device = "ios-tof" |
| 53 | if device == None: |
| 54 | vioConfigYaml = f"{input_dir}/vio_config.yaml" |
| 55 | if os.path.exists(vioConfigYaml): |
| 56 | with open(vioConfigYaml) as file: |
| 57 | supported = ['oak-d', 'k4a', 'realsense', 'orbbec-astra2', 'orbbec-femto', 'android', 'android-tof'] |
| 58 | for line in file: |
| 59 | if "parameterSets" in line: |
| 60 | for d in supported: |
| 61 | if d in line: |
| 62 | device = d |
| 63 | break |
| 64 | if device: break |
| 65 | return (device, cameras) |
| 66 | |
| 67 | def auto_config(device_preset, |
| 68 | key_frame_distance=0.1, |