Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: model extraction from GoPro #575

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion mapillary_tools/geotag/gpmf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ def _extract_dvnm_from_samples(
device_id = _find_first_device_id(device["data"])
for klv in device["data"]:
if klv["key"] == b"DVNM" and klv["data"]:
dvnm_by_dvid[device_id] = klv["data"][0]
# klv["data"] could be [b"H", b"e", b"r", b"o", b"8", b" ", b"B", b"l", b"a", b"c", b"k"]
# or [b"Hero8 Black"]
dvnm_by_dvid[device_id] = b"".join(klv["data"])

return dvnm_by_dvid

Expand Down Expand Up @@ -375,6 +377,11 @@ def extract_camera_model(fp: T.BinaryIO) -> str:
if "hero" in unicode_name.lower():
return unicode_name.strip()

# device containing "gopro" higher priority
for unicode_name in unicode_names:
if "gopro" in unicode_name.lower():
return unicode_name.strip()

return unicode_names[0].strip()


Expand Down