Page 1 of 1

Comp Mask Threshold

Posted: January 20th, 2023, 7:16 pm
by Marpel
I just typed out a long post, but when I pressed Submit, I received a message "The site can't be reached" and it was not posted, so this may be a duplicate.

Trying to replace a sky in an image with one from another image.

Used Composite with a mask on the Input image (both taken at different times one morning at Oxbow Bend, Tetons). Because the skies are markedly different, I am running into a proper blending because a line (showing the Input sky) follows the edges of the mountains. So tried using Threshold and Feathering. However, because the Input image sky varies in tone/color, I used Flood Fill and shift + clicked through the sky until all was captured.

The problem with this method, is after one location is clicked on, any additions by shift + clicking prevents threshold and feathering to be applied to the previous area. I also like to watch the Output image side to assess the amount of these two tools as it is more difficult to assess from the mask alone on the Input side. This results in most of the sky changing, except the last piece which will not show the change unless another shift + click follows or the running man is clicked. That then prevents the use of threshold as that slider disappears.

So, is there a way to shift + click throughout the image and once all is captured, the threshold/feathering can be applied to the entire edge(s)?

Marv

Re: Comp Mask Threshold

Posted: January 21st, 2023, 8:11 am
by jsachs
The Flood Fill tool threshold setting is applied independently to each control point you add, so there is no way to apply a global threshold. There is of course the separate Feather tool.

Also, if you want to avoid having to finalize to update the output image, you can use the Update Transformation with Mask setting in the Mask Settings menu.

An alternative to using Flood Fill is the Separate mask tool. You select up to 4 different typical colors in the sky and 4 from the tree line and it builds a mask based on how close each pixel is to one of these colors. This usually makes a pretty good mask.

Sky replacement is a difficult problem that I have been planning to work on for a future release. Even with the perfect mask, you can still get artifacts at the edges since the pixels on the border contain a mixture of the sky and the non-sky. The way to make this work properly is to split the image into a foreground, background and mask which is a problem known in the literature as image matting. The foreground and background images are created by extrapolating the sky and non-sky regions across the edge of the mask. You can try doing this manually by creating two copies of the original image. In one version you clone the sky over the tree line and in the other you clone the non-sky over the tree line in the other direction. Then use your mask to composite the two images.

Re: Comp Mask Threshold

Posted: January 21st, 2023, 12:36 pm
by Marpel
Jonathan,

Thanks for the detailed reply. I will give all of your suggestions a try, perhaps starting with Separate.

Marv

Re: Comp Mask Threshold

Posted: February 2nd, 2023, 5:27 pm
by Robert Schleif
I am pretty used to adding points on curves by shift-clicking and removing points by control-clicking them. Is there a reason why the same couldn't be used when adding or subtracting colors in the mask separate based on 2 colors tool?

Re: Comp Mask Threshold

Posted: February 2nd, 2023, 6:27 pm
by jsachs
Maybe if the locations of where you clicked on the input image were recorded and displayed as control points, then you could move them around or add or delete them.

Re: Comp Mask Threshold

Posted: February 2nd, 2023, 7:26 pm
by Robert Schleif
That sounds like a very useful improvement.