Forum

Author Topic: Metashape processing of multispectral data - addPhotos() arguments  (Read 6481 times)

gollerb

  • Newbie
  • *
  • Posts: 1
    • View Profile
Metashape processing of multispectral data - addPhotos() arguments
« on: September 06, 2024, 09:14:14 PM »
The API documentation has an example where addPhotos() for multispectral input data receives a list of image file paths (all images for location/timestamp 0001, then all images for 0002, etc), a list with the number of cameras per group (filegroups), and Metashape.MultiplaneLayout. When using the GUI, Metashape is able to detect the number of cameras, and group the images, without manual entry of something like the filegroups. A example set of filenames is provided below:
DJI_20240823114949_0001_D.JPG
DJI_20240823114949_0001_MS_G.TIF
DJI_20240823114949_0001_MS_NIR.TIF
DJI_20240823114949_0001_MS_RE.TIF
DJI_20240823114949_0001_MS_R.TIF
DJI_20240823114952_0002_D.JPG
DJI_20240823114952_0002_MS_G.TIF
DJI_20240823114952_0002_MS_NIR.TIF
DJI_20240823114952_0002_MS_RE.TIF
DJI_20240823114952_0002_MS_R.TIF

What is the default behavior of addPhotos() for multispectral input like this? - I have tried it without the filegroups argument and it proceeds without an error or warning. Is the filegroups argument really necessary or does addPhotos generally work for the imageBaseFileName_channel.tif format filenames? Thank you!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: Metashape processing of multispectral data - addPhotos() arguments
« Reply #1 on: September 30, 2024, 12:11:34 PM »
Hello gollerb,

Please check, if the approach similar to the second one described here works for you:
https://www.agisoft.com/forum/index.php?topic=14453.msg63627#msg63627


Code: [Select]
camera = [list_of paths_camera1, list_of_paths_camera2, list_of_paths_camera3, list_of_paths_camera4, list_of_paths_camera5, list_of_paths_camera6, list_of_paths_camera7, list_of_paths_camera8, list_of_paths_camera9, list_of_paths_camera10]
### list_of_paths_cameraN represent the list of paths for corresponding source folder
​C = len(camera)
images = [None]*(len(camera[0]) + len(camera[1]) + len(camera[2])  + len(camera[3])  + len(camera[4])  + len(camera[5]) + len(camera[6])  + len(camera[7]  + len(camera[8]  + len(camera[9]))
for i in range(C):
    images[i::C] = camera[i]
filegroups = [C]*(len(images)//C)
###images is alternating list of camera[0], camera[1] ... camera[9] paths
###filegroups defines the multi-camera system groups: [10, 10, 10, ....]
chunk.addPhotos(filenames = images, filegroups = filegroups, layout=Metashape.MultiplaneLayout)

For the code above you also need to define the paths (list_of_paths_cameraN) as paths to the images from the certain sensor.
Best regards,
Alexey Pasumansky,
Agisoft LLC