Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: Stefan T. on June 20, 2022, 01:01:33 PM

Title: Print amount of aligned images to console.
Post by: Stefan T. on June 20, 2022, 01:01:33 PM
Hello,
is there a way/command to print the amount of aligned images to the console? In my Python scirpt I loop over several folders and conduct an alignment and it would be nice to have a overview in the end how much images were aligned for each folder.
Thanks
Title: Re: Print amount of aligned images to console.
Post by: Alexey Pasumansky on June 20, 2022, 01:39:01 PM
Hello Stefan,

This code lines should output the labels of the aligned cameras:
Code: [Select]
aligned = [camera for camera in chunk.cameras if camera.transform and camera.type==Metashape.Camera.Type.Regular]
for c in aligned:
    print(camera.label)
If you need also to distinguish between some groups of cameras, you may consider camera.group value (providing that the cameras are put to some groups in the chunk contents), or check camera.photo.path - the path to the source images.
Title: Re: Print amount of aligned images to console.
Post by: Stefan T. on June 20, 2022, 04:01:41 PM
Hello Alexey,
thank you for the quick answer. But unfortunately I get an attribute Error:
AttributeError: 'Metashape.Camera' object has no attribute 'aligned'
Can you help me?
Title: Re: Print amount of aligned images to console.
Post by: Alexey Pasumansky on June 20, 2022, 06:10:55 PM
By bad, the correct code:

Code: [Select]
aligned = [camera for camera in chunk.cameras if camera.transform and camera.type==Metashape.Camera.Type.Regular]
for c in aligned:
    print(camera.label)

Also fixed in the previous post, to avoid confusion for other readers.