3
I have an aerial photo of a lake and I have a file . geojson with a polygon that represents the outline of that lake on a real map.
I am converting latitude, longitude and altitude to X, Y, Z using the following code:
lonDiff = lonMax - lonMin
latDiff = latMax - latMin
altDiff = altMax - altMin
if (lonDiff > latDiff and lonDiff > altDiff):
distMax = lonDiff
if (latDiff > lonDiff and latDiff > altDiff):
distMax = latDiff
if (altDiff > lonDiff and altDiff > latDiff):
distMax = altDiff
adjustment = imgSize/distMax
vectors = []
vetores = np.zeros((len(coordList),3))
vectorsX = []
vectorsY = []
vectorsZ = []
for i in range(0,len(coordinates)):
vectors[i][0] = (coordinates[i][0] - lonMin) * adjustment
vectors[i][1] = (coordinates[i][1] - latMin) * adjustment
vectors[i][2] = (coordinates[i][2] - altMin) * adjustment
vectorsX.append((coordinates[i][0] - lonMin) * adjustment)
vectorsY.append((coordinates[i][1] - latMin) * adjustment)
vectorsZ.append((coordinates[i][2] - altMin) * adjustment)
What I need is to plot these values (X,Y,Z) on the screen, but with a distortion based on the angulation parameters of the moment the photo was taken so that the contour aligns perfectly to the lake. I have a txt file with the parameters (such as X_pos, Y_pos, Altitude, Yaw, Pitch, Roll, etc) of 16 different photographs of this lake.
Here’s a simple example of what I need (done in Paint):
I have tried using the related transformations of the Opencv package, which seems to be the best option here, but I couldn’t implement because I need the input of specific points to be used as reference and I can’t do that because the coordinates will change for each geojson file that is inserted in the program.
I don’t know what else I can try. It doesn’t seem to me to be something very complex in terms of code, just apply the parameters in the outline seen from above, but the math/image transformation is not clear in my head, and I’m not sure if I really need Opencv for this.
Any response or help will be very well received, and if something has not become sufficiently clear, please tell me so that I explain better and we can find some solution.