GCP warning checks

pull/1550/head
Piero Toffanin 2022-11-07 13:21:44 -05:00
rodzic c7e93e18dd
commit 96ecbba8cb
2 zmienionych plików z 34 dodań i 0 usunięć

Wyświetl plik

@ -37,6 +37,35 @@ class GCPFile:
for entry in self.entries: for entry in self.entries:
yield self.parse_entry(entry) yield self.parse_entry(entry)
def check_entries(self):
coords = {}
gcps = {}
errors = 0
for entry in self.iter_entries():
k = entry.coords_key()
coords[k] = coords.get(k, 0) + 1
if k not in gcps:
gcps[k] = []
gcps[k].append(entry)
for k in coords:
if coords[k] < 3:
description = "insufficient" if coords[k] < 2 else "not ideal"
for entry in gcps[k]:
log.ODM_WARNING(str(entry))
log.ODM_WARNING("The number of images where the GCP %s has been tagged are %s" % (k, description))
log.ODM_WARNING("You should tag at least %s more images" % (3 - coords[k]))
log.ODM_WARNING("=====================================")
errors += 1
if len(coords) < 3:
log.ODM_WARNING("Low number of GCPs detected (%s). For best results use at least 5." % (3 - len(coords)))
log.ODM_WARNING("=====================================")
errors += 1
if errors > 0:
log.ODM_WARNING("Some issues detected with GCPs (but we're going to process this anyway)")
def parse_entry(self, entry): def parse_entry(self, entry):
if entry: if entry:
parts = entry.split() parts = entry.split()
@ -204,6 +233,9 @@ class GCPEntry:
self.py = py self.py = py
self.filename = filename self.filename = filename
self.extras = extras self.extras = extras
def coords_key(self):
return "{} {} {}".format(self.x, self.y, self.z)
def __str__(self): def __str__(self):
return "{} {} {} {} {} {} {}".format(self.x, self.y, self.z, return "{} {} {} {} {} {} {}".format(self.x, self.y, self.z,

Wyświetl plik

@ -107,6 +107,8 @@ class ODM_Reconstruction(object):
if gcp.exists(): if gcp.exists():
if gcp.entries_count() == 0: if gcp.entries_count() == 0:
raise RuntimeError("This GCP file does not have any entries. Are the entries entered in the proper format?") raise RuntimeError("This GCP file does not have any entries. Are the entries entered in the proper format?")
gcp.check_entries()
# Convert GCP file to a UTM projection since the rest of the pipeline # Convert GCP file to a UTM projection since the rest of the pipeline
# does not handle other SRS well. # does not handle other SRS well.