def _on_close(self): if self.is_started: print('Saving model to {}...'.format(config.path_npz)) self.model.voxel_grid.save(config.path_npz) print('Finished.') mesh_fname = '.'.join(config.path_npz.split('.')[:-1]) + '.ply' print('Extracting and saving mesh to {}...'.format(mesh_fname)) mesh = extract_trianglemesh(self.model.voxel_grid, config, mesh_fname) print('Finished.') log_fname = '.'.join(config.path_npz.split('.')[:-1]) + '.log' print('Saving trajectory to {}...'.format(log_fname)) save_poses(log_fname, self.poses) print('Finished.') return True
model.update_frame_pose(i, T_frame_to_model) model.integrate(input_frame, config.depth_scale, config.depth_max) model.synthesize_model_frame(raycast_frame, config.depth_scale, config.depth_min, config.depth_max, False) stop = time.time() print('{:04d}/{:04d} slam takes {:.4}s'.format(i, n_files, stop - start)) return model.voxel_grid, poses if __name__ == '__main__': parser = ConfigParser() parser.add( '--config', is_config_file=True, help='YAML config file path. Please refer to default_config.yml as a ' 'reference. It overrides the default config file, but will be ' 'overridden by other command line inputs.') config = parser.get_config() depth_file_names, color_file_names = load_image_file_names(config) intrinsic = load_intrinsic(config) volume, poses = slam(depth_file_names, color_file_names, intrinsic, config) save_poses('output.log', poses) save_poses('output.json', poses) mesh = extract_trianglemesh(volume, config, 'output.ply') o3d.visualization.draw([mesh])