I had some difficulty replicating my 1.1.6 workflow with the new 1.2.x api, but managed to get it working by saving the project in .psx format then re-loading before calling the new chunk.buildOrthomosaic() method. Is this the correct way to go about ortho export, or is there a cleaner method? Will this be changing with future releases?
My workflow is summarised below:
import PhotoScan
import glob
images = glob.glob('/path/to/project/directory/images/*.jpg')
ouput_path = '/path/to/project/directory/'
app = PhotoScan.Application()
doc = PhotoScan.Document()
chunk = doc.addChunk()
chunk.addPhotos(images)
chunk.loadReferenceExif()
coord_system = PhotoScan.CoordinateSystem('EPSG::4326')
chunk.crs = coord_system
chunk.matchPhotos(accuracy=PhotoScan.LowAccuracy, preselection=PhotoScan.ReferencePreselection, tiepoint_limit=10000)
chunk.alignCameras()
chunk.optimizeCameras()
chunk.buildDenseCloud(quality=PhotoScan.LowQuality, filter=PhotoScan.AggressiveFiltering)
chunk.buildModel(surface=PhotoScan.HeightField, source=PhotoScan.DenseCloudData, face_count=PhotoScan.HighFaceCount, interpolation=PhotoScan.EnabledInterpolation)
chunk.model.closeHoles()
chunk.model.fixTopology()
chunk.buildUV(mapping=PhotoScan.GenericMapping, count=4)
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=4096)
doc.save(path=ouput_path + 'project.psx', chunks=[chunk])
doc = PhotoScan.Document()
doc.open(ouput_path + 'project.psx')
chunk = doc.chunk
chunk.buildOrthomosaic()
chunk.buildDem(source=PhotoScan.DenseCloudData)
chunk.exportOrthomosaic(ouput_path + 'ortho.tif')
chunk.exportDem(ouput_path + 'dem.tif')
chunk.exportPoints(ouput_path + 'points.las', source=PhotoScan.DenseCloudData, format='las')
chunk.exportModel(ouput_path + 'model.obj', texture_format='jpg', texture=True, format='obj')
app.quit()
Any suggestions on how to improve it based on the new api also very welcome