Hello Alex,
Please check if the following script gives you the desired result, it outputs the marker labels and corresponding error to the Console pane (but you can easily redirect it to the external file):
import Metashape, math
def find_marker(label, chunk):
for marker in chunk.markers:
if label == marker.label:
return marker
return None
MARKERS = ["point 1", "point 2"]
chunk = Metashape.app.document.chunk
print("Script started...")
for name in MARKERS:
marker = find_marker(name, chunk)
if not marker:
print(name + " not found, skipping...")
continue
if not marker.position:
print(name + " is not defined in 3D, skipping...")
continue
position = marker.position
total = (0, 0)
for camera in marker.projections.keys():
if not camera.transform:
continue
proj = marker.projections[camera].coord
reproj = camera.project(marker.position)
error = (proj - reproj).norm()
total = (total[0] + error**2, total[1] + 1)
print(marker.label, math.sqrt(total[0] / total [1]))
print("Script finished")
The list of marker labels to be processed is defined in the script body as a MARKERS list.