Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: naren951 on August 17, 2021, 05:29:10 PM

Title: Chunk Workflow Status
Post by: naren951 on August 17, 2021, 05:29:10 PM
Is there a way to know what are all the operations that have been performed on the Chunk using the Python API?

For Example: Let's say we perform chunk.matchPhotos() and Chunk.alignPhotos(), is there a way to know these 2 operations were performed.
Title: Re: Chunk Workflow Status
Post by: Alexey Pasumansky on August 17, 2021, 08:49:00 PM
Hello naren951,

You can check, if the corresponding assets exist in the chunk:
chunk.point_cloud, chunk.depth_maps, chunk.dense_cloud, chunk.model, chunk.elevation, chunk.orthomosaic, chunk.tiled_model.
then access it's meta information:
chunk.meta, chunk.point_cloud.meta, chunk.dense_cloud.meta and etc. it contains the information about the processing parameters used and time spent on the corresponding processing stage.
Title: Re: Chunk Workflow Status
Post by: naren951 on August 18, 2021, 03:43:55 PM
Thank you so much Alexey Pasumansky, is there a way to know if alignCameras and matchPhoto has been executed before?
Title: Re: Chunk Workflow Status
Post by: Alexey Pasumansky on August 18, 2021, 04:06:42 PM
Hello naren951,

If there's no tie point cloud in the chunk (chunk.point_cloud == None), then it means that image matching hasn't been performed. If it exists, you can check for the meta-information that I have previously mentioned.

In case camera alignment hasn't been performed, camera.transform for all cameras in the chunk should be None as well (i.e. all cameras are not aligned).
Title: Re: Chunk Workflow Status
Post by: naren951 on October 13, 2021, 09:03:51 AM
Is there a way to know if build texture has been run?
Title: Re: Chunk Workflow Status
Post by: Alexey Pasumansky on October 13, 2021, 12:27:03 PM
Hello naren951,

The following code returns the types of the generated textured for the model, if at least one texture exists:

Code: [Select]
if chunk.model.textures:
    for texture in chunk.model.textures:
        print(texture.type)
else:
    print("no textures for model")