I have experimented a bit with the Unsharp Mask, with the goal of improving two aspects:
- the filter sharpens all edges, even those which are already hard and sharp, leading to over-sharpening in some cases
- it tends to enhance the noise, because it also sharpens the textures that are very fine
The first point has also been addressed in DT by @anon41087856 and described here:
However, I realized that the edge-aware properties of the guided filter also allow to solve the second problem, that is sharpen textures while leaving the noise almost unchanged.
I have implemented an experimental âenhanced unsharp maskâ filter in PhotoFlow, currently only available in the enhanced-usm
branch:
Before going into the technical explanations, here are a couple of examples (details from the image from this PlayRAW):
Original
Standard USM with radius=4:
Enhanced USM with the same radius, using the settings of the first screenshot:
A detail of a smooth area with noise, from the same image:
Original:
Standard USM with radius=4:
Enhanced USM with the same radius:
What do you think? The noise is not completely preserved, but is much cleaner than in the standard USM case. Also, my impression is that the transitions between sharpened and not sharpened regions is sufficiently smooth to be naturalâŚ
Packages are available for download at the usual place.
@heckflosse you did quite some work on preserving smooth areas from sharpening. Would be interesting to compare the two approaches⌠do you have some test image that we could use for the comparison?
HOW DOES IT WORK?
The standard Unsharp Mask boils down to the following formula:
that is, the image is sharpened by adding to the original image I the difference between I and gaussian blurred version G(I), scaled by an amount parameter A.
Now letâs consider the Guided Filter. Simplifying a lot, the Guided Filter behaves as a Gaussian blur when the edges amplitude is below a given threshold, and preserves the original edges if they are larger than the threshold. That is:
for edges below the threshold, and
for edges above the threshold.
Now, what if we combine two Guided Filter output with the same radius and two different thresholds TL and TH?
Letâs consider three image areas:
- I_{1} is a smooth area, with noise that should not be sharpened
- I_{2} is a textured area, that needs to be sharpened
- I_{3} contains strong sharpe edges that do not need further sharpening
One has
and therefore
Putting everything together, one has
In summary, one can selectively sharpen an âedge amplitude bandâ by adding to the original image the difference of guided filters at two different thresholds!
EDIT: @David_Tschumperle might also be interested in thisâŚ