Hello Martin,
Here's the script sample that saves among other the requested information (except the reconstruction uncertainty):
# Compatibility - Agisoft PhotoScan Professional 1.2.6
# saves the information about the tie points in the sparse cloud according to the following format
# export format:
# point_index X-coord Y-coord Z-coord R_color G_color B_color reproj_error proj_acc image_count
import PhotoScan
import math, time
doc = PhotoScan.app.document
chunk = doc.chunk
M = chunk.transform.matrix
crs = chunk.crs
point_cloud = chunk.point_cloud
projections = point_cloud.projections
points = point_cloud.points
npoints = len(points)
tracks = point_cloud.tracks
path = PhotoScan.app.getSaveFileName("Specify export path and filename:")
file = open(path, "wt")
print("Script started")
file.write("index\tX-coord\tY-coord\tZ-coord\tR\tG\tB\treproj_error\tproj_acc\timage_count\n")
t0 = time.time()
points_coords = {}
points_errors = {}
points_colors = {}
for photo in chunk.cameras:
if not photo.transform:
continue
T = photo.transform.inv()
calib = photo.sensor.calibration
point_index = 0
for proj in projections[photo]:
track_id = proj.track_id
while point_index < npoints and points[point_index].track_id < track_id:
point_index += 1
if point_index < npoints and points[point_index].track_id == track_id:
if not points[point_index].valid:
continue
coord = T * points[point_index].coord
coord.size = 3
dist = calib.error(coord, proj.coord).norm() ** 2
v = M * points[point_index].coord
v.size = 3
if point_index in points_errors.keys():
point_index = int(point_index)
points_errors[point_index].x += dist
points_errors[point_index].y += 1
points_errors[point_index].z += proj.size
else:
points_errors[point_index] = PhotoScan.Vector([dist, 1, proj.size])
if not (point_index in points_colors.keys()):
points_colors[point_index] = tracks[track_id].color
for point_index in range(npoints):
if not points[point_index].valid:
continue
if chunk.crs:
w = M * points[point_index].coord
w.size = 3
X, Y, Z = chunk.crs.project(w)
else:
X, Y, Z, w = M * points[point_index].coord
error = math.sqrt(points_errors[point_index].x / points_errors[point_index].y)
count = int(points_errors[point_index].y)
accuracy = points_errors[point_index].z / points_errors[point_index].y
R, G, B = points_colors[point_index]
file.write("{:6d}\t{:.6f}\t{:.6f}\t{:.6f}\t{:3d}\t{:3d}\t{:3d}\t{:.6f}\t{:.2f}\t{:2d}\n".format(point_index, X, Y, Z, R, G, B,error, accuracy, count))
t1 = time.time()
file.flush()
file.close()
print("Script finished in " + str(int(t1-t0)) + " seconds.")
PhotoScan.app.messageBox("Script finished in " + str(int(t1-t0)) + " seconds.")
Please let me know if you have any comments on the script. You can check it on the very small number of points in the cloud and compare to the values in the Chunk Info dialog.