|
10 | 10 | from kapture.algo.compare import equal_kapture |
11 | 11 | from kapture.io.csv import kapture_from_dir |
12 | 12 | from kapture.io.records import TransferAction |
13 | | -from tools.kapture_import_localized_images import import_localized_images |
| 13 | +from tools.kapture_import_image_list_with_poses import import_image_list_with_poses |
14 | 14 |
|
15 | 15 |
|
16 | 16 | class TestImageList(unittest.TestCase): |
17 | 17 |
|
18 | 18 | def setUp(self): |
19 | 19 | self._samples_folder = path.abspath(path.join(path.dirname(__file__), '../samples/cour_carree_markers/')) |
20 | | - self._localized_file = path.join(self._samples_folder, 'map/localized_images.txt') |
| 20 | + self._images_list_with_poses_file = path.join(self._samples_folder, 'map/images_with_poses.txt') |
21 | 21 | self._images_folder = path.join(self._samples_folder, 'map') |
22 | 22 | self._camera_model_path = path.join(path.join(self._samples_folder, 'map'), 's10.yml') |
23 | 23 | self._tempdir = tempfile.TemporaryDirectory() |
24 | 24 | self._kapture_path = path.join(self._tempdir.name, 'kapture_local') |
25 | 25 | os.makedirs(self._kapture_path, exist_ok=True) |
26 | 26 |
|
27 | 27 | def test_import_images_missing_file(self): |
28 | | - self.assertRaises(FileNotFoundError, import_localized_images, |
| 28 | + self.assertRaises(FileNotFoundError, import_image_list_with_poses, |
29 | 29 | '', self._images_folder, self._camera_model_path, |
30 | 30 | self._kapture_path, True, TransferAction.copy) |
31 | 31 |
|
32 | 32 | def test_import_images_missing_dir(self): |
33 | | - self.assertRaises(ValueError, import_localized_images, |
34 | | - self._localized_file, '', self._camera_model_path, |
| 33 | + self.assertRaises(ValueError, import_image_list_with_poses, |
| 34 | + self._images_list_with_poses_file, '', self._camera_model_path, |
35 | 35 | self._kapture_path, True, TransferAction.copy) |
36 | 36 |
|
37 | 37 | def test_import_with_images(self): |
38 | | - import_localized_images(self._localized_file, self._images_folder, self._camera_model_path, |
39 | | - self._kapture_path, True, TransferAction.copy) |
| 38 | + import_image_list_with_poses(self._images_list_with_poses_file, self._images_folder, self._camera_model_path, |
| 39 | + self._kapture_path, True, TransferAction.copy) |
40 | 40 |
|
41 | 41 | ref_kapture_path = path.join(self._samples_folder, 'kapture_images') |
42 | 42 | expected_kapture = kapture_from_dir(ref_kapture_path) |
43 | 43 | imported_kapture = kapture_from_dir(self._kapture_path) |
44 | 44 | self.assertTrue(equal_kapture(imported_kapture, expected_kapture)) |
45 | 45 |
|
46 | 46 | def test_import_images_no_camera(self): |
47 | | - import_localized_images(self._localized_file, self._images_folder, '', |
48 | | - self._kapture_path, True, TransferAction.copy) |
| 47 | + import_image_list_with_poses(self._images_list_with_poses_file, self._images_folder, '', |
| 48 | + self._kapture_path, True, TransferAction.copy) |
49 | 49 |
|
50 | 50 | ref_kapture_path = path.join(self._samples_folder, 'kapture_images_no_camera') |
51 | 51 | expected_kapture = kapture_from_dir(ref_kapture_path) |
52 | 52 | imported_kapture = kapture_from_dir(self._kapture_path) |
53 | 53 | self.assertTrue(equal_kapture(imported_kapture, expected_kapture)) |
54 | 54 |
|
55 | 55 | def test_import_no_images(self): |
56 | | - import_localized_images(self._localized_file, '', self._camera_model_path, |
57 | | - self._kapture_path, True, TransferAction.copy, True) |
| 56 | + import_image_list_with_poses(self._images_list_with_poses_file, '', self._camera_model_path, |
| 57 | + self._kapture_path, True, TransferAction.copy, True) |
58 | 58 |
|
59 | 59 | ref_kapture_path = path.join(self._samples_folder, 'kapture_no_images') |
60 | 60 | expected_kapture = kapture_from_dir(ref_kapture_path) |
61 | 61 | imported_kapture = kapture_from_dir(self._kapture_path) |
62 | 62 | self.assertTrue(equal_kapture(imported_kapture, expected_kapture)) |
63 | 63 |
|
64 | 64 | def test_import_no_images_nor_camera(self): |
65 | | - import_localized_images(self._localized_file, '', '', |
66 | | - self._kapture_path, True, TransferAction.copy, True) |
| 65 | + import_image_list_with_poses(self._images_list_with_poses_file, '', '', |
| 66 | + self._kapture_path, True, TransferAction.copy, True) |
67 | 67 |
|
68 | 68 | ref_kapture_path = path.join(self._samples_folder, 'kapture_no_images_nor_camera') |
69 | 69 | expected_kapture = kapture_from_dir(ref_kapture_path) |
|
0 commit comments