mapillary-tools 0.13.1a1__tar.gz → 0.13.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {mapillary_tools-0.13.1a1/mapillary_tools.egg-info → mapillary_tools-0.13.2}/PKG-INFO +1 -1
  2. mapillary_tools-0.13.2/mapillary_tools/__init__.py +1 -0
  3. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_images_from_gpx_file.py +7 -1
  4. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extractors/camm_parser.py +8 -12
  5. mapillary_tools-0.13.2/mapillary_tools/video_data_extraction/extractors/gpx_parser.py +108 -0
  6. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2/mapillary_tools.egg-info}/PKG-INFO +1 -1
  7. mapillary_tools-0.13.1a1/mapillary_tools/__init__.py +0 -1
  8. mapillary_tools-0.13.1a1/mapillary_tools/video_data_extraction/extractors/gpx_parser.py +0 -71
  9. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/LICENSE +0 -0
  10. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/MANIFEST.in +0 -0
  11. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/README.md +0 -0
  12. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/api_v4.py +0 -0
  13. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/authenticate.py +0 -0
  14. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/camm/camm_builder.py +0 -0
  15. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/camm/camm_parser.py +0 -0
  16. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/__init__.py +0 -0
  17. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/__main__.py +0 -0
  18. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/authenticate.py +0 -0
  19. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/process.py +0 -0
  20. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/process_and_upload.py +0 -0
  21. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/sample_video.py +0 -0
  22. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/upload.py +0 -0
  23. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/video_process.py +0 -0
  24. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/video_process_and_upload.py +0 -0
  25. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/commands/zip.py +0 -0
  26. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/config.py +0 -0
  27. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/constants.py +0 -0
  28. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/exceptions.py +0 -0
  29. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/exif_read.py +0 -0
  30. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/exif_write.py +0 -0
  31. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/exiftool_read.py +0 -0
  32. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/exiftool_read_video.py +0 -0
  33. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/ffmpeg.py +0 -0
  34. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geo.py +0 -0
  35. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/__init__.py +0 -0
  36. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/blackvue_parser.py +0 -0
  37. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_from_generic.py +0 -0
  38. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_images_from_exif.py +0 -0
  39. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_images_from_exiftool.py +0 -0
  40. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_images_from_exiftool_both_image_and_video.py +0 -0
  41. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_images_from_gpx.py +0 -0
  42. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_images_from_nmea_file.py +0 -0
  43. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_images_from_video.py +0 -0
  44. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_videos_from_exiftool_video.py +0 -0
  45. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/geotag_videos_from_video.py +0 -0
  46. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/gpmf_gps_filter.py +0 -0
  47. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/gpmf_parser.py +0 -0
  48. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/gps_filter.py +0 -0
  49. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/geotag/utils.py +0 -0
  50. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/history.py +0 -0
  51. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/ipc.py +0 -0
  52. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/mp4/__init__.py +0 -0
  53. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/mp4/construct_mp4_parser.py +0 -0
  54. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/mp4/io_utils.py +0 -0
  55. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/mp4/mp4_sample_parser.py +0 -0
  56. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/mp4/simple_mp4_builder.py +0 -0
  57. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/mp4/simple_mp4_parser.py +0 -0
  58. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/process_geotag_properties.py +0 -0
  59. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/process_sequence_properties.py +0 -0
  60. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/sample_video.py +0 -0
  61. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/telemetry.py +0 -0
  62. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/types.py +0 -0
  63. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/upload.py +0 -0
  64. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/upload_api_v4.py +0 -0
  65. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/uploader.py +0 -0
  66. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/utils.py +0 -0
  67. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/cli_options.py +0 -0
  68. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extract_video_data.py +0 -0
  69. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extractors/base_parser.py +0 -0
  70. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extractors/blackvue_parser.py +0 -0
  71. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extractors/exiftool_runtime_parser.py +0 -0
  72. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extractors/exiftool_xml_parser.py +0 -0
  73. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extractors/generic_video_parser.py +0 -0
  74. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extractors/gopro_parser.py +0 -0
  75. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/extractors/nmea_parser.py +0 -0
  76. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools/video_data_extraction/video_data_parser_factory.py +0 -0
  77. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools.egg-info/SOURCES.txt +0 -0
  78. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools.egg-info/dependency_links.txt +0 -0
  79. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools.egg-info/entry_points.txt +0 -0
  80. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools.egg-info/requires.txt +0 -0
  81. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/mapillary_tools.egg-info/top_level.txt +0 -0
  82. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/requirements.txt +0 -0
  83. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/schema/image_description_schema.json +0 -0
  84. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/setup.cfg +0 -0
  85. {mapillary_tools-0.13.1a1 → mapillary_tools-0.13.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mapillary_tools
3
- Version: 0.13.1a1
3
+ Version: 0.13.2
4
4
  Summary: Mapillary Image/Video Import Pipeline
5
5
  Home-page: https://github.com/mapillary/mapillary_tools
6
6
  Author: Mapillary
@@ -0,0 +1 @@
1
+ VERSION = "0.13.2"
@@ -25,7 +25,13 @@ class GeotagImagesFromGPXFile(GeotagImagesFromGeneric):
25
25
  num_processes: T.Optional[int] = None,
26
26
  ):
