Exemple #1
0
    def test_export(self):
        temp_kapture_dirpath = path.join(self._tempdir.name, 'kapture')
        shutil.copytree(self._kapture_dirpath, temp_kapture_dirpath)
        kapture_data = kapture.io.csv.kapture_from_dir(temp_kapture_dirpath)
        images_filepaths = images_to_filepaths(kapture_data.records_camera,
                                               temp_kapture_dirpath)
        # make sure there is no EXIF in images
        for image_filepath in images_filepaths.values():
            clear_exif(image_filepath)

        # insert gps to exif
        export_gps_to_exif(kapture_data=kapture_data,
                           kapture_dirpath=temp_kapture_dirpath)

        rebuilt_records = kapture.RecordsGnss()
        for timestamp, cam_id, image_name in kapture.flatten(
                kapture_data.records_camera):
            image_filepath = get_image_fullpath(temp_kapture_dirpath,
                                                image_name)
            exif_data = read_exif(image_filepath)
            rebuilt_records[timestamp, 'GPS_' +
                            cam_id] = convert_gps_to_kapture_record(exif_data)

        self.assertTrue(
            equal_records_gnss(kapture_data.records_gnss, rebuilt_records))
Exemple #2
0
 def test_import_opensfm(self) -> None:
     """
     Test the import_opensfm function on small sample
     """
     # convert and then load
     file_operation = TransferAction.skip if self.isWindows else TransferAction.link_relative
     import_opensfm(
         self._opensfm_sample_path,
         self._kapture_rebuilt_path,
         force_overwrite_existing=False,
         images_import_method=file_operation
     )
     kapture_data_expected = csv.kapture_from_dir(self._kapture_sample_path)
     kapture_data_actual = csv.kapture_from_dir(self._kapture_rebuilt_path)
     # check in detail what could be wrong
     self.assertTrue(equal_sensors(kapture_data_expected.sensors, kapture_data_actual.sensors))
     self.assertTrue(equal_records_gnss(kapture_data_expected.records_gnss, kapture_data_actual.records_gnss))
     # check all at once
     self.assertTrue(equal_kapture(kapture_data_expected, kapture_data_actual))
Exemple #3
0
 def test_compare_gnss_addition(self):
     # then modify one and check its not equal anymore
     self.gnss_b[0, 'gps3'] = self.gnss_b[0, 'gps1']
     self.assertFalse(equal_records_gnss(self.gnss_a, self.gnss_b))
Exemple #4
0
 def test_compare_gnss_ablation(self):
     # then modify one and check its not equal anymore
     self.gnss_b[0].pop('gps1')
     self.assertFalse(equal_records_gnss(self.gnss_a, self.gnss_b))
Exemple #5
0
 def test_compare_gnss_equal(self):
     # check they are effectively equals
     self.assertTrue(equal_records_gnss(self.gnss_a, self.gnss_b))