mapillary-tools 0.12.1__py3-none-any.whl → 0.13.1a1__py3-none-any.whl
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.
- mapillary_tools/__init__.py +1 -1
- mapillary_tools/api_v4.py +94 -4
- mapillary_tools/{geotag → camm}/camm_builder.py +122 -62
- mapillary_tools/{geotag → camm}/camm_parser.py +120 -84
- mapillary_tools/commands/__init__.py +0 -1
- mapillary_tools/commands/__main__.py +0 -6
- mapillary_tools/commands/process.py +0 -50
- mapillary_tools/commands/upload.py +1 -26
- mapillary_tools/constants.py +2 -2
- mapillary_tools/exiftool_read_video.py +13 -11
- mapillary_tools/ffmpeg.py +2 -2
- mapillary_tools/geo.py +0 -54
- mapillary_tools/geotag/blackvue_parser.py +4 -4
- mapillary_tools/geotag/geotag_images_from_exif.py +2 -1
- mapillary_tools/geotag/geotag_images_from_exiftool_both_image_and_video.py +0 -1
- mapillary_tools/geotag/geotag_videos_from_exiftool_video.py +5 -3
- mapillary_tools/geotag/geotag_videos_from_video.py +13 -14
- mapillary_tools/geotag/gpmf_gps_filter.py +9 -10
- mapillary_tools/geotag/gpmf_parser.py +346 -83
- mapillary_tools/mp4/__init__.py +0 -0
- mapillary_tools/{geotag → mp4}/construct_mp4_parser.py +32 -16
- mapillary_tools/mp4/mp4_sample_parser.py +322 -0
- mapillary_tools/{geotag → mp4}/simple_mp4_builder.py +64 -38
- mapillary_tools/process_geotag_properties.py +25 -19
- mapillary_tools/process_sequence_properties.py +6 -6
- mapillary_tools/sample_video.py +17 -16
- mapillary_tools/telemetry.py +59 -0
- mapillary_tools/types.py +18 -0
- mapillary_tools/upload.py +75 -233
- mapillary_tools/upload_api_v4.py +8 -9
- mapillary_tools/utils.py +9 -16
- mapillary_tools/video_data_extraction/cli_options.py +0 -1
- mapillary_tools/video_data_extraction/extract_video_data.py +13 -31
- mapillary_tools/video_data_extraction/extractors/base_parser.py +13 -11
- mapillary_tools/video_data_extraction/extractors/blackvue_parser.py +5 -4
- mapillary_tools/video_data_extraction/extractors/camm_parser.py +7 -6
- mapillary_tools/video_data_extraction/extractors/exiftool_runtime_parser.py +4 -9
- mapillary_tools/video_data_extraction/extractors/exiftool_xml_parser.py +9 -11
- mapillary_tools/video_data_extraction/extractors/generic_video_parser.py +6 -11
- mapillary_tools/video_data_extraction/extractors/gopro_parser.py +11 -4
- mapillary_tools/video_data_extraction/extractors/gpx_parser.py +54 -12
- mapillary_tools/video_data_extraction/extractors/nmea_parser.py +3 -3
- mapillary_tools/video_data_extraction/video_data_parser_factory.py +13 -20
- {mapillary_tools-0.12.1.dist-info → mapillary_tools-0.13.1a1.dist-info}/METADATA +10 -3
- mapillary_tools-0.13.1a1.dist-info/RECORD +75 -0
- {mapillary_tools-0.12.1.dist-info → mapillary_tools-0.13.1a1.dist-info}/WHEEL +1 -1
- mapillary_tools/commands/upload_blackvue.py +0 -33
- mapillary_tools/commands/upload_camm.py +0 -33
- mapillary_tools/commands/upload_zip.py +0 -33
- mapillary_tools/geotag/mp4_sample_parser.py +0 -426
- mapillary_tools/process_import_meta_properties.py +0 -76
- mapillary_tools-0.12.1.dist-info/RECORD +0 -77
- /mapillary_tools/{geotag → mp4}/io_utils.py +0 -0
- /mapillary_tools/{geotag → mp4}/simple_mp4_parser.py +0 -0
- {mapillary_tools-0.12.1.dist-info → mapillary_tools-0.13.1a1.dist-info}/LICENSE +0 -0
- {mapillary_tools-0.12.1.dist-info → mapillary_tools-0.13.1a1.dist-info}/entry_points.txt +0 -0
- {mapillary_tools-0.12.1.dist-info → mapillary_tools-0.13.1a1.dist-info}/top_level.txt +0 -0
|
@@ -6,8 +6,9 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
from tqdm import tqdm
|
|
8
8
|
|
|
9
|
-
from .. import exceptions, exiftool_read, geo, types
|
|
9
|
+
from .. import exceptions, exiftool_read, geo, types, utils
|
|
10
10
|
from ..exiftool_read_video import ExifToolReadVideo
|
|
11
|
+
from ..telemetry import GPSPoint
|
|
11
12
|
from . import gpmf_gps_filter, utils as video_utils
|
|
12
13
|
from .geotag_from_generic import GeotagVideosFromGeneric
|
|
13
14
|
|
|
@@ -45,11 +46,11 @@ class GeotagVideosFromExifToolVideo(GeotagVideosFromGeneric):
|
|
|
45
46
|
points = geo.extend_deduplicate_points(points)
|
|
46
47
|
assert points, "must have at least one point"
|
|
47
48
|
|
|
48
|
-
if all(isinstance(p,
|
|
49
|
+
if all(isinstance(p, GPSPoint) for p in points):
|
|
49
50
|
points = T.cast(
|
|
50
51
|
T.List[geo.Point],
|
|
51
52
|
gpmf_gps_filter.remove_noisy_points(
|
|
52
|
-
T.cast(T.List[
|
|
53
|
+
T.cast(T.List[GPSPoint], points)
|
|
53
54
|
),
|
|
54
55
|
)
|
|
55
56
|
if not points:
|
|
@@ -65,6 +66,7 @@ class GeotagVideosFromExifToolVideo(GeotagVideosFromGeneric):
|
|
|
65
66
|
video_metadata = types.VideoMetadata(
|
|
66
67
|
video_path,
|
|
67
68
|
md5sum=None,
|
|
69
|
+
filesize=utils.get_file_size(video_path),
|
|
68
70
|
filetype=types.FileType.VIDEO,
|
|
69
71
|
points=points,
|
|
70
72
|
make=exif.extract_make(),
|
|
@@ -6,15 +6,11 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
from tqdm import tqdm
|
|
8
8
|
|
|
9
|
-
from .. import exceptions, geo, types
|
|
10
|
-
from
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
gpmf_parser,
|
|
15
|
-
simple_mp4_parser as parser,
|
|
16
|
-
utils as video_utils,
|
|
17
|
-
)
|
|
9
|
+
from .. import exceptions, geo, types, utils
|
|
10
|
+
from ..camm import camm_parser
|
|
11
|
+
from ..mp4 import simple_mp4_parser as sparser
|
|
12
|
+
from ..telemetry import GPSPoint
|
|
13
|
+
from . import blackvue_parser, gpmf_gps_filter, gpmf_parser, utils as video_utils
|
|
18
14
|
from .geotag_from_generic import GeotagVideosFromGeneric
|
|
19
15
|
|
|
20
16
|
LOG = logging.getLogger(__name__)
|
|
@@ -77,7 +73,7 @@ class GeotagVideosFromVideo(GeotagVideosFromGeneric):
|
|
|
77
73
|
with video_path.open("rb") as fp:
|
|
78
74
|
try:
|
|
79
75
|
points = camm_parser.extract_points(fp)
|
|
80
|
-
except
|
|
76
|
+
except sparser.ParsingError:
|
|
81
77
|
points = None
|
|
82
78
|
|
|
83
79
|
if points is not None:
|
|
@@ -86,6 +82,7 @@ class GeotagVideosFromVideo(GeotagVideosFromGeneric):
|
|
|
86
82
|
return types.VideoMetadata(
|
|
87
83
|
filename=video_path,
|
|
88
84
|
md5sum=None,
|
|
85
|
+
filesize=utils.get_file_size(video_path),
|
|
89
86
|
filetype=types.FileType.CAMM,
|
|
90
87
|
points=points,
|
|
91
88
|
make=make,
|
|
@@ -100,7 +97,7 @@ class GeotagVideosFromVideo(GeotagVideosFromGeneric):
|
|
|
100
97
|
with video_path.open("rb") as fp:
|
|
101
98
|
try:
|
|
102
99
|
points_with_fix = gpmf_parser.extract_points(fp)
|
|
103
|
-
except
|
|
100
|
+
except sparser.ParsingError:
|
|
104
101
|
points_with_fix = None
|
|
105
102
|
|
|
106
103
|
if points_with_fix is not None:
|
|
@@ -109,6 +106,7 @@ class GeotagVideosFromVideo(GeotagVideosFromGeneric):
|
|
|
109
106
|
return types.VideoMetadata(
|
|
110
107
|
filename=video_path,
|
|
111
108
|
md5sum=None,
|
|
109
|
+
filesize=utils.get_file_size(video_path),
|
|
112
110
|
filetype=types.FileType.GOPRO,
|
|
113
111
|
points=T.cast(T.List[geo.Point], points_with_fix),
|
|
114
112
|
make=make,
|
|
@@ -123,7 +121,7 @@ class GeotagVideosFromVideo(GeotagVideosFromGeneric):
|
|
|
123
121
|
with video_path.open("rb") as fp:
|
|
124
122
|
try:
|
|
125
123
|
points = blackvue_parser.extract_points(fp)
|
|
126
|
-
except
|
|
124
|
+
except sparser.ParsingError:
|
|
127
125
|
points = None
|
|
128
126
|
|
|
129
127
|
if points is not None:
|
|
@@ -132,6 +130,7 @@ class GeotagVideosFromVideo(GeotagVideosFromGeneric):
|
|
|
132
130
|
return types.VideoMetadata(
|
|
133
131
|
filename=video_path,
|
|
134
132
|
md5sum=None,
|
|
133
|
+
filesize=utils.get_file_size(video_path),
|
|
135
134
|
filetype=types.FileType.BLACKVUE,
|
|
136
135
|
points=points,
|
|
137
136
|
make=make,
|
|
@@ -160,11 +159,11 @@ class GeotagVideosFromVideo(GeotagVideosFromGeneric):
|
|
|
160
159
|
video_metadata.points = geo.extend_deduplicate_points(video_metadata.points)
|
|
161
160
|
assert video_metadata.points, "must have at least one point"
|
|
162
161
|
|
|
163
|
-
if all(isinstance(p,
|
|
162
|
+
if all(isinstance(p, GPSPoint) for p in video_metadata.points):
|
|
164
163
|
video_metadata.points = T.cast(
|
|
165
164
|
T.List[geo.Point],
|
|
166
165
|
gpmf_gps_filter.remove_noisy_points(
|
|
167
|
-
T.cast(T.List[
|
|
166
|
+
T.cast(T.List[GPSPoint], video_metadata.points)
|
|
168
167
|
),
|
|
169
168
|
)
|
|
170
169
|
if not video_metadata.points:
|
|
@@ -2,6 +2,7 @@ import logging
|
|
|
2
2
|
import typing as T
|
|
3
3
|
|
|
4
4
|
from .. import constants, geo
|
|
5
|
+
from ..telemetry import GPSPoint
|
|
5
6
|
from . import gps_filter
|
|
6
7
|
|
|
7
8
|
"""
|
|
@@ -13,8 +14,8 @@ LOG = logging.getLogger(__name__)
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def remove_outliers(
|
|
16
|
-
sequence: T.Sequence[
|
|
17
|
-
) -> T.Sequence[
|
|
17
|
+
sequence: T.Sequence[GPSPoint],
|
|
18
|
+
) -> T.Sequence[GPSPoint]:
|
|
18
19
|
distances = [
|
|
19
20
|
geo.gps_distance((left.lat, left.lon), (right.lat, right.lon))
|
|
20
21
|
for left, right in geo.pairwise(sequence)
|
|
@@ -37,9 +38,7 @@ def remove_outliers(
|
|
|
37
38
|
"Split to %d sequences with max distance %f", len(sequences), max_distance
|
|
38
39
|
)
|
|
39
40
|
|
|
40
|
-
ground_speeds = [
|
|
41
|
-
p.gps_ground_speed for p in sequence if p.gps_ground_speed is not None
|
|
42
|
-
]
|
|
41
|
+
ground_speeds = [p.ground_speed for p in sequence if p.ground_speed is not None]
|
|
43
42
|
if len(ground_speeds) < 2:
|
|
44
43
|
return sequence
|
|
45
44
|
|
|
@@ -50,20 +49,20 @@ def remove_outliers(
|
|
|
50
49
|
)
|
|
51
50
|
|
|
52
51
|
return T.cast(
|
|
53
|
-
T.List[
|
|
52
|
+
T.List[GPSPoint],
|
|
54
53
|
gps_filter.find_majority(merged.values()),
|
|
55
54
|
)
|
|
56
55
|
|
|
57
56
|
|
|
58
57
|
def remove_noisy_points(
|
|
59
|
-
sequence: T.Sequence[
|
|
60
|
-
) -> T.Sequence[
|
|
58
|
+
sequence: T.Sequence[GPSPoint],
|
|
59
|
+
) -> T.Sequence[GPSPoint]:
|
|
61
60
|
num_points = len(sequence)
|
|
62
61
|
sequence = [
|
|
63
62
|
p
|
|
64
63
|
for p in sequence
|
|
65
64
|
# include points **without** GPS fix
|
|
66
|
-
if p.
|
|
65
|
+
if p.fix is None or p.fix.value in constants.GOPRO_GPS_FIXES
|
|
67
66
|
]
|
|
68
67
|
if len(sequence) < num_points:
|
|
69
68
|
LOG.debug(
|
|
@@ -77,7 +76,7 @@ def remove_noisy_points(
|
|
|
77
76
|
p
|
|
78
77
|
for p in sequence
|
|
79
78
|
# include points **without** precision
|
|
80
|
-
if p.
|
|
79
|
+
if p.precision is None or p.precision <= constants.GOPRO_MAX_DOP100
|
|
81
80
|
]
|
|
82
81
|
if len(sequence) < num_points:
|
|
83
82
|
LOG.debug(
|