Forum

Author Topic: Error: Null Model  (Read 1801 times)

Mojtaba Goudarzi

  • Newbie
  • *
  • Posts: 6
    • View Profile
Error: Null Model
« on: May 25, 2023, 11:48:21 AM »
Hello every body,
I have written the following script in Python to build orthomosaic images. But I get "Error: Null Model". Can you guide me please?

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 = doc.chunk
chunk.buildDem(source_data = Metashape.DenseCloudData, interpolation = Metashape.EnabledInterpolation)
chunk.buildOrthomosaic (surface_data = Metashape.ModelData, blending_mode = Metashape.MosaicBlending, fill_holes = True, ghosting_filter = False, cull_faces = False, refine_seamlines = False)

Best Regards
Mojtaba Goudarzi
« Last Edit: May 25, 2023, 11:50:03 AM by Mojtaba Goudarzi »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Error: Null Model
« Reply #1 on: May 25, 2023, 03:36:39 PM »
Hello Mojtaba,

In your code there is no line for model (mesh) generation, so orthomosaic cannot be projected on mesh surface. You should probably switch surface_data value to Metashape.ElevationData if you need to build orthomosaic using DEM.

And I still recommend to save the project in PSX format in the very beginning of the script - it would enable fine-level task subdivision and Metashape wouldn't load all the data to RAM.
Best regards,
Alexey Pasumansky,
Agisoft LLC