From 46377aa81896c25275ec43eb26ece9f847c640d8 Mon Sep 17 00:00:00 2001 From: hornig Date: Sat, 15 Jun 2019 23:32:09 +0200 Subject: [PATCH] adds listing QR positions as OpenDroneMap GCP_list.txt converting the positon (lat,long) as the UTM format of WGS84. also adding altitutde to the my_gcp_list, which was renamed from gcp_list to my_gcp_list to distinguish it from the output for ODM. --- gcp_list.txt | 3 --- main.py | 23 +++++++++++++++++++++-- my_gcp_list.txt | 3 +++ requirements.txt | 3 ++- 4 files changed, 26 insertions(+), 6 deletions(-) delete mode 100644 gcp_list.txt create mode 100644 my_gcp_list.txt diff --git a/gcp_list.txt b/gcp_list.txt deleted file mode 100644 index 6e7fc73..0000000 --- a/gcp_list.txt +++ /dev/null @@ -1,3 +0,0 @@ -5;50.0;10.0* -23;51.1;11.1* -42;52.2;12.2* \ No newline at end of file diff --git a/main.py b/main.py index 9f4813c..050c679 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ import os import zxing from pathlib import Path +import utm import gcposm.utils @@ -34,7 +35,9 @@ def get_qr_codes(file): def main(filename): # preparation - gcp_list = load_your_gcp_list("gcp_list.txt") + gcp_list = load_your_gcp_list("my_gcp_list.txt") + f = open("gcp_list.txt", "w") + odm_gcp_header = 0 # now working time @@ -59,13 +62,29 @@ def main(filename): #do stuff now... for item in gcp_list: if parsed == item[0]: - print("\t found a known gcp (", item[1] ,"/", item[2] ,") from your list") + print("\t found a known gcp (", item[1] ,"/", item[2] ,"/", item[3] ,") from your list") + location_utm = utm.from_latlon(float(item[1]), float(item[2])) + + + # OpenDroneMap GCP + ## header + if odm_gcp_header == 0: + # this is still to understood, why ODM just allows one utm zone and that is in the header! + f.write("WGS84 UTM " + str(location_utm[2]) + str(location_utm[3]) + "\n") + odm_gcp_header = 1 + + ## line by line saving the coordinates + f.write((str(location_utm[0]) + " " + str(location_utm[1]) + " " + item[3] + " " + + str(points[1][0]) + " " + str(points[1][1]) + " " + file.split(os.sep)[-1]) + "\n") else: print("qr not found in", file) + f.close() + + def getArgs(): """ defining the input parameters by the arguments. diff --git a/my_gcp_list.txt b/my_gcp_list.txt new file mode 100644 index 0000000..31cad3b --- /dev/null +++ b/my_gcp_list.txt @@ -0,0 +1,3 @@ +5;50.0;10.0;0.0* +23;51.1;11.1;111.1* +42;52.2;12.2;222.2* \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 5be1347..0e8cf36 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -zxing \ No newline at end of file +zxing +utm \ No newline at end of file