| 1 |
import pycolmap |
| 2 |
|
| 3 |
|
| 4 |
def test_synthetic_dataset_match_config_enum(): |
| 5 |
assert { |
| 6 |
k: int(v) |
| 7 |
for k, v in pycolmap.SyntheticDatasetMatchConfig.__members__.items() |
| 8 |
} == { |
| 9 |
"EXHAUSTIVE": 1, |
| 10 |
"CHAINED": 2, |
| 11 |
"SPARSE": 3, |
| 12 |
} |
| 13 |
|
| 14 |
|
| 15 |
def test_synthetic_dataset_options_default_init(): |
| 16 |
options = pycolmap.SyntheticDatasetOptions() |
| 17 |
assert options is not None |
| 18 |
|
| 19 |
|
| 20 |
def test_synthetic_dataset_options_num_rigs_readwrite(): |
| 21 |
options = pycolmap.SyntheticDatasetOptions() |
| 22 |
options.num_rigs = 2 |
| 23 |
assert options.num_rigs == 2 |
| 24 |
|
| 25 |
|
| 26 |
def test_synthetic_dataset_options_num_cameras_per_rig_readwrite(): |
| 27 |
options = pycolmap.SyntheticDatasetOptions() |
| 28 |
options.num_cameras_per_rig = 3 |
| 29 |
assert options.num_cameras_per_rig == 3 |
| 30 |
|
| 31 |
|
| 32 |
def test_synthetic_dataset_options_num_frames_per_rig_readwrite(): |
| 33 |
options = pycolmap.SyntheticDatasetOptions() |
| 34 |
options.num_frames_per_rig = 5 |
| 35 |
assert options.num_frames_per_rig == 5 |
| 36 |
|
| 37 |
|
| 38 |
def test_synthetic_dataset_options_num_points3d_readwrite(): |
| 39 |
options = pycolmap.SyntheticDatasetOptions() |
| 40 |
options.num_points3D = 100 |
| 41 |
assert options.num_points3D == 100 |
| 42 |
|
| 43 |
|
| 44 |
def test_synthetic_dataset_options_track_length_readwrite(): |
| 45 |
options = pycolmap.SyntheticDatasetOptions() |
| 46 |
options.track_length = 3 |
| 47 |
assert options.track_length == 3 |
| 48 |
|
| 49 |
|
| 50 |
def test_synthetic_dataset_options_camera_model_id_readwrite(): |
| 51 |
options = pycolmap.SyntheticDatasetOptions() |
| 52 |
options.camera_model_id = pycolmap.CameraModelId.PINHOLE |
| 53 |
assert options.camera_model_id == pycolmap.CameraModelId.PINHOLE |
| 54 |
|
| 55 |
|
| 56 |
def test_synthetic_dataset_options_match_config_readwrite(): |
| 57 |
options = pycolmap.SyntheticDatasetOptions() |
| 58 |
options.match_config = pycolmap.SyntheticDatasetMatchConfig.CHAINED |
| 59 |
assert options.match_config == pycolmap.SyntheticDatasetMatchConfig.CHAINED |
| 60 |
|
| 61 |
|
| 62 |
def test_synthesize_dataset(): |
| 63 |
options = pycolmap.SyntheticDatasetOptions() |
| 64 |
options.num_cameras_per_rig = 1 |
| 65 |
options.num_frames_per_rig = 2 |
| 66 |
options.num_points3D = 10 |
| 67 |
reconstruction = pycolmap.synthesize_dataset(options) |
| 68 |
assert reconstruction.num_cameras() > 0 |
| 69 |
assert reconstruction.num_images() > 0 |
| 70 |
assert reconstruction.num_points3D() > 0 |
| 71 |
|
| 72 |
|
| 73 |
def test_synthetic_noise_options_default_init(): |
| 74 |
options = pycolmap.SyntheticNoiseOptions() |
| 75 |
assert options is not None |
| 76 |
|
| 77 |
|
| 78 |
def test_synthetic_noise_options_point2d_stddev_readwrite(): |
| 79 |
options = pycolmap.SyntheticNoiseOptions() |
| 80 |
options.point2D_stddev = 0.5 |
| 81 |
assert options.point2D_stddev == 0.5 |
| 82 |
|
| 83 |
|
| 84 |
def test_synthetic_noise_options_point3d_stddev_readwrite(): |
| 85 |
options = pycolmap.SyntheticNoiseOptions() |
| 86 |
options.point3D_stddev = 0.1 |
| 87 |
assert options.point3D_stddev == 0.1 |
| 88 |
|
| 89 |
|
| 90 |
def test_synthesize_noise(): |
| 91 |
dataset_options = pycolmap.SyntheticDatasetOptions() |
| 92 |
dataset_options.num_cameras_per_rig = 1 |
| 93 |
dataset_options.num_frames_per_rig = 2 |
| 94 |
dataset_options.num_points3D = 10 |
| 95 |
reconstruction = pycolmap.synthesize_dataset(dataset_options) |
| 96 |
noise_options = pycolmap.SyntheticNoiseOptions() |
| 97 |
noise_options.point2D_stddev = 1.0 |
| 98 |
noise_options.point3D_stddev = 0.01 |
| 99 |
pycolmap.synthesize_noise(noise_options, reconstruction) |
| 100 |
assert reconstruction.num_points3D() > 0 |
| 101 |
|
| 102 |
|
| 103 |
def test_synthetic_image_options_default_init(): |
| 104 |
options = pycolmap.SyntheticImageOptions() |
| 105 |
assert options is not None |
| 106 |
|
| 107 |
|
| 108 |
def test_synthetic_image_options_feature_peak_radius_readwrite(): |
| 109 |
options = pycolmap.SyntheticImageOptions() |
| 110 |
options.feature_peak_radius = 5 |
| 111 |
assert options.feature_peak_radius == 5 |