def test_bundle_projection_fixed_internals(scene_synthetic): reference = scene_synthetic[0].get_reconstruction() camera_priors = {c.id: c for c in scene_synthetic[0].cameras} graph = tracking.as_graph(scene_synthetic[5]) # Create the connnections in the reference for point_id in reference.points.keys(): if point_id in graph: for shot_id, g_obs in graph[point_id].items(): color = g_obs["feature_color"] pt = g_obs["feature"] obs = pysfm.Observation( pt[0], pt[1], g_obs["feature_scale"], g_obs["feature_id"], color[0], color[1], color[2], ) reference.map.add_observation(shot_id, point_id, obs) orig_camera = copy.deepcopy(reference.cameras["1"]) custom_config = config.default_config() custom_config["bundle_use_gps"] = False custom_config["optimize_camera_parameters"] = False reconstruction.bundle(reference, camera_priors, [], custom_config) assert _projection_errors_std(reference.points) < 5e-3 assert reference.cameras["1"].focal == orig_camera.focal assert reference.cameras["1"].k1 == orig_camera.k1 assert reference.cameras["1"].k2 == orig_camera.k2
def test_bundle_projection_fixed_internals(scene_synthetic): reference = scene_synthetic[0].get_reconstruction() camera_priors = {c.id: c for c in scene_synthetic[0].cameras} graph = tracking.as_graph(scene_synthetic[5]) adjusted = copy.deepcopy(reference) custom_config = config.default_config() custom_config['bundle_use_gps'] = False custom_config['optimize_camera_parameters'] = False reconstruction.bundle(graph, adjusted, camera_priors, {}, custom_config) assert _projection_errors_std(adjusted.points) < 5e-3 assert reference.cameras['1'].focal == adjusted.cameras['1'].focal assert reference.cameras['1'].k1 == adjusted.cameras['1'].k1 assert reference.cameras['1'].k2 == adjusted.cameras['1'].k2
def run(self, args): start = time.time() data = dataset.DataSet(args.dataset) tracks_manager = data.load_tracks_manager() graph = tracking.as_graph(tracks_manager) reconstructions = data.load_reconstruction(args.input) camera_priors = data.load_camera_models() gcp = data.load_ground_control_points() for reconstruction in reconstructions: orec.bundle(graph, reconstruction, camera_priors, gcp, data.config) end = time.time() with open(data.profile_log(), 'a') as fout: fout.write('bundle: {0}\n'.format(end - start)) data.save_reconstruction(reconstructions, args.output)