Forum

Author Topic: Print amount of aligned images to console.  (Read 588 times)

Stefan T.

  • Newbie
  • *
  • Posts: 2
    • View Profile
Print amount of aligned images to console.
« 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

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13990
    • View Profile
Re: Print amount of aligned images to console.
« Reply #1 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.
« Last Edit: June 20, 2022, 06:11:05 PM by Alexey Pasumansky »
Best regards,
Alexey Pasumansky,
Agisoft LLC

Stefan T.

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Print amount of aligned images to console.
« Reply #2 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?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13990
    • View Profile
Re: Print amount of aligned images to console.
« Reply #3 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.
Best regards,
Alexey Pasumansky,
Agisoft LLC