Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions imgparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,3 +602,15 @@ def dewarp_flag(self) -> bool:
raise ParsingError(
"Couldn't parse dewarp flag. Sensor might not be supported"
)

def gps_accuracy(self) -> tuple[float, float, float]:
"""Get the GPS accuracy values in meters for x, y, and z."""
try:
x_acc = float(self.xmp_data[self.xmp_tags.X_ACCURACY_M])
y_acc = float(self.xmp_data[self.xmp_tags.Y_ACCURACY_M])
z_acc = float(self.xmp_data[self.xmp_tags.Z_ACCURACY_M])
return x_acc, y_acc, z_acc
except KeyError:
raise ParsingError(
"Couldn't parse GPS accuracy. Sensor might not be supported"
)
12 changes: 12 additions & 0 deletions imgparse/xmp_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class XMPTags:
CAPTURE_UUID: str = ""
FLIGHT_UUID: str = ""
DEWARP_FLAG: str = ""
X_ACCURACY_M: str = ""
Y_ACCURACY_M: str = ""
Z_ACCURACY_M: str = ""


class SenteraTags(XMPTags):
Expand All @@ -47,6 +50,9 @@ class SenteraTags(XMPTags):
DISTORTION = "Camera:PerspectiveDistortion"
CAPTURE_UUID = "Camera:CaptureUUID"
FLIGHT_UUID = "Camera:FlightUUID"
X_ACCURACY_M: str = "Camera:GPSXYAccuracy"
Y_ACCURACY_M: str = "Camera:GPSXYAccuracy"
Z_ACCURACY_M: str = "Camera:GPSZAccuracy"


class DJITags(XMPTags):
Expand All @@ -62,13 +68,19 @@ class DJITags(XMPTags):
CAPTURE_UUID = "drone-dji:CaptureUUID"
DEWARP_FLAG = "drone-dji:DewarpFlag"
DISTORTION = "drone-dji:DewarpData"
X_ACCURACY_M: str = "drone-dji:RtkStdLon"
Y_ACCURACY_M: str = "drone-dji:RtkStdLat"
Z_ACCURACY_M: str = "drone-dji:RtkStdHgt"


class MicaSenseTags(XMPTags):
"""MicaSense XMP Tags."""

CAPTURE_UUID = "MicaSense:CaptureId"
IRRADIANCE = "Camera:Irradiance"
X_ACCURACY_M: str = "Camera:GPSXYAccuracy"
Y_ACCURACY_M: str = "Camera:GPSXYAccuracy"
Z_ACCURACY_M: str = "Camera:GPSZAccuracy"


class ParrotTags(XMPTags):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "imgparse"
version = "2.0.8"
version = "2.0.9"
description = "Python image-metadata-parser utilities"
authors = []
include = [
Expand Down