Example #1
0
 def test_sensor_file_version(self):
     cam0 = kapture.Camera(name='cam0', camera_type='SIMPLE_PINHOLE', camera_params=[640, 480, 100, 320, 240])
     sensors = kapture.Sensors()
     sensors['cam0'] = cam0
     csv.sensors_to_file(self._temp_filepath, sensors)
     version = csv.get_version_from_csv_file(self._temp_filepath)
     current_version = csv.current_format_version()
     self.assertEqual(current_version, version, "Version correctly stored")
Example #2
0
    def test_records_gnss_read_write_read(self):
        sensors = csv.sensors_from_file(self._sensors_filepath)
        records_gnss = csv.records_gnss_from_file(self._gnss_filepath)

        second_sensors_filepath = self._sensors_filepath + '.cpy'
        second_gnss_filepath = self._gnss_filepath + '.cpy'
        csv.sensors_to_file(second_sensors_filepath, sensors)
        csv.records_gnss_to_file(second_gnss_filepath, records_gnss)
        second_sensors = csv.sensors_from_file(second_sensors_filepath)
        second_records_gnss = csv.records_gnss_from_file(second_gnss_filepath)
        self.assertEqual(len(sensors), len(second_sensors))
        # self.assertEqual(sensors['gps1'], second_sensors['gps1'])
        self.assertEqual(len(records_gnss), len(second_records_gnss))
Example #3
0
    def test_sensors_write(self):
        cam0 = kapture.Camera(name='cam0', camera_type='SIMPLE_PINHOLE', camera_params=[640, 480, 100, 320, 240])
        cam1 = kapture.Camera(name='cam1', camera_type='SIMPLE_PINHOLE', camera_params=[640, 480, 100, 320, 240])
        formatted_expected = '\n'.join([csv.KAPTURE_FORMAT_1,
                                        '# sensor_id, name, sensor_type, [sensor_params]+',
                                        'cam0, cam0, camera, SIMPLE_PINHOLE, 640, 480, 100, 320, 240',
                                        'cam1, cam1, camera, SIMPLE_PINHOLE, 640, 480, 100, 320, 240',
                                        ''])
        sensors = kapture.Sensors()
        sensors['cam0'] = cam0
        sensors['cam1'] = cam1
        csv.sensors_to_file(self._temp_filepath, sensors)
        with open(self._temp_filepath, 'rt') as f:
            formatted_actual = ''.join(f.readlines())

        self.assertEqual(formatted_actual, formatted_expected)