Page 1 of 1

Reducing halos on major edges in AS (semi-interactively)

Posted: February 20th, 2014, 10:39 am
by tomczak
In AS (sharpen tab), high frequency features, such as noise, can be protected from being sharpened by using lower roughness thresholds (i.e. black and withe sliders under the roughness histogram). There is no upper threshold control (i.e. everything 'rougher' than the withe slider threshold gets effectively sharpened), which often makes it difficult to properly sharpen an image without ruining the picture with ugly halos on major contrasty edges.

The following procedure helps minimizing such halos in a relatively simple single semi-automatic setup:

1) open the Mask dialog and create a texture mask (I.e. edge mask with more controls), blur this mask,

2) open the AS with the mask loaded - flip white and black Amount sliders (Ctrl + Select Amount Mask button) so that the halo-producing edges are masked (and thus not sharpened); sharpen through the mask.

The process is semi-automatic in that the Mask Control Dialog can be kept open along with AS dialog, allowing to adjust the mask and AS parameters concurrently (with the goal of protecting from being sharpened both: low frequency noise with AS roughness threshold sliders and the major, halo-producing edges with the edge mask).

NB. using edge mask to protect edges is a little different from roughness threshold in AS: the former excludes masked input pixels from being replaced by the output pixels, the latter excludes pixels ''smoother' (and potentially 'rougher') than the set threshold from contributing to the sharpening neighborhood kernel calculations for each pixel being sharpened (at least this is how I understand it).

Re: Reducing halos on major edges in AS (semi-interactively)

Posted: February 22nd, 2014, 1:01 pm
by tomczak
This may be a useful when using the method above:

- the edge mask doesn't have to be blurred at all or can be blurred only slightly (radius=1 or 2) to be most effective - it just needs to cover major visible halos; blurring the edge mask too much will 'misalign' and/or water down the mask and will fail to dampen the halos.

- threshold sliders under texture histogram in Mask control panel are v. useful in constructing the proper edge mask so that it actually covers those halos and not much more.

- the texture mask's Method set to 'difference from average' works well for covering halos, which makes sense to me as this methods seems to follow similar calculations as in the USM-style sharpening: it compares the central pixel value with a (weighted?) average the neighborhood's pixels values.

- regardless of the edge construction method, the edge mask is likely to be just an approximation of the oversharpened halos (as it merely tries to crudely mimic what the upper roughness threshold slider could potentially exclude from sharpening), and may either miss some of them or impede sharpening elsewhere too much. This is because the AS and the Texture Mask define 'edges' differently (see NB above) and what's being over-sharpened and what's masked may not overlap.

- despite its relative simplicity, the setup advocated above requires a bit of work to adjust properly.

Re: Reducing halos on major edges in AS (semi-interactively)

Posted: February 22nd, 2014, 11:45 pm
by tomczak
Here is the illustration of the setup:

From left to right, clockwise: output preview window, input window (with mask in red), texture Mask control window, AS (sharpen tab) control window.

Note: this method tries to block halos on major edges that AS can produce. It does not separate white and black overshoots - reducing only one of them (typically white halos on the bright side of the edge, as in this example) could make the sharpening even more effective, and the image more pleasing overall.

This is possible, but requires additional steps (compositing sharpened image with the unsharpened original in 'darken' mode). This will take away the bright part of the halos, but for all sharpened elements of the image, not just the major edges - to take out only white halos, only on major edges, a major-edge mask (same as above) can be used in the Composite.

Re: Reducing halos on major edges in AS (semi-interactively)

Posted: March 30th, 2014, 4:01 pm
by den
This is an addendum to Maciej's discussion above with additional illustrations resulting from a recent intense series of experiments of PWPro 32 v7.0.12's Advanced Sharpen - Sharpen tab...

...the following seems to be reasonably generic for 3456x2304 pixel, 48-bit color, nature landscape images with fine [small] detail...

While the suggested major edge mask does not separate and make adjustable the edge dark/light undershoot/overshoot:
...it does provide a gradient from the major edge with the largest contrast to edges with lesser contrasts within the selected edge threshold range where the black slider sets threshold and the white slider adjusted to the right most end of the histogram provides the largest to lesser edge contrast gradient...
...if the Mask tool - Texture's Neighborhood Size is set to the AS-Sharpen Radius, then the masked edge widths are nearly that of the edge pixels affected by AS...
...preserves the AS sharpening effect to the majority of the Input image areas represented to the left of the black slider's histogram Threshold setting...
...allows setting the AS sharpening effect to the major edges to a lesser amount where the dark/light undershoot/overshoot will not be objectionable...

The illustrated AS - Sharpen tab settings are my 'Save As Default' settings:...
...Sharpen Radius 5; Sharpen Amount 50; Threshold (black slider) just to the right of the histogram peak; and Blend (white slider) pointer beneath the Threshold bottom right corner...

These initial settings will generally produce an over sharpened Preview [1:1 Zoom factor to avoid anti-aliasing artifacts] image whose minor/major edge contrasts amounts can be reduced to preference using the black/white AS transform Amount sliders when the 'active' mask is selected...

Perhaps to be more technically correct the suggested major Edge mask should be applied to the Extract-ed RGB-Luminance channel of the AS Input image rather than the Mask Tool - Brightness Curve's starting image's HSV-Value histogram but this is a nuance that will go largely un-noticed for most photo-realistic images...

The attached illustrations show a 1:1 Zoom factor IMG_0991 [Lower Yellowstone River Falls & Canyon] image area crop at a 70-75% jpeg compresion for posting... ...the bottom illustration shows a Preview where both mask black = mask white = 100 or 'No Mask'.

...den...

Re: Reducing halos on major edges in AS (semi-interactively)

Posted: April 5th, 2014, 10:17 am
by tomczak
There is another method that can simulate upper roughness threshold in AS Sharpen tab:

1) Use AS Noise Reduction Tab (not Sharpen), blur the image while protecting major edges with (upper) roughness threshold sliders: what's blurred will become sharpened.
2) Subtract the blurred version from the original in offset mode
3) Composite the original with the latter in Soft/Hard Light mode.

Hard Light is probably closer then Soft Light in the last step, when trying to mimic what AS Sharpen would do natively.