Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: Chris_1979 on March 12, 2021, 01:51:02 PM

Title: Adding Images from list to two Groups
Post by: Chris_1979 on March 12, 2021, 01:51:02 PM
Hi There,

I have been using the attached script with Metashape version 1.5.5 for the past couple of years. I recently updated to 1.7.1 and the script no longer works. I think I fixed one issue with the the way I was loading the XML calibration file, but I think it's now failing on the chunk.addPhotos(image_list).

Do I need to add the extra arguments (filegroup, and image layout)? If so, how should I do that?

Kind Regards,
Chris
Title: Re: Adding Images from list to two Groups
Post by: Alexey Pasumansky on March 13, 2021, 02:18:54 PM
Hello Chris,

Please try to include an additional argument to addPhotos method:
Code: [Select]
chunk.addPhotos(image_list, strip_extensions=False)
Does it solve the problem?
Title: Re: Adding Images from list to two Groups
Post by: Chris_1979 on March 13, 2021, 08:02:37 PM
Hi Alexey,

Unfortunately that didn't fix it either. Also tried setting it to True.

When I run the script through the console, I get the error in the attached image.

Any suggestions?

Kind Regards,
Chris

Title: Re: Adding Images from list to two Groups
Post by: Alexey Pasumansky on March 13, 2021, 11:20:41 PM
Hello Chris,

You may need to replace the "map" line (#40) with the following line:
Code: [Select]
image_list = [image.strip() for image in image_list]
Also make sure that the paths use either "slash" symbol or double-"backslash".
Title: Re: Adding Images from list to two Groups
Post by: Chris_1979 on March 15, 2021, 02:11:34 PM
Hi Alexey,

Thank you for this. It helped a lot.

Kind Regards,
Chris