7
« on: June 07, 2017, 06:31:29 AM »
Hello,
I am trying to automate the processing of a chunk (aligning photos, building dense point cloud, generating mesh, adding texture, building orthomosaic, and exporting the orthomosaic)
However, when I try to build the orthomosaic, I get "error: empty frame path"
Here is my code:
import PhotoScan
import os
import sys
doc = PhotoScan.app.document
chunk = doc.chunk
doc.chunk.crs = PhotoScan.CoordinateSystem("EPSG::4326")
imagePath = sys.argv[1]
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, preselection=PhotoScan.ReferencePreselection)
chunk.alignCameras()
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality)
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation)
chunk.buildUV(mapping=PhotoScan.GenericMapping)
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=4096)
doc.save(path=os.path.join(imagePath, "test.psx"))
# Problem area
chunk.buildOrthomosaic(surface=PhotoScan.DataSource.ModelData, blending=PhotoScan.BlendingMode.MosaicBlending)
chunk.exportOrthomosaic(os.path.join(imagePath, "orthomosaic.tif"), format='tif')
It works until the saving of the file as a psx. Then I get the error when I try to build the orthomosaic.
I read somewhere that I should try to save the document before doing the processing steps, but when I tried that the outputs of the processing steps (tie points, dense point cloud, model, etc.) were not being added to the chunk, and when I tried to build the orthomosaic I got "Error: bad allocation"
I am using PhotoScan 1.2.0, and at the moment I am unable to change versions. How can I fix this?