kopia lustrzana https://github.com/OpenDroneMap/ODM
Merge pull request #999 from pierotofy/gcpextrasfix
Do not include extras in GCP UTM copypull/1001/head
commit
e37b297f39
|
@ -63,7 +63,7 @@ class GCPFile:
|
|||
utm_zone, hemisphere = location.get_utm_zone_and_hemisphere_from(lon, lat)
|
||||
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
|
||||
by optionally including only filenames and reprojecting each point to
|
||||
|
@ -80,6 +80,8 @@ class GCPFile:
|
|||
for entry in self.iter_entries():
|
||||
if filenames is None or entry.filename in filenames:
|
||||
entry.x, entry.y, entry.z = transformer.TransformPoint(entry.x, entry.y, entry.z)
|
||||
if not include_extras:
|
||||
entry.extras = ''
|
||||
output.append(str(entry))
|
||||
elif isinstance(rejected_entries, list):
|
||||
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
|
||||
# does not handle other SRS well.
|
||||
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():
|
||||
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)
|
||||
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__':
|
||||
unittest.main()
|
Ładowanie…
Reference in New Issue