Hello gurjar,
Below you can see an example of the script below, that returns 3D coordinates based on pixel coordinates on the first image:
import Metashape
points = [(10,10), (10,500), (500,500), (500,10)]
chunk = Metashape.app.document.chunk
crs = chunk.crs
T = chunk.transform.matrix
N = 0 #for the first camera in chunk
camera = chunk.cameras[N]
if chunk.model:
surface = chunk.model
elif chunk.point_cloud:
surface = chunk.point_cloud
else:
surface = chunk.tie_points
vertices = list()
for point in points:
x, y = point
ray_origin = camera.unproject(Metashape.Vector([x, y, 0]))
ray_target = camera.unproject(Metashape.Vector([x, y, 1]))
point3D = surface.pickPoint(ray_origin, ray_target)
if not point3D:
continue #skip
point3D = crs.project(T.mulp(point3D))
vertices.append(point3D)
print(vertices)
print("Script finished")