Hello Neb0skreb,
Please check, if the following script for Metashape 1.6 gives you the desired reprojection (pix) values (RMS and max), similar to information in Chunk Info.
The script should also work in Metashape 1.7 and 1.8. For 2.0 compatibility it should be sufficient to modify chunk.point_cloud to chunk.tie_points in two occurrences.
import Metashape
import time, math
def calc_reprojection(chunk):
point_cloud = chunk.point_cloud
points = point_cloud.points
npoints = len(points)
projections = chunk.point_cloud.projections
err_sum = 0
num = 0
maxe = 0
point_ids = [-1] * len(point_cloud.tracks)
point_errors = dict()
for point_id in range(0, npoints):
point_ids[points[point_id].track_id] = point_id
for camera in chunk.cameras:
if not camera.transform:
continue
for proj in projections[camera]:
track_id = proj.track_id
point_id = point_ids[track_id]
if point_id < 0:
continue
point = points[point_id]
if not point.valid:
continue
error = camera.error(point.coord, proj.coord).norm() ** 2
err_sum += error
num += 1
if point_id not in point_errors.keys():
point_errors[point_id] = [error]
else:
point_errors[point_id].append(error)
if error > maxe: maxe = error
sigma = math.sqrt(err_sum / num)
return (sigma, point_errors, maxe)
chunk = Metashape.app.document.chunk
t0 = time.time()
result = calc_reprojection(chunk)
print('RMS reprojection error (pix): ' + str(result[0]))
point_errors = dict()
for point in result[1].keys():
point_errors[point] = sum(result[1][point]) / len(result[1][point])
print("Max. reprojection error (pix): " + str(math.sqrt(result[2])))#str(math.sqrt(max(point_errors.values()))))
t0 = time.time() - t0
print("Script finished in " + "{:.2f}".format(float(t0)) + " seconds")