import PhotoScan
import math, time
doc = PhotoScan.app.document
for i in range(10):
chunk = PhotoScan.app.document.addChunk()
chunk.addPhotos(["c79.jpg", "c80.jpg","c81.jpg"])
chunk.crs = PhotoScan.CoordinateSystem("EPSG::3826")
chunk.camera_location_accuracy = ([0.001, 0.001, 0.001])
chunk.camera_rotation_accuracy = ([0.001, 0.001, 0.001])
chunk.loadReference("ex.txt", format = PhotoScan.ReferenceFormatCSV, columns = "nxyzabc", delimiter =",")
PhotoScan.app.update()
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, preselection=PhotoScan.GenericPreselection)
chunk.alignCameras()
chunk.optimizeCameras(fit_f=True, fit_cxcy=True, fit_skew=True, fit_k1k2k3=True,fit_p1p2=True)
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality)
chunk.exportPoints("D:/exports/pto" + str(i) +".las",source=PhotoScan.DataSource.DenseCloudData, format = PhotoScan.PointsFormatLAS,projection=PhotoScan.CoordinateSystem("EPSG::3826"))
time.sleep(10)
print("All done")