Forum

Author Topic: 2.2.0 BUG in `cameras` argument for xportCameras() with CamerasFormatXML?  (Read 1180 times)

jedfrechette

  • Full Member
  • ***
  • Posts: 140
  • Lidar Guys
    • View Profile
    • www.lidarguys.com
I think Metashape version 2.2.0 may contain a bug in the usage of the `cameras` argument to exportCameras() that was added in version 2.1.3 for exporting a subset of a chunk's cameras.
 
If I want to export just the first 4 cameras in a chunk I would expect to write:

Code: [Select]
chunk.exportCameras("test_cams.xml", cameras=chunk.cameras[:4])
When I run that snippet the console reports the correct ids of the first 4 cameras in the chunk and seems to complete successfully, however, the resulting xml file still contains all of the cameras in the chunk.

Maybe this is just an issue with the default CamerasFormatXML though as writing to CamerasFormatABC or CamerasFormatFBX seems to correctly filter the cameras. I have not tested any of the other export formats. Note that using the class Metashape.Tasks.ExportCameras instead of chunk.exportCameras() also exhibits the same behavior.
Jed

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Hello Jed,

You need to pass list of int that contain unique camera.key identifier:
Code: [Select]
cameras = [c.key for c in chunk.cameras[:4]]
Best regards,
Alexey Pasumansky,
Agisoft LLC

jedfrechette

  • Full Member
  • ***
  • Posts: 140
  • Lidar Guys
    • View Profile
    • www.lidarguys.com
Hi Alexey,

Explicitly passing the list of keys as you suggest produces the same result as passing the camera objects and letting them be implicitly converted to keys by the method. In both cases, the exported Alembic and FBX files contain the correct subset of cameras but exported XML files contain all of the cameras in the chunk.

Best,
Jed