how to apply a pixelmath expression through a mask over a set of images

lucchett

Well-known member
Hi,
I have 50 frames.
I need to apply the "&T+0.001" through a mask that select a dust mote in all frames, using the same mask.

i can apply the pixelmath formula with an Image container but how can I apply the mask first?


Thanks a lot
Andrea
 
i think the following works: open one of your images and apply the mask, then apply the pixelmath to the image. then load the history explorer from the modified image, and drag the triangle of the history explorer window to the desktop. then apply the ImageContainer to the resultant process icon (or vice versa) and i believe the mask will be applied to each image in the image container. i just tested it and it seems to work. the mask has to still be open on your workspace, though.

rob
 
Hi Rob,
it seems it doesn't work in this way, but I've just found an old comment from Juan .

The solution he gave it is very close to what you propose:

----....
If you want to create a new ProcessContainer with masks from scratch, this requires a bit of a hack:

- Open or create your mask image. Set its identifier to "mask" (for example).

- Open ProcessContainer and add the process that you want to apply.

- Click the Edit Instance Source Code button on the control bar at the bottom.

- Type this at the bottom of the source code (create a new line by pressing Enter at the end of the code):

P.setMask( 0, "mask" );

This assigns "mask" to the first process instance in the ProcessContainer.

- Click the green check mark icon at the top of the code editor window to commit the changes.

- Create a ProcessContainer icon (blue triangle, etc.)

- Open ImageContainer and add the images that you want to process.

- Drop the ImageContainer instance to the ProcessContainer icon.

-------
I have tried and it works.
Thanks a lot for the hint!
Andrea
 
well before posting the answer i did try it and it appeared to work fine, so i don't know what happened...? juan's example seems to be letting you add a mask to a line of a process container that did not already have a mask, so it seems to be the same thing...?

rob
 
Another option would be to build the mask logic into the PixelMath expression, so something like "iif(dust_mote_mask,$T+0.001,$T)" assuming a non-zero value for mask positions matching the dust mote.
 
Rob,
I will try again , may be I did it wrong.
The approach proposed by Rick is also very nice.

thank you both for your quick help!
Andrea
 
Rob,
you were right.
Applying the process explorer extracted from the first image works (actually writes the same line of code at the end).
Applying the triangle of history explorer directly on the Image container doesn't work, and I believe that was my mistake.

Thank you
Andrea
 
ah - ok. there are some subtle things going on with masks and image histories. i think there are situations (like you found) where masks do not get applied when you are executing image histories. i still don't have a good mental model of this.

rob
 
Back
Top