Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - skearney

Pages: [1]
1
Python and Java API / Applying Masks to MultiframeLayout Images
« on: April 28, 2018, 10:27:59 PM »
Hello,

I'm trying to figure how to apply a different mask to each frame in a MultiframeLayout (ie, I have one camera, with N frames). My code is something like this:

Code: [Select]
listOfImages = [...] # images loaded from 'myPath/images/______.png'
chunk = PhotoScan.app.document.addChunk()
chunk.addPhotos(listOfImages, PhotoScan.MultiframeLayout)

pathToMasks = 'myPath/masks/{filename}_mask.png'

#attempt1
cam = chunk.cameras[0]
chunk.importMasks(path=pathToMasks, cameras=[cam], source=PhotoScan.MaskSource.MaskSourceFile)

#attempt2
chunk.importMasks(path=pathToMasks, cameras=chunk.cameras, source=PhotoScan.MaskSource.MaskSourceFile)

This will apply the mask to the first frame only, and no mask appears on the rest of the frames. If I select the following, in the GUI, it works as expected but I can't replicate this in python:
File -> Import -> Import Masks:
 - Apply to: All Cameras
 - Filename Template: {filename}_mask.png
 - Frames: All Frames

I don't see a way to replicate the "Frames" section in the GUI in python i.e. whether to apply to "All Frames", "Current Frame" or "custom range". I am using Photoscan 1.4.0.

Pages: [1]