Forum

Author Topic: How to save project as PSX in python script (For building DEM and Ortho)  (Read 3777 times)

Henry

  • Newbie
  • *
  • Posts: 1
    • View Profile
I'm trying to build a DEM and Ortho in a python script, but I keep running into this error:

Code: [Select]
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:

Code: [Select]
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?

Geend

  • Newbie
  • *
  • Posts: 12
    • View Profile
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...


Code: [Select]
doc.save("/workspace/project.psx")
doc.save()
chunk.buildDem(source=PhotoScan.DataSource.DenseCloudData,
               interpolation=PhotoScan.EnabledInterpolation,
               projection=PhotoScan.CoordinateSystem("EPSG::4326"))

Should work.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14816
    • View Profile
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:
Code: [Select]
doc.save(path)
chunk = doc.chunks[0]
chunk.buildDem()
Best regards,
Alexey Pasumansky,
Agisoft LLC