Tuesday, February 17, 2015

Edge sharpening with G'MIC "Gradient norm" and "Richardson-Lucy de-convolution" filters

Recently I've added two more G'MIC filters into PhotoFlow:

  1. The "Gradient norm" filter, which allows to identify the edges in an image and to create a convenient grayscale edge mask
  2. The "Richardson-Lucy de-convolution" filter for image sharpening, which generally yields better results than the standard Unsharp Mask technique
Combining both of them, it is possible to create a filter that selectively sharpens the image portions that are already "quite sharp", and leave untouched other smooth regions (like an out-of-focus background). The main interest of doing that is to avoid sharpening the noise in smooth areas. One can usually also increase the sharpening strength, because the effect is restricted by the edges mask. Moreover, the technique is not limited to the RL de-convolution filter, since the edge mask can be applied to any kind of sharpening tool. In PhotoFlow, you can currently choose between UnSharp Mask (USM) and RL de-convolution.

Below you can see the result of the edge masking filter, compared with the original image and a classic sharpening. For comparison, I've also added the output of edge-masked USM from PhotoFlow and RawTherapee, so that you can better compare the quality of the result with other existing open-source alternatives (it seems that there is no edge-masked sharpening available in Darktable for the moment).


Click type to see: Original - RL deconvolution sharpening - RL deconvolution edges sharpening - USM edges sharpening - USM edges sharpening (RawTherapee) - Edges mask

In this post I will not go into all details of how to create an edge-masked sharpening filter in PhotoFlow. Instead, I am providing a preset that automates the whole procedure, and I will only describe the few adjustment layers that have an impact on the output result (most of the layers in the preset are just buffers and copy operations). The screenshot below shows the preset in action, with some annotations that point to the relevant layers. The preset can be directly downloaded from here.


As you can see, the preset allows to directly visualize the edge mask being applied: for that, one has to select the "gradient norm" layer and activate the "show active layer" radio button below the preview area. Two parameters in the "Gradient norm" tool mainly control the generated mask: the "Threshold" value determines how much sharpening is applied in smooth areas, while the "Multiplier" value controls the amount of mask pixels that are purely white.

The "sharpening" layer lets you define the sharpening method (currently the standard Unsharp Maks and G'MIC "Richardson-Lucy de-convolution" are implemented) and its strength.

Finally, The "Halo control" group allows to optionally adjust the strength of the dark and light sharpening halos separately. I personally find that reducing the opacity of the light halos to 50% gives slightly better results.

The advantage of this approach is that the edge mask can be directly applied to any additional sharpening method that might be added in the future, and vice-versa new edge detection methods could be used to mask any of the existing sharpening filters.

Saturday, February 14, 2015

"Autumn at the National Rhododendron Gardens" edit - Part 2: more sky editing

In this second part of the step-by-step description of my final edit of the image in this google+ post of the "Open Source Edit my RAW" discussion group, I want to introduce another simple yet powerful technique for enhancing the sky in landscape pictures.

The technique consists in blending the "b" Lab channel with the original image in "Overlay" mode. Below you can see a comparison between the original image, the result of the previous step, the result of the "b" channel blend and the "b" channel itself.



Click type to see: Original - Step 1 result - "b" channel Overlay result - "b" channel

In the "b" channel, anything that contains some blue is below 50% and gets darkened in the overlay blend, while "yellowish" areas (including leaves and grass) are above 50% and result in lighter tones after blending. In order to keep the lightness of the tree and grass close to the original, I've added a slightly darkening tone curve to the Overlay blending input. The tone curve, as well as the settings for the "b" channel blend, can be seen in the screenshot below.



The nice thing with this technique and the one described in the previous post, is that the result is achieved using only the image data itself, without any masking. The effect is therefore very "natural", without any presence of disturbing halos in the transition areas.

In order to simplify the application of this steps, I've prepared a preset that automatically adds a group layer containing both the red channel blend and the "b" channel overlay. The preset can be downloaded from here
The technique turns out to be also quite powerful for haze removal. Below I have applied the preset to the RAW image shared in this google+ post (mouse over to see original image):


Saturday, February 7, 2015

"Autumn at the National Rhododendron Gardens" edit - Part 1: the sky

This post describes step-by-step how I've obtained the final edit of the image in this google+ post of the "Open Source Edit my RAW" discussion group. You can see the final result here.

When editing this picture I had few guiding ideas in mind:

  • the sky was too bright, and I wanted to obtain a more saturated blu tint as well as more contrast and "texture" in the clouds
  • the tree in the foreground is the main element of the composition, so I wanted to give it some "pop"
  • the scene gave me a "late afternoon" feeling, so I wanted to add some overall warm tone

The starting point is the original RAW image, processed using the in-camera settings and the standard Adobe color matrices (for a detailed tutorial on how to open and process a RAW image, see here).

Let's see my editing step-by-step, starting from the sky and clouds. Actually, the techniques described in this and the next posts are not really peculiar to PhotoFlow, and most likely can be applied with minor modifications in other image editors.

Part 1: sky editing

In oder to darken the sky and clouds, I will use a rather common but very powerfull technique, which consists in replacing the luminosity channel of the original image with its own RED channel, and then blend the result back with the original image in "Darken" mode.

The screenshots below shows how this can be achieved in PhotoFlow.





Here are the detailed steps that I've followed:
  1. Add a group layer (I've called it "Sky edit") above the developed RAW image (new groups can be created by clicking on the "G+" button).
  2. Add a "clone" layer inside the group: for that, you have to select the empty row below the group name, than click on the "+" button to open the tool chooser dialog, and then select the "Clone layer" row in the "Misc" tab before clicking the "OK" button to close the dialog.
  3. In the "clone layer" configuration dialog that will pop up, you have to choose the layer corresponding to the initial image (in my vcase "RAW developer") for the layer name, and the "R" channel for the source. The image is graysacle at this point, since we only cloned one channel. To "restore" the colors, set the  blend mode to "Luminosity".
  4. You will notice at this point that the sky got quite darker, but the reddish leaves in the trees became very bright. What we would like is to keep what is darker in this R channel blend, and preserve everything else from the original image... to achieve this, you have to change the blend mode of the "Sky edit" group from "Normal" to "Darken"


There it is! The sky has now a deeper blue and more contrast in the clouds, all that without any masking and unwanted halos around the transition regions. Click on the caption elements to see the original image, the red channel, and the luminosity blend before the final "Darken" blend.



Click type to see: Original - Red channel - R channel Luminosity blend - Final result
  
The next part will show how the contrast in the foreground tree has been improved through a mid-tones liminosity mask associated to a curves adjustment.