Forum

Author Topic: Error: Empty frame path  (Read 1941 times)

Mojtaba Goudarzi

  • Newbie
  • *
  • Posts: 6
    • View Profile
Error: Empty frame path
« on: May 17, 2023, 12:07:47 PM »
Hello,
I'm working on a script to build a DEM. But after running it, I get "Error: Empty frame path" and see the message "Please save project in PSX format before processing".
What is wrong in my script?

Code: [Select]
import os, Metashape
doc = Metashape.app.document
chunk = doc.addChunk()
Pfad1 = "C:/Users/Desktop/TIFF"
Liste = os.listdir(Pfad1)
Fotos = list()
for Foto in Liste:
    Fotos.append("/".join([Pfad1, Foto]))
chunk.addPhotos(Fotos)
Pfad2 = "C:/Users/Desktop/Referenz.csv"
chunk.importReference(Pfad2, format = Metashape.ReferenceFormatCSV, columns = 'nxyz', delimiter = ';', skip_rows = 1)
chunk.matchPhotos(downscale = 4, generic_preselection = True, reference_preselection = True)
chunk.alignCameras()
chunk.buildDepthMaps(downscale = 4, filter_mode = Metashape.MildFiltering, reuse_depth = False)
chunk.buildDenseCloud()
doc.save("C:/Users/Desktop/Das Erste.psx")
chunk.buildDem(source_data = Metashape.DenseCloudData, interpolation = Metashape.EnabledInterpolation)

Best Regards
Mojtaba Goudarzi

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14965
    • View Profile
Re: Error: Empty frame path
« Reply #1 on: May 17, 2023, 03:26:13 PM »
Hello Mojtaba,

You need to save the project in PSX format as stated in the error message. I suggest to do that in the very beginning:

Code: [Select]
import os, Metashape
doc = Metashape.app.document
doc.save("project.psx")

Then after major processing stages you can use just doc.save() without any argument, if it is necessary to keep the processing results saved in the current project.

In your code you have used doc.save() with the path argument, which works similarly to "save as" command, in such case you should re-assign chunk variable:
Code: [Select]
doc.save("C:/Users/Desktop/Das Erste.psx")
chunk = doc.chunk
chunk.buildDem(source_data = Metashape.DenseCloudData, interpolation = Metashape.EnabledInterpolation)
Best regards,
Alexey Pasumansky,
Agisoft LLC

Mojtaba Goudarzi

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Error: Empty frame path
« Reply #2 on: May 25, 2023, 11:24:06 AM »
Hello Alexey,
Thank you very much!