EdgeExtend

EdgeExtend allows you to correct unpremultiplied foreground color at the edge of soft mattes by eroding or dilating the sample region, pulling pixels from deeper inside or outside your matte. The algorithm behind the node works independent of the size of the fill regions you are trying to extend. You can also output and edge mask to allow you to work on the edges separate from the rest of the image. A typical use case might be adjusting a matte to account for motion blur.

Inputs and Controls

Connection Type

Connection Name

Function

Input

 

Matte

Controls which areas of the image are affected using the alpha channel or luminance.

Source

The image sequence to which the effect is applied.

Control (UI)

Knob (Scripting)

Default Value

Function

EdgeExtend Tab

Local GPU

gpuName

N/A

Displays the GPU used for rendering when Use GPU if available is enabled. Local GPU displays Not available when:

Use CPU is selected as the default blink device in the Preferences.

no suitable GPU was found on your system.

it was not possible to create a context for processing on the selected GPU, such as when there is not enough free memory available on the GPU.

You can select a different GPU, if available, by navigating to the Preferences and selecting an alternative from the default blink device dropdown.

Note:   Selecting a different GPU requires you to restart Nuke before the change takes effect.

Use GPU if available

useGPUIfAvailable

enabled

When enabled, rendering occurs on the Local GPU specified, if available, rather than the CPU.

Note:  Enabling this option with no local GPU allows the script to run on the GPU whenever the script is opened on a machine that does have a GPU available.
You should also select this if you wish to render from the command line with the --gpu option.

See Nuke 15 Release Notes for more information on the GPUs Nuke supports.

Channels

channels

rgb

The effect is only applied to these channels.

If you set this to something other than all or none, you can use the checkboxes on the right to select individual channels.

Matte

matte

Source Alpha

Where the foreground matte is taken from to limit the effect when eroding or dilating the edges:

None - do not use a matte.

Source Alpha - use the alpha of the Source input.

Source Inverted Alpha - use the inverted alpha of the Source input.

Matte Luminance - use the luminance of the Matte input.

Matte Inverted Luminance - use the inverted luminance of the Matte input.

Matte Alpha - use the alpha of the Matte input.

Matte Inverted Alpha - use the inverted alpha of the Matte input.

Source Is Premultiplied

sourceIsPremultiplied

disabled

When enabled, EdgeExtend assumes that the image connected to the Source input is premultiplied.

When disabled, no premultiplication is assumed.

Erode

erode

0

Controls the amount of erosion or dilation applied to the Matte area. Negative values dilate the matte and positive values erode the matte.

Detail Amount

detailAmount

1

Controls how much of the original high frequency detail and noise is recovered after eroding or dilating the matte region.

Output

Edge Mask

edgeMaskChannel

disabled

When enabled, output an edge mask to the selected channel. This allows you to work on the mask separately to the rest of the image and then merge the result back into the pipeline.

Premultiply

premultiply

enabled

When enabled, EdgeExtend premultiplies the output image.

When disabled, no premultiplication is applied.

Step-by-Step Guides

Correcting Foreground Color Using EdgeExtend