@afre,
You’re on to me. I’m writing a tutorial on this topic, and, yes there was a hint of that in the discussion with our colleague @s7habo. The operational premise stems from centering a gaussian bell curve on any grayscale value that one may desire and generating a selection mask based on it.
A Gaussian distribution curve sports a lot of interesting features for “feathered” drop-off, in that the waning selectivity assigned to progressively lighter or darker pixels surrounding the tonal value of interest exhibits the ease-in, ease-out drop off that animators like: nothing abrupt. Ease in the rate of deselection for tonal values which are very much like the tonal value of interest. For tonal values progressively less like the tonal value of interest, deselect at a faster rate, but then, for tonal values quite different, ease out the rate of deselection again.
Here is an illustration of what the drop off looks like, where the ‘tonal value of interest’ is a normalized luminance target of 0.6 :
gmic \
target=0.6 \
selectivity=0.05 \
size=1024 \
bitdepth=16 \
-input '$size',1,1,1,'x/(w-1)' \
-fill 'gauss(i-$target,$selectivity)' \
-normalize 0,'{2^$bitdepth-1}' \
-display_graph[-1] 960,540,1,1,0,0,0,0,'relative_luminance','selection_strength' \
-output. gbell.png
gbell.png:
The key lines here are in
boldface, everything else is just in the service of illustration setup or breakdown. The key bits of information are:
1 target: this identifies the tonal value of interest, which, in the luminance mask, corresponds to the whitest (most selected) pixels. This numeral is in terms of relative luminance. Multiply it by 2bitdepth: of the graphic file format to get the actual grayscale tone that translates to the “most selected pixel” in the mask.
2 selectivity: this sets the overall rate of drop-off from the tonal value of interest to “tonal values of complete disinterest.” Smaller numbers engender a “tighter” selection – fewer pixels are affected, the drop off is quite rapid. Larger numbers give rise to a “looser”, more inclusive selection. The useful range is [0,…,1], methinks.
-input ‘$size’,1,1,1,‘x/(w-1)’
just introduces a gradient as a test image. A slightly more real-world setup would load a real image of interest, followed by –luminance
(to duplicate, and preserve, the original). All this falls quite close to the “soft” -select_color
chatter in the other post, for color images are just stacks of grey-scales associated with some color-space rules. The color “value of interest” is just a vector of “tonal values of interest”, so run this logic over the however many grey-scale channels there are in the color space.
It doesn’t take a vast amount of imagination to see this implemented as a gmic-gimp filter, with one slider to pick the “tonal value of interest” and the other slider controlling the “tightness of drop-off”. Noodle the first slider to pick the level of grey that should be most affected by subsequent edit operations. Noodle the second slider to set the degree of isolation between the tonal values of interest and all the other tonal values in the image. I almost think there is a gimp-gmic filter already out there with nearly this behavior; maybe I should be arsed enough to take a closer look at the gmic filter plug-in and the new toys there. One of them is yours, I gather.
Take care,
Garry