def run_dataset(data: DataSetBase, input, output) -> None: recs_base = data.load_reconstruction(input) if len(recs_base) == 0: return rec_base = recs_base[0] tracks_manager = data.load_tracks_manager() rec_base.add_correspondences_from_tracks_manager(tracks_manager) images = data.images() remaining_images = set(images) - set(rec_base.shots) gcp = data.load_ground_control_points() report = {} rec_report = {} report["extend_reconstruction"] = [rec_report] rec, rec_report["grow"] = reconstruction.grow_reconstruction( data, tracks_manager, rec_base, remaining_images, gcp, ) rec_report["num_remaining_images"] = len(remaining_images) report["not_reconstructed_images"] = list(remaining_images) data.save_reconstruction([rec], output) data.save_report(io.json_dumps(report), "reconstruction.json")
def run_dataset(data: DataSetBase, input: str, output: str) -> None: """Reconstruct the from a prior reconstruction.""" tracks_manager = data.load_tracks_manager() rec_prior = data.load_reconstruction(input) if len(rec_prior) > 0: report, rec = reconstruction.reconstruct_from_prior( data, tracks_manager, rec_prior[0]) data.save_reconstruction([rec], output) data.save_report(io.json_dumps(report), "reconstruction.json")
def run_dataset(data: DataSetBase) -> None: """Add delaunay meshes to the reconstruction.""" tracks_manager = data.load_tracks_manager() reconstructions = data.load_reconstruction() all_shot_ids = set(tracks_manager.get_shot_ids()) for r in reconstructions: for shot in r.shots.values(): if shot.id in all_shot_ids: vertices, faces = mesh.triangle_mesh(shot.id, r, tracks_manager) shot.mesh.vertices = vertices shot.mesh.faces = faces data.save_reconstruction(reconstructions, filename="reconstruction.meshed.json", minify=True)
def run_dataset(dataset: DataSetBase, input, output) -> None: """Bundle a reconstructions. Args: input: input reconstruction JSON in the dataset output: input reconstruction JSON in the dataset """ reconstructions = dataset.load_reconstruction(input) camera_priors = dataset.load_camera_models() rig_cameras_priors = dataset.load_rig_cameras() tracks_manager = dataset.load_tracks_manager() # load the tracks manager and add its observations to the reconstruction # go through all the points and add their shots for reconstruction in reconstructions: reconstruction.add_correspondences_from_tracks_manager(tracks_manager) gcp = dataset.load_ground_control_points() orec.bundle(reconstruction, camera_priors, rig_cameras_priors, gcp, dataset.config) dataset.save_reconstruction(reconstructions, output)