O_FocusMatcher

O_FocusMatcher is designed to correct subtle focus differences that are sometimes present between the left and right views of a stereo image. It does this by matching the focus distribution of one view to the other, based on the disparity vectors upstream.

Inputs and Controls

Connection Type

Connection Name

Function

Input

Source

A stereo pair of images. If disparity channels and occlusion masks are not embedded in the images, you need to insert an O_DisparityGenerator and an O_OcclusionDetector node after the image sequence.

Mask

An optional mask that determines where to perform the focus matching calculation.

Control (UI)

Knob (Scripting)

Default Value

Function

O_FocusMatcher 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 GPU 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 Device, if available, by navigating to the Preferences and selecting an alternative from the GPU 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 14 Release Notes for more information on the GPUs Nuke supports.

Views to Use

viewPair

Dependent on source

Sets the two views whose colours you want to match. These views will be mapped for the left and right eye.

Match

matchWhat

Left to Right

Allows you specify the direction in which to perform the focus match in:

Left to Right - Deblur or rebuild the left view to match the right.

Right to Left - Deblur or rebuild the right view to match the left.

Mode

matchingMode

Local Matching

Sets the mode to use to perform the focus match:

Match Edges - matches the appearance of the edges from one view to the other. If you want to preserve the original image structure, it is recommended to use this mode. If the blurring in your input images is subtle, the Match Edges mode may produce the best possible result.

Reconstruct Edges - rebuilds the edges in one view from scratch using the pixels from the other. If you want to rebuild focus exactly, or if the blurring in your image is heavy or varying, it is recommended that you use this mode. The result of this mode depends on the accuracy of the existing disparity vectors.

Mask

maskWith

None

Sets areas in the image that you want to ignore when calculating the focus calculation. In the O_FocusMatcher controls, set Mask to the component you want to use as the mask. The following Mask settings are available:

None - use the entire image area.

Source Alpha - use the alpha channel of the Source clip as a mask.

Source Inverted Alpha - use the inverted alpha channel of the Source clip as a mask.

Mask Luminance - use the luminance of the Mask input as a mask.

Mask Inverted Luminance - use the inverted luminance of the Mask input as a mask.

Mask Alpha - use the alpha channel of the Mask input as a mask.

Mask Inverted Alpha - use the inverted alpha channel of the Mask input as a mask.

Local Matching

Edge Scale

scale

3

Allows you to scale the edges where focus matching is performed. To restrict matching to sharp edges, use a small scale value. To match wider edges in the image, increase the scale value.

Strength

strength

1

Sets the amount of focus correction to apply. Set this to 0 for no correction, or 1 for complete correction.

Noise

noiseLevel

0.25

Allows you to preserve the noise of the original image when using the Reconstruct Edges mode. To ignore noise, set this control to a low value. This matches the focus of fine details and can reconstruct noise from the other view. To retain as much of the original noise as possible, use higher values. This ensures that noise is not coherent between views, but may not match the focus at fine details in the image.

Occlusions

Output corrected area to alpha

outputOcclusions
ToAlpha

disabled

When enabled, output the corrected area to the alpha channel. The corrected area can consist of the occlusion mask and the disparity edge mask set using the Adjust Edges control, depending on what the Correction control is set to (Occlusions, Occlusionsand Edges, or None).

Correction

occlusionCorrection

Occlusions

Defines which areas receive the focus correction when local focus matching is not valid:

Occlusions - fill occluded pixels only, where colour is missing from the other view.

Occlusions and Edges - fill occluded pixels, where colour is missing from the other view, and compensate for disparity changes at edges where matching can fail.

None - apply no occlusion or edge correction.

Adjust Edges

adjustEdges

0

Allows you to set the threshold for treating image edges as occlusions to reduce haloing and edge flicker. The higher the value, the more image edges are considered occlusions, even if they aren’t marked as such in the upstream occlusion mask.

Colour Tolerence

colourTolerance

0.1

Allows you to set the amount of blurring across edges in the focus match at occluded regions. Decrease this to restrict the colour correction in occluded regions to similar colours. Increase the value to blur the focus correction.

Support Size

supportSize

20

Sets the size of the region (in pixels) of unoccluded pixels used to calculate the focus correction at a corrected pixel.

Stabilise Occlusion

stabiliseOcclusions

disabled

When enabled, flicker can be reduced in occluded areas by using data from multiple frames.