Esempio n. 1
0
def test_run_all(tmpdir):
    data = data_generation.create_berlin_test_folder(tmpdir)
    run_all_commands = [
        commands.extract_metadata,
        commands.detect_features,
        commands.match_features,
        commands.create_tracks,
        commands.reconstruct,
        commands.bundle,
        commands.mesh,
        commands.undistort,
        commands.compute_depthmaps,
        commands.export_ply,
        commands.export_visualsfm,
        commands.export_openmvs,
        commands.export_pmvs,
        commands.export_bundler,
        commands.export_colmap,
    ]

    for module in run_all_commands:
        command = module.Command()
        run_command(command, [data.data_path])

    reconstruction = data.load_reconstruction()
    assert len(reconstruction[0].shots) == 3
    assert len(reconstruction[0].points) > 1000
Esempio n. 2
0
def test_dataset_load_features_sift(tmpdir):
    data = data_generation.create_berlin_test_folder(tmpdir)

    assert len(data.images()) == 3

    data.config["feature_type"] = "SIFT"

    image = data.images()[0]
    points = np.random.random((3, 4))
    descriptors = np.random.random((128, 4))
    colors = np.random.random((3, 4))
    segmentations = np.random.random((3, 4))
    instances = np.random.random((3, 4))

    semantic_data = features.SemanticData(
        segmentations, instances, data.segmentation_labels()
    )
    before = features.FeaturesData(points, descriptors, colors, semantic_data)
    data.save_features(image, before)
    after = data.load_features(image)

    assert np.allclose(points, after.points)
    assert np.allclose(descriptors, after.descriptors)
    assert np.allclose(colors, after.colors)
    assert np.allclose(
        segmentations,
        after.semantic.segmentation,
    )
    assert np.allclose(instances, after.semantic.instances)
Esempio n. 3
0
def test_dataset_load_features_sift(tmpdir):
    data = data_generation.create_berlin_test_folder(tmpdir)

    assert len(data.images()) == 3

    data.config['feature_type'] = 'SIFT'

    image = data.images()[0]
    points = np.random.random((3, 4))
    descriptors = np.random.random((128, 4))
    colors = np.random.random((3, 4))
    data.save_features(image, points, descriptors, colors)

    p, d, c = data.load_features(image)

    assert np.allclose(p, points)
    assert np.allclose(d, descriptors)
    assert np.allclose(c, colors)
Esempio n. 4
0
def test_run_all(tmpdir):
    data = data_generation.create_berlin_test_folder(tmpdir)
    run_all_commands = [
        commands.extract_metadata,
        commands.detect_features,
        commands.match_features,
        commands.create_tracks,
        commands.reconstruct,
        commands.bundle,
        commands.reconstruct_from_prior,
        commands.mesh,
        commands.undistort,
        commands.compute_depthmaps,
        commands.export_ply,
        commands.export_visualsfm,
        commands.export_openmvs,
        commands.export_pmvs,
        commands.export_bundler,
        commands.export_colmap,
        commands.compute_statistics,
        commands.export_report,
    ]

    output_rec_path = join(data.data_path, "rec_prior.json")
    command_options = {
        commands.reconstruct_from_prior: [
            "--input",
            join(data.data_path, "reconstruction.json"),
            "--output",
            output_rec_path,
        ]
    }

    for module in run_all_commands:
        command = module.Command()
        options = command_options.get(module, [])
        run_command(command, [data.data_path] + options)

    check_reconstruction(data)
    check_prior(data, output_rec_path)
Esempio n. 5
0
def test_dataset_load_features_sift(tmpdir):
    data = data_generation.create_berlin_test_folder(tmpdir)

    assert len(data.images()) == 3

    data.config["feature_type"] = "SIFT"

    image = data.images()[0]
    points = np.random.random((3, 4))
    descriptors = np.random.random((128, 4))
    colors = np.random.random((3, 4))
    segmentations = np.random.random((3, 4))
    instances = np.random.random((3, 4))
    data.save_features(image, points, descriptors, colors, segmentations,
                       instances)

    p, d, c, s = data.load_features(image)

    assert np.allclose(p, points)
    assert np.allclose(d, descriptors)
    assert np.allclose(c, colors)
    assert np.allclose(s["segmentations"], segmentations)
    assert np.allclose(s["instances"], instances)