27
27
  super().__init__()
28
- tracks = parse_gpx(source_path)
28
+ try:
29
+ tracks = parse_gpx(source_path)
30
+ except Exception as ex:
31
+ raise RuntimeError(
32
+ f"Error parsing GPX {source_path}: {ex.__class__.__name__}: {ex}"
33
+ )
34
+
29
35
  if 1 < len(tracks):
30
36
  LOG.warning(
31
37
  "Found %s tracks in the GPX file %s. Will merge points in all the tracks as a single track for interpolation",
@@ -13,8 +13,12 @@ class CammParser(BaseParser):
13
13
  parser_label = "camm"
14
14
 
15
15
  @functools.cached_property
16
- def __camera_info(self) -> T.Tuple[str, str]:
17
- with self.videoPath.open("rb") as fp:
16
+ def _camera_info(self) -> T.Tuple[str, str]:
17
+ source_path = self.geotag_source_path
18
+ if not source_path:
19
+ return "", ""
20
+
21
+ with source_path.open("rb") as fp:
18
22
  return camm_parser.extract_camera_make_and_model(fp)
19
23
 
20
24
  def extract_points(self) -> T.Sequence[geo.Point]:
@@ -28,15 +32,7 @@ class CammParser(BaseParser):
28
32
  return []
29
33
 
30
34
  def extract_make(self) -> T.Optional[str]:
31
- source_path = self.geotag_source_path
32
- if not source_path:
33
- return None
34
- with source_path.open("rb") as _fp:
35
- return self.__camera_info[0] or None
35
+ return self._camera_info[0] or None
36
36
 
37
37
  def extract_model(self) -> T.Optional[str]:
38
- source_path = self.geotag_source_path
39
- if not source_path:
40
- return None
41
- with source_path.open("rb") as _fp:
42
- return self.__camera_info[1] or None
38
+ return self._camera_info[1] or None
@@ -0,0 +1,108 @@
1
+ import datetime
2
+ import logging
3
+ import typing as T
4
+
5
+ from ... import geo, telemetry
6
+ from ...geotag import geotag_images_from_gpx_file
7
+ from .base_parser import BaseParser
8
+ from .generic_video_parser import GenericVideoParser
9
+
10
+
11
+ LOG = logging.getLogger(__name__)
12
+
13
+
14
+ class GpxParser(BaseParser):
15
+ default_source_pattern = "%g.gpx"
16
+ parser_label = "gpx"
17
+
18
+ def extract_points(self) -> T.Sequence[geo.Point]:
19
+ path = self.geotag_source_path
20
+ if not path:
21
+ return []
22
+
23
+ try:
24
+ gpx_tracks = geotag_images_from_gpx_file.parse_gpx(path)
25
+ except Exception as ex:
26
+ raise RuntimeError(
27
+ f"Error parsing GPX {path}: {ex.__class__.__name__}: {ex}"
28
+ )
29
+
30
+ if 1 < len(gpx_tracks):
31
+ LOG.warning(
32
+ "Found %s tracks in the GPX file %s. Will merge points in all the tracks as a single track for interpolation",
33
+ len(gpx_tracks),
34
+ self.videoPath,
35
+ )
36
+
37
+ gpx_points: T.Sequence[geo.Point] = sum(gpx_tracks, [])
38
+ if not gpx_points:
39
+ return gpx_points
40
+
41
+ offset = self._synx_gpx_by_first_gps_timestamp(gpx_points)
42
+
43
+ self._rebase_times(gpx_points, offset=offset)
44
+
45
+ return gpx_points
46
+
47
+ def _synx_gpx_by_first_gps_timestamp(
48
+ self, gpx_points: T.Sequence[geo.Point]
49
+ ) -> float:
50
+ offset: float = 0.0
51
+
52
+ if not gpx_points:
53
+ return offset
54
+
55
+ first_gpx_dt = datetime.datetime.fromtimestamp(
56
+ gpx_points[0].time, tz=datetime.timezone.utc
57
+ )
58
+ LOG.info("First GPX timestamp: %s", first_gpx_dt)
59
+
60
+ # Extract first GPS timestamp (if found) for synchronization
61
+ # Use an empty dictionary to force video parsers to extract make/model from the video metadata itself
62
+ parser = GenericVideoParser(self.videoPath, self.options, {})
63
+ gps_points = parser.extract_points()
64
+
65
+ if not gps_points:
66
+ LOG.warning(
67
+ "Skip GPX synchronization because no GPS found in video %s",
68
+ self.videoPath,
69
+ )
70
+ return offset
71
+
72
+ first_gps_point = gps_points[0]
73
+ if isinstance(first_gps_point, telemetry.GPSPoint):
74
+ if first_gps_point.epoch_time is not None:
75
+ first_gps_dt = datetime.datetime.fromtimestamp(
76
+ first_gps_point.epoch_time, tz=datetime.timezone.utc
77
+ )
78
+ LOG.info("First GPS timestamp: %s", first_gps_dt)
79
+ offset = gpx_points[0].time - first_gps_point.epoch_time
80
+ if offset:
81
+ LOG.warning(
82
+ "Found offset between GPX %s and video GPS timestamps %s: %s seconds",
83
+ first_gpx_dt,
84
+ first_gps_dt,
85
+ offset,
86
+ )
87
+ else:
88
+ LOG.info(
89
+ "GPX and GPS are perfectly synchronized (all starts from %s)",
90
+ first_gpx_dt,
91
+ )
92
+ else:
93
+ LOG.warning(
94
+ "Skip GPX synchronization because no GPS epoch time found in video %s",
95
+ self.videoPath,
96
+ )
97
+
98
+ return offset
99
+
100
+ def extract_make(self) -> T.Optional[str]:
101
+ # Use an empty dictionary to force video parsers to extract make/model from the video metadata itself
102
+ parser = GenericVideoParser(self.videoPath, self.options, {})
103
+ return parser.extract_make()
104
+
105
+ def extract_model(self) -> T.Optional[str]:
106
+ # Use an empty dictionary to force video parsers to extract make/model from the video metadata itself
107
+ parser = GenericVideoParser(self.videoPath, self.options, {})
108
+ return parser.extract_model()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mapillary_tools
3
- Version: 0.13.1a1
3
+ Version: 0.13.2
4
4
  Summary: Mapillary Image/Video Import Pipeline
5
5
  Home-page: https://github.com/mapillary/mapillary_tools
6
6
  Author: Mapillary
@@ -1 +0,0 @@
1
- VERSION = "0.13.1a1"
@@ -1,71 +0,0 @@
1
- import datetime
2
- import logging
3
- import typing as T
4
-
5
- from ... import geo, telemetry
6
- from ...geotag import geotag_images_from_gpx_file
7
- from .base_parser import BaseParser
8
- from .generic_video_parser import GenericVideoParser
9
-
10
-
11
- LOG = logging.getLogger(__name__)
12
-
13
-
14
- class GpxParser(BaseParser):
15
- default_source_pattern = "%g.gpx"
16
- parser_label = "gpx"
17
-
18
- def extract_points(self) -> T.Sequence[geo.Point]:
19
- path = self.geotag_source_path
20
- if not path:
21
- return []
22
-
23
- gpx_tracks = geotag_images_from_gpx_file.parse_gpx(path)
24
- if 1 < len(gpx_tracks):
25
- LOG.warning(
26
- "Found %s tracks in the GPX file %s. Will merge points in all the tracks as a single track for interpolation",
27
- len(gpx_tracks),
28
- self.videoPath,
29
- )
30
-
31
- gpx_points: T.Sequence[geo.Point] = sum(gpx_tracks, [])
32
- if not gpx_points:
33
- return gpx_points
34
-
35
- first_gpx_dt = datetime.datetime.fromtimestamp(
36
- gpx_points[0].time, tz=datetime.timezone.utc
37
- )
38
- LOG.info("First GPX timestamp: %s", first_gpx_dt)
39
-
40
- # Extract first GPS timestamp (if found) for synchronization
41
- offset: float = 0.0
42
- parser = GenericVideoParser(self.videoPath, self.options, self.parserOptions)
43
- gps_points = parser.extract_points()
44
- if gps_points:
45
- first_gps_point = gps_points[0]
46
- if isinstance(first_gps_point, telemetry.GPSPoint):
47
- if first_gps_point.epoch_time is not None:
48
- first_gps_dt = datetime.datetime.fromtimestamp(
49
- first_gps_point.epoch_time, tz=datetime.timezone.utc
50
- )
51
- LOG.info("First GPS timestamp: %s", first_gps_dt)
52
- offset = gpx_points[0].time - first_gps_point.epoch_time
53
- if offset:
54
- LOG.warning(
55
- "Found offset between GPX %s and video GPS timestamps %s: %s seconds",
56
- first_gpx_dt,
57
- first_gps_dt,
58
- offset,
59
- )
60
-
61
- self._rebase_times(gpx_points, offset=offset)
62
-
63
- return gpx_points
64
-
65
- def extract_make(self) -> T.Optional[str]:
66
- parser = GenericVideoParser(self.videoPath, self.options, self.parserOptions)
67
- return parser.extract_make()
68
-
69
- def extract_model(self) -> T.Optional[str]:
70
- parser = GenericVideoParser(self.videoPath, self.options, self.parserOptions)
71
- return parser.extract_model()