Masking

Moderator: jsachs

Post Reply
Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Masking

Post by Robert Schleif »

Sometimes I struggle when making a precise mask for an object whose boundaries and interior resemble so much of the rest of the image that the flood fill and texture mask operations work poorly. Either their operation is so spotty that the boundary has to be carefully outlined anyway or they generate mask pixels elsewhere in the image. It seems like an option to the flood fill tool could facilitate generating a mask in these cases. The option would be to restrict flood fill to adding mask pixels only within an adjustable sized circle centered around the cursor (and, of course, also satisfying the criterion of being sufficiently similar to the pixels at the cursor). With with such a capability, one could zoom in and move stepwise around the inside of the perimeter of the object to be masked generating a corridor of mask on much of the edge of the object. Then one could complete the masking using the usual mask tools.
jsachs
Posts: 4270
Joined: January 22nd, 2009, 11:03 pm

Re: Masking

Post by jsachs »

There are a couple of masking tools that may work better than flood fill or texture mask...

1) Use the Mask Paint tool, with Apply To set to Similar Pixels (track). When you paint around the outside of an object, this will paint only pixels that are similar to where the cursor is pointing. The similarity threshold is adjustable. This is usually a good way to paint around the edges of an object with an irregular boundary, as long as there is some difference in color between the object and its background. I think this pretty much does what you are suggesting as a new feature.

2) Use the Mask Separate tool. This lets you define up to 4 colors that are in the object and up to 4 colors that are in the background. These colors are used to infer the boundary between object and background. This works well if the set of colors in the object do not overlap the set of colors in the background, and both are fairly uniform.
Jonathan Sachs
Digital Light & Color
jfoster
Posts: 177
Joined: December 1st, 2011, 1:39 pm
What is the make/model of your primary camera?: Canon/5DMIII

Re: Masking

Post by jfoster »

I have also wished for an optional spacial restriction on the Flood-Fill tool. I will dig into the Mask Separate tool and see how that works.

Jeff
pierrelabreche
Posts: 480
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: Masking

Post by pierrelabreche »

For spatial restrictions, perhaps you could use the mask transformation, with the AND (&) operation where one of the masks is a spatial restriction.

Excerpt from the manual :
"One of the limits of Amount controls is that you can only have one mask per image. If you need to make more than one mask for an image, you can use the Masks transformation.
By default, the Masks transformation copies its input image through to its output image and lets you create up to four masks for the input image. These masks are then available to select into Amount control of other transformations. You also have the option of making one of the masks the output image or a combination of masks 1 and 2"
jsachs
Posts: 4270
Joined: January 22nd, 2009, 11:03 pm

Re: Masking

Post by jsachs »

You can apply a spatial restriction without resorting to the Masks transformation. Just switch the mask tool to Overlap mode and circle the area you want to force the mask to stay within.

However, I think what people are asking for is a spatial restriction that follows the seed location for flood fill. This would avoid regions being filled via connectivity that extends beyond a given radius centered on the seed location.
Jonathan Sachs
Digital Light & Color
Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Re: Masking

Post by Robert Schleif »

Mask paint sounds hopeful. Thank you for the suggestion.
Robert Schleif
Posts: 340
Joined: May 1st, 2009, 8:28 pm

Re: Masking

Post by Robert Schleif »

Wonderful, it does work as I had envisioned. It would be still nicer if, in addition to being able to undo the previous paint operation by clicking on the undo arrow in the mask window, the same undo could be triggered by right clicking the mouse.
jsachs
Posts: 4270
Joined: January 22nd, 2009, 11:03 pm

Re: Masking

Post by jsachs »

Right-click is already assigned, but the keyboard shortcut Ctrl-Z is convenient.
Jonathan Sachs
Digital Light & Color
Post Reply