Forum

Author Topic: Scripting for texture generation without redoing previous steps  (Read 298 times)

adamrabinowitz

  • Newbie
  • *
  • Posts: 1
    • View Profile
I'm working with a supercomputing cluster to develop a set of python scripts to run computationally-intensive processes remotely on an HPC node. We've sorted out the photo alignment, dense cloud/depthmaps, and mesh steps using the current Agisoft Python manual, but we're having trouble with the texture script.

So far, we've been unable to run a command for texture alone, even on a chunk for which all other steps have already been completed. The only working version of the script is the same as the model in the guide:

chunk.alignCameras()
chunk.buildDepthMaps(downscale=2, filter_mode=ms.FilterMode.ModerateFiltering)
chunk.buildDenseCloud( point_colors=True, point_confidence=True )
chunk.buildModel()
chunk.buildUV()
chunk.buildTexture()

This seems not to overwrite the optimization work we've done manually after the initial alignment, but it does overwrite any dense-cloud editing that we've performed manually after the dense-cloud generation stage. It also takes a much longer time than necessary, since it's re-running the earlier steps, which is a problem when we have limited HPC cycles.

The models involved are often too large to let us easily run the texture process through the GUI on a local machine. Does anyone have a script that will only carry out the texture steps (buildUV, buildTexture) on a chunk for which the other steps are already complete? We're not sure where the problem is arising. Thanks!


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 12851
    • View Profile
Re: Scripting for texture generation without redoing previous steps
« Reply #1 on: April 24, 2021, 01:51:24 PM »
Hello adamrabinowitz,

buildUV command should be available, if there's a mesh model in the active chunk. So there shouldn't be problems running only buildUV and buildTexture in the pre-processed project with the mesh model.

For debugging purposes I would suggest to create a small script sample that opens existing project and tries to generate the texture. Something like the following:

Code: [Select]
import Metashape
doc = Metashape.Document()
doc.open(path) #path to the existing Metashape project file
chunk = doc.chunk #active chunk in the project
if not chunk.model:
    print("no active mesh model in the project")
else:
    chunk.buildUV()
    chunk.buildTexture()
    print("done")
Best regards,
Alexey Pasumansky,
Agisoft LLC