Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: mankoff on April 26, 2016, 06:57:39 PM

Title: Adding photos to CameraGroup
Post by: mankoff on April 26, 2016, 06:57:39 PM
Hi,

I can add photos to a chunk with chunk.addPhotos(file_list). Is there a way to add images to a group? The group is created with group = chunk.addCameraGroup().
Title: Re: Adding photos to CameraGroup
Post by: Alexey Pasumansky on April 26, 2016, 07:22:18 PM
Hello mankoff,

You can use the following code as a reference:

Code: [Select]
group = chunk.addCameraGroup()
camera = chunk.cameras[0]
camera.group = group

If you need to "ungroup" the camera, then pass None to camera.group.

Title: Re: Adding photos to CameraGroup
Post by: mankoff on April 26, 2016, 08:43:26 PM
Code: [Select]
camera = chunk.cameras[0] results in
Code: [Select]
IndexError: list index out of range
Title: Re: Adding photos to CameraGroup
Post by: mankoff on April 26, 2016, 08:58:29 PM
Nevermind, I figured it out. To move the last photo into a group that has been created, I do the following.

Code: [Select]
    group = chunk.addCameraGroup()
    for img in image_list:
        chunk.addPhotos([img])
        camera = chunk.cameras[-1]
        camera.group = group