kopia lustrzana https://github.com/OpenDroneMap/ODM
Merge pull request #1231 from pierotofy/p4m
Add support for drone-dji:CaptureUUID tagspull/1233/head
commit
602089dfed
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.4.2
|
||||
2.4.3
|
||||
|
|
|
@ -192,7 +192,7 @@ def compute_band_maps(multi_camera, primary_band):
|
|||
Computes maps of:
|
||||
- { photo filename --> associated primary band photo } (s2p)
|
||||
- { primary band filename --> list of associated secondary band photos } (p2s)
|
||||
by looking at capture time or filenames as a fallback
|
||||
by looking at capture UUID, capture time or filenames as a fallback
|
||||
"""
|
||||
band_name = get_primary_band_name(multi_camera, primary_band)
|
||||
primary_band_photos = None
|
||||
|
@ -203,37 +203,37 @@ def compute_band_maps(multi_camera, primary_band):
|
|||
|
||||
# Try using capture time as the grouping factor
|
||||
try:
|
||||
capture_time_map = {}
|
||||
unique_id_map = {}
|
||||
s2p = {}
|
||||
p2s = {}
|
||||
|
||||
for p in primary_band_photos:
|
||||
t = p.get_utc_time()
|
||||
if t is None:
|
||||
uuid = p.get_capture_id()
|
||||
if uuid is None:
|
||||
raise Exception("Cannot use capture time (no information in %s)" % p.filename)
|
||||
|
||||
# Should be unique across primary band
|
||||
if capture_time_map.get(t) is not None:
|
||||
raise Exception("Unreliable capture time detected (duplicate)")
|
||||
if unique_id_map.get(uuid) is not None:
|
||||
raise Exception("Unreliable UUID/capture time detected (duplicate)")
|
||||
|
||||
capture_time_map[t] = p
|
||||
unique_id_map[uuid] = p
|
||||
|
||||
for band in multi_camera:
|
||||
photos = band['photos']
|
||||
|
||||
for p in photos:
|
||||
t = p.get_utc_time()
|
||||
if t is None:
|
||||
raise Exception("Cannot use capture time (no information in %s)" % p.filename)
|
||||
uuid = p.get_capture_id()
|
||||
if uuid is None:
|
||||
raise Exception("Cannot use UUID/capture time (no information in %s)" % p.filename)
|
||||
|
||||
# Should match the primary band
|
||||
if capture_time_map.get(t) is None:
|
||||
raise Exception("Unreliable capture time detected (no primary band match)")
|
||||
if unique_id_map.get(uuid) is None:
|
||||
raise Exception("Unreliable UUID/capture time detected (no primary band match)")
|
||||
|
||||
s2p[p.filename] = capture_time_map[t]
|
||||
s2p[p.filename] = unique_id_map[uuid]
|
||||
|
||||
if band['name'] != band_name:
|
||||
p2s.setdefault(capture_time_map[t].filename, []).append(p)
|
||||
p2s.setdefault(unique_id_map[uuid].filename, []).append(p)
|
||||
|
||||
return s2p, p2s
|
||||
except Exception as e:
|
||||
|
|
|
@ -45,6 +45,7 @@ class ODM_Photo:
|
|||
# Multi-band fields
|
||||
self.band_name = 'RGB'
|
||||
self.band_index = 0
|
||||
self.capture_uuid = None # DJI only
|
||||
|
||||
# Multi-spectral fields
|
||||
self.fnumber = None
|
||||
|
@ -216,9 +217,13 @@ class ODM_Photo:
|
|||
|
||||
self.set_attr_from_xmp_tag('spectral_irradiance', tags, [
|
||||
'Camera:SpectralIrradiance',
|
||||
'Camera:Irradiance',
|
||||
'Camera:Irradiance',
|
||||
], float)
|
||||
|
||||
self.set_attr_from_xmp_tag('capture_uuid', tags, [
|
||||
'@drone-dji:CaptureUUID'
|
||||
])
|
||||
|
||||
# Phantom 4 RTK
|
||||
if '@drone-dji:RtkStdLon' in tags:
|
||||
y = float(self.get_xmp_tag(tags, '@drone-dji:RtkStdLon'))
|
||||
|
@ -251,7 +256,7 @@ class ODM_Photo:
|
|||
# self.set_attr_from_xmp_tag('bandwidth', tags, [
|
||||
# 'Camera:WavelengthFWHM'
|
||||
# ], float)
|
||||
|
||||
|
||||
self.width, self.height = get_image_size.get_image_size(_path_file)
|
||||
# Sanitize band name since we use it in folder paths
|
||||
self.band_name = re.sub('[^A-Za-z0-9]+', '', self.band_name)
|
||||
|
@ -436,6 +441,13 @@ class ODM_Photo:
|
|||
|
||||
return None
|
||||
|
||||
def get_capture_id(self):
|
||||
# Use capture UUID first, capture time as fallback
|
||||
if self.capture_uuid is not None:
|
||||
return self.capture_uuid
|
||||
|
||||
return self.get_utc_time()
|
||||
|
||||
def get_gps_dop(self):
|
||||
val = -9999
|
||||
if self.gps_xy_stddev is not None:
|
||||
|
|
Ładowanie…
Reference in New Issue