kopia lustrzana https://github.com/OpenDroneMap/ODM
Do not include extras in GCP UTM copy
rodzic
44603ef711
commit
c697551057
|
@ -63,7 +63,7 @@ class GCPFile:
|
||||||
utm_zone, hemisphere = location.get_utm_zone_and_hemisphere_from(lon, lat)
|
utm_zone, hemisphere = location.get_utm_zone_and_hemisphere_from(lon, lat)
|
||||||
return "WGS84 UTM %s%s" % (utm_zone, hemisphere)
|
return "WGS84 UTM %s%s" % (utm_zone, hemisphere)
|
||||||
|
|
||||||
def create_utm_copy(self, gcp_file_output, filenames=None, rejected_entries=None):
|
def create_utm_copy(self, gcp_file_output, filenames=None, rejected_entries=None, include_extras=True):
|
||||||
"""
|
"""
|
||||||
Creates a new GCP file from an existing GCP file
|
Creates a new GCP file from an existing GCP file
|
||||||
by optionally including only filenames and reprojecting each point to
|
by optionally including only filenames and reprojecting each point to
|
||||||
|
@ -80,6 +80,8 @@ class GCPFile:
|
||||||
for entry in self.iter_entries():
|
for entry in self.iter_entries():
|
||||||
if filenames is None or entry.filename in filenames:
|
if filenames is None or entry.filename in filenames:
|
||||||
entry.x, entry.y, entry.z = transformer.TransformPoint(entry.x, entry.y, entry.z)
|
entry.x, entry.y, entry.z = transformer.TransformPoint(entry.x, entry.y, entry.z)
|
||||||
|
if not include_extras:
|
||||||
|
entry.extras = ''
|
||||||
output.append(str(entry))
|
output.append(str(entry))
|
||||||
elif isinstance(rejected_entries, list):
|
elif isinstance(rejected_entries, list):
|
||||||
rejected_entries.append(entry)
|
rejected_entries.append(entry)
|
||||||
|
|
|
@ -111,7 +111,7 @@ class ODM_Reconstruction(object):
|
||||||
# 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.
|
||||||
rejected_entries = []
|
rejected_entries = []
|
||||||
utm_gcp = GCPFile(gcp.create_utm_copy(output_gcp_file, filenames=[p.filename for p in self.photos], rejected_entries=rejected_entries))
|
utm_gcp = GCPFile(gcp.create_utm_copy(output_gcp_file, filenames=[p.filename for p in self.photos], rejected_entries=rejected_entries, include_extras=False))
|
||||||
|
|
||||||
if not utm_gcp.exists():
|
if not utm_gcp.exists():
|
||||||
raise RuntimeError("Could not project GCP file to UTM. Please double check your GCP file for mistakes.")
|
raise RuntimeError("Could not project GCP file to UTM. Please double check your GCP file for mistakes.")
|
||||||
|
|
|
@ -57,5 +57,13 @@ class TestGcp(unittest.TestCase):
|
||||||
gcp = GCPFile(None)
|
gcp = GCPFile(None)
|
||||||
self.assertFalse(gcp.exists())
|
self.assertFalse(gcp.exists())
|
||||||
|
|
||||||
|
def test_gcp_extras(self):
|
||||||
|
gcp = GCPFile('tests/assets/gcp_extras.txt')
|
||||||
|
self.assertEqual(gcp.get_entry(0).extras, 'gcp1')
|
||||||
|
|
||||||
|
copy = GCPFile(gcp.create_utm_copy("tests/assets/output/gcp_utm_no_extras.txt", include_extras=False))
|
||||||
|
self.assertTrue(copy.exists())
|
||||||
|
self.assertEqual(copy.get_entry(0).extras, '')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
Ładowanie…
Reference in New Issue