Forum

Author Topic: buildTexture with subset of cameras  (Read 3679 times)

edz

  • Newbie
  • *
  • Posts: 11
    • View Profile
buildTexture with subset of cameras
« on: January 29, 2020, 09:52:14 PM »
buildTexture has a parameter called cameras, the documentation only states it is a list of ints. I just want to double check that those are indices to cameras in the same order as chunk.cameras ? I have both grayscale and color cameras, and I want to use only color cameras for texturing. I'm using the following code to select color cameras:

    list_of_cameras_for_texturing = [i for i,c in enumerate(chunk.cameras) if 'CUCAU' in c.label]
    chunk.buildUV(mapping_mode=Metashape.GenericMapping)
    chunk.buildTexture(blending_mode=Metashape.MosaicBlending, cameras=list_of_cameras_for_texturing, texture_size=8192)


This seems to only work only "sometimes". I have got textures build from the other (grayscale) cameras. I am still trying to figure why.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15247
    • View Profile
Re: buildTexture with subset of cameras
« Reply #1 on: January 30, 2020, 10:07:25 AM »
Hello edz,

I can suggest the following way of selecting the cameras:
Code: [Select]
list_of_cameras_for_texturing = [camera.key for camera in chunk.cameras if 'CUCAU' in camera.label]

An alternative way is disabling all the cameras except those that you wish to use for texturing, blending the textures and then enabling the disabled cameras back.
Best regards,
Alexey Pasumansky,
Agisoft LLC

edz

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: buildTexture with subset of cameras
« Reply #2 on: February 09, 2020, 09:29:55 PM »
Thanks, this explains why my results were inconsistent. It would be great to mention camera.key in the documentation for buildTexture.