Forum

Author Topic: Multiframe chunks with different numbers of images  (Read 1636 times)

Evan

  • Newbie
  • *
  • Posts: 2
    • View Profile
Multiframe chunks with different numbers of images
« on: March 20, 2019, 11:43:56 PM »
Hello,

I'm working on a Python script to create a multiframe chunk, and it works as long as there are the same number of images for each frame (see code example below). I'd like the script to be flexible enough to work even if some of the frames don't have as many images as the others (for example, if there was an instant when one of the cameras didn't successfully capture an image).

When there are some missing images in some of the frames, the resulting chunk has fewer frames that it should. I've tried creating blank placeholder images for frames that are missing one or more images (they're the same size as others but all white and with Exif date/time values set to that frame's date/time), but Metashape seems to force them all into the last frame, regardless of naming convention or implanted Exif date/time values.

Is it possible to build a multiframe chunk with different numbers of images in each frame? I'm imagining telling Metashape which images belong to which frame, but I couldn't find anything like that in the API. Is there a way to tell Metashape which image files belong to each frame? Or is there a way to format placeholder images so they'll stay in the correct frames without having them be forced in to the last frame?

Here's the relevant part of the code I've been working with (photo_list_df is a 2D array of image files with a 'row' for each frame and columns for each camera):

Code: [Select]
doc = Metashape.app.document
chunk = doc.addChunk()
chunk.label = 'Multiframe'
# Add photos to Metashape one camera at a time
for i in range(len(cameras)):
photoList = [row[i+1] for row in photo_list_df][1:]
photoList = [os.path.join(folderPath, element) for element in photoList]
chunk.addPhotos(photoList, Metashape.MultiframeLayout)

Any help is appreciated, thank you!