Forum

Author Topic: Exporting report data in numeric format  (Read 3087 times)

PatCarbon@Durham

  • Newbie
  • *
  • Posts: 3
    • View Profile
Exporting report data in numeric format
« on: June 25, 2019, 02:27:17 PM »
Is there a way to export the data presented in the output report as csvs?  Or any other format that would then allow for a numeric usage of this information?  For example, is it possible to export the plot of camera calibration image residuals as a table of Xpix, Ypix, Xresid, Yresid?
Thanks
Patrice

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Exporting report data in numeric format
« Reply #1 on: June 28, 2019, 02:38:37 PM »
Hello Patrice,

Residuals graph is not stored in the project contents, so if you need to export residuals in the numerical representation (or as vectors), you should calculate them in the script for each point.
Let me know, if you need any assistance.
Best regards,
Alexey Pasumansky,
Agisoft LLC

enocsanz

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Exporting report data in numeric format
« Reply #2 on: June 13, 2024, 03:04:35 PM »
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.

 
Code: [Select]
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)