| 1 |
import pycolmap |
| 2 |
|
| 3 |
|
| 4 |
def test_normalization_enum(): |
| 5 |
assert pycolmap.Normalization.L1_ROOT is not None |
| 6 |
assert pycolmap.Normalization.L2 is not None |
| 7 |
|
| 8 |
|
| 9 |
def test_sift_extraction_options_default_init(): |
| 10 |
options = pycolmap.SiftExtractionOptions() |
| 11 |
assert options is not None |
| 12 |
|
| 13 |
|
| 14 |
def test_sift_extraction_options_num_octaves_readwrite(): |
| 15 |
options = pycolmap.SiftExtractionOptions() |
| 16 |
original = options.num_octaves |
| 17 |
assert isinstance(original, int) |
| 18 |
options.num_octaves = 5 |
| 19 |
assert options.num_octaves == 5 |
| 20 |
|
| 21 |
|
| 22 |
def test_sift_extraction_options_max_num_features_readwrite(): |
| 23 |
options = pycolmap.SiftExtractionOptions() |
| 24 |
assert isinstance(options.max_num_features, int) |
| 25 |
options.max_num_features = 4096 |
| 26 |
assert options.max_num_features == 4096 |
| 27 |
|
| 28 |
|
| 29 |
def test_sift_extraction_options_peak_threshold_readwrite(): |
| 30 |
options = pycolmap.SiftExtractionOptions() |
| 31 |
assert isinstance(options.peak_threshold, float) |
| 32 |
options.peak_threshold = 0.01 |
| 33 |
assert abs(options.peak_threshold - 0.01) < 1e-6 |
| 34 |
|
| 35 |
|
| 36 |
def test_sift_extraction_options_check(): |
| 37 |
options = pycolmap.SiftExtractionOptions() |
| 38 |
result = options.check() |
| 39 |
assert isinstance(result, bool) |
| 40 |
assert result is True |
| 41 |
|
| 42 |
|
| 43 |
def test_feature_extraction_options_default_init(): |
| 44 |
options = pycolmap.FeatureExtractionOptions() |
| 45 |
assert options is not None |
| 46 |
|
| 47 |
|
| 48 |
def test_feature_extraction_options_type_readwrite(): |
| 49 |
options = pycolmap.FeatureExtractionOptions() |
| 50 |
options.type = pycolmap.FeatureExtractorType.SIFT |
| 51 |
assert options.type == pycolmap.FeatureExtractorType.SIFT |
| 52 |
|
| 53 |
|
| 54 |
def test_feature_extraction_options_max_image_size_readwrite(): |
| 55 |
options = pycolmap.FeatureExtractionOptions() |
| 56 |
options.max_image_size = 2048 |
| 57 |
assert options.max_image_size == 2048 |
| 58 |
|
| 59 |
|
| 60 |
def test_feature_extraction_options_num_threads_readwrite(): |
| 61 |
options = pycolmap.FeatureExtractionOptions() |
| 62 |
options.num_threads = 4 |
| 63 |
assert options.num_threads == 4 |
| 64 |
|
| 65 |
|
| 66 |
def test_feature_extraction_options_use_gpu_readwrite(): |
| 67 |
options = pycolmap.FeatureExtractionOptions() |
| 68 |
options.use_gpu = False |
| 69 |
assert options.use_gpu is False |
| 70 |
|
| 71 |
|
| 72 |
def test_feature_extraction_options_sift_property(): |
| 73 |
options = pycolmap.FeatureExtractionOptions() |
| 74 |
sift = options.sift |
| 75 |
assert isinstance(sift, pycolmap.SiftExtractionOptions) |
| 76 |
|
| 77 |
|
| 78 |
def test_feature_extraction_options_requires_rgb(): |
| 79 |
options = pycolmap.FeatureExtractionOptions() |
| 80 |
result = options.requires_rgb() |
| 81 |
assert isinstance(result, bool) |
| 82 |
|
| 83 |
|
| 84 |
def test_feature_extraction_options_requires_opengl(): |
| 85 |
options = pycolmap.FeatureExtractionOptions() |
| 86 |
result = options.requires_opengl() |
| 87 |
assert isinstance(result, bool) |
| 88 |
|
| 89 |
|
| 90 |
def test_feature_extraction_options_eff_max_image_size(): |
| 91 |
options = pycolmap.FeatureExtractionOptions() |
| 92 |
result = options.eff_max_image_size() |
| 93 |
assert isinstance(result, int) |
| 94 |
assert result > 0 |
| 95 |
|
| 96 |
|
| 97 |
def test_feature_extraction_options_check(): |
| 98 |
options = pycolmap.FeatureExtractionOptions() |
| 99 |
result = options.check() |
| 100 |
assert isinstance(result, bool) |
| 101 |
assert result is True |
| 102 |
|
| 103 |
|
| 104 |
def test_feature_extractor_create(): |
| 105 |
extractor = pycolmap.FeatureExtractor.create(device=pycolmap.Device.cpu) |
| 106 |
assert extractor is not None |
| 107 |
|
| 108 |
|
| 109 |
def test_sift_deprecated_class(): |
| 110 |
if hasattr(pycolmap, "Sift"): |
| 111 |
import warnings |
| 112 |
|
| 113 |
with warnings.catch_warnings(): |
| 114 |
warnings.simplefilter("ignore", DeprecationWarning) |
| 115 |
sift = pycolmap.Sift(device=pycolmap.Device.cpu) |
| 116 |
assert sift is not None |
| 117 |
assert sift.options is not None |
| 118 |
assert sift.device is not None |