Forum

Author Topic: Find the corresponding 2D coordinates on the image from geographic coordinates  (Read 1316 times)

scc

  • Newbie
  • *
  • Posts: 3
    • View Profile
I have a latitude and longitude point (lat, lon) and the corresponding modeling results. I found the elevation information through DEM and got a 3D point (lat, lon, alt), and then added the point (chunk.addMarker). I want to find the corresponding image (including all images of the point, there are several) through the Marker. How can I achieve this? I can view it through View-Photos on the page. How can I get it using the python api? In addition, if the corresponding image is obtained, how can I map the point to the pixel coordinates of the corresponding image? Thank you very much.

I implemented some codes based on Python API, but I don't know how to implement the subsequent codes.

vector = (lon, lat)
doc = Metashape.app.document
if len(doc.chunks):
    chunk = Metashape.app.document.chunk
else:
    chunk = doc.addChunk()
doc.open(project_path)
chunk = doc.findChunk(0)
point_altitude = chunk.elevation.altitude(vector)  # 获取高程信息
point_3 = (vector[0], vector[1], point_altitude)  # (lat, lon, alt)
point_3 = Metashape.Vector(point_3)
marker = chunk.addMarker(point_3)

I understand. The projection when addmarker is wrong. I solved it by referring to the following method.
https://www.agisoft.com/forum/index.php?topic=11269.msg50622#msg50622
« Last Edit: June 05, 2024, 04:39:01 AM by scc »