Hi Alexey,
In order to evaluate the remaining systematic errors in calibrated camera after bundle adjustment I´d need, for every tiepoint , its original automated marking coordinates and its final projected coordinates (for every photo). I´m not very good programming. Searching the foro I was able to get the final projected coordinates, but not the initial. ¿Could you help me please? Thank you.
from PySide2 import QtGui, QtCore, QtWidgets
import Metashape, time
import random
import math
import datetime
import os, sys
print("Proceso Iniciado")
chunk = Metashape.app.document.chunk
project_path = Metashape.app.document.path
parent_dir = os.path.dirname(project_path)
filename_Tp='Chupac_Tiepoints.csv'
rutaArchivo_Tp = os.path.join(parent_dir, filename_Tp)
#repeticionPorPuntos=1
#minPuntos=3
#maxPuntos=len(chunk.markers)
#disMinEnPunto=0
#controlPuntosChequeo=10
#flagControlDistancias=True
fechaInicio=datetime.datetime.now()
def export_Tp():
FicheroErrores = open(rutaArchivo_Tp,'a')
t0 = time.time()
contador=0
tie_points = chunk.tie_points
points = tie_points.points
npoints = len(points)
projections = chunk.tie_points.projections
point_proj = [] #list of strings
max_count = 0
app.processEvents()
print("\nScript started ...")
app.processEvents()
point_ids = [-1] * len(tie_points.tracks)
for point_id in range(0, npoints):
point_ids[points[point_id].track_id] = point_id
for camera in chunk.cameras:
if not camera.type == Metashape.Camera.Type.Regular: #skipping camera track keyframes
continue
if not camera.transform: #skipping NA cameras
continue
for proj in projections[camera]:
track_id = proj.track_id
point_id = point_ids[track_id]
if point_id < 0:
continue
if not points[point_id].valid:
continue
FicheroErrores.write('\t')
FicheroErrores.write(str(camera.label))
FicheroErrores.write('\t')
FicheroErrores.write(str(point_id))
FicheroErrores.write('\t')
FicheroErrores.write(str(proj.coord.x))
FicheroErrores.write('\t')
FicheroErrores.write(str(proj.coord.y))
FicheroErrores.write('\n')
# Here I need the initial sift features coordinates!!!
contador=contador+1
#print(line)
FicheroErrores.close()
t2 = time.time()
t2 -= t0
t2 = float(t2)
app.processEvents()
print("Script finished in " + "{:.2f}".format(t2) + " seconds.")
app.processEvents()
return contador
####
global app
app = QtWidgets.QApplication.instance()
chunk = Metashape.app.document.chunk
result0 = export_Tp()
print("\nNúmero de TiePoints ...")
print(result0)