Forum

Author Topic: addPhotos in Metashap 1.6.0 RuntimeError: Can't load photos  (Read 2489 times)

空空

  • Newbie
  • *
  • Posts: 22
    • View Profile
addPhotos in Metashap 1.6.0 RuntimeError: Can't load photos
« on: December 02, 2019, 11:02:47 AM »
hello everyone,
 I run this script in Metashap 1.5.2 is ok,but run in Metashap 1.6.0 is error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
RuntimeError: Can't load photos

import Metashape
doc=Metashape.app.document
chunk=doc.chunk
rgb=[r'd:\p\1.jpg',r'd:\p\2.jpg']
nir=[r'd:\p\3.jpg',r'd:\p\4.jpg']
images=[[rgb[0],nir[0]],[rgb[1],nir[1]]]
chunk.addPhotos(filenames=images,layout=Metashape.MultiplaneLayout)

can you help me? thank you very much

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14004
    • View Profile
Re: addPhotos in Metashap 1.6.0 RuntimeError: Can't load photos
« Reply #1 on: December 02, 2019, 03:27:15 PM »
Hello,

In the version 1.6.0 the approach of loading images for multi-camera systems is slightly different.
For the filenames argument you should pass the plain list of the filenames, and for filegroups the list of int, where each number represents the number of sensors in each group. The images assigned to the filegroups will be taken from the filenames list.

So in your case you can do the following:

Code: [Select]
images = [None]*(len(rgb) + len(nir))
images[::2] = rgb
images[1::2] = nir
filegroups = [2]*(len(images)//2)
#images is alternating list of rgb, nir paths
#filegroups defines the multi-camera system groups: [2, 2, 2, ....]

chunk.addPhotos(filenames = images, filegroups = filegroups, layout=Metashape.MultiplaneLayout)


Best regards,
Alexey Pasumansky,
Agisoft LLC