Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: Henry on April 19, 2018, 04:12:55 AM
-
I'm trying to build a DEM and Ortho in a python script, but I keep running into this error:
LoadProject: path = /workspace/project.psx
loaded project in 0.005241 sec
BuildDem: projection = WGS 84, source data = Dense cloud, interpolation = Enabled, resolution = 0
Please save project in PSX format before processing
Traceback (most recent call last):
File "test.py", line 35, in <module>
projection=PhotoScan.CoordinateSystem("EPSG::4326"))
RuntimeError: Empty frame path
Here is the snippet from my script:
doc.save("/workspace/project.psx")
chunk.buildDem(source=PhotoScan.DataSource.DenseCloudData,
interpolation=PhotoScan.EnabledInterpolation,
projection=PhotoScan.CoordinateSystem("EPSG::4326"))
It looks to me like I am saving it in PSX format before trying to build the DEM, so what's the problem?
-
You need to save the document with doc.save()
So without the path parameter before building the dem or orthophoto. For whatever reason doc.save("path") and doc.save() do different things...
doc.save("/workspace/project.psx")
doc.save()
chunk.buildDem(source=PhotoScan.DataSource.DenseCloudData,
interpolation=PhotoScan.EnabledInterpolation,
projection=PhotoScan.CoordinateSystem("EPSG::4326"))
Should work.
-
Hello,
Saving document with path parameter works as "save as" option, so after that you need to re-assign the chunk variable, if it has been previously defined, for example:
doc.save(path)
chunk = doc.chunks[0]
chunk.buildDem()