Hi folks,
This script owes its genesis to a discussion on "true colours" and the way that the H, and to a lesser extent, the Sv separations of an HSV channel separation clearly show the effects of non-linearity in the underlying data. The script allows one to set a threshold above which data is assumed to be non-linear and attempts to draw colour information in from the surrounding pixels. It also attempts to restore a more peaked profile to the luminance information but that processing is fairly conservative and an option exists to output an "unrepaired" version. The script may be downloaded from
here, it was developed and tested under PI 1.7 and the interface looks like this:
The intention is to apply the script to linear data. Using
this (6.8 MB FIT) test crop here is a screen grab of the unstretched image which illustrates a problem:
There is no reason at all to suppose that the star actually changes colour as the core is approached, quite the opposite in fact. After running the Repaired HSV Separation Script the result looks like this:
It looks weird but the relative ratios of red/green/blue at the center of the star highlighted by the loupe are now pretty much just as they are away from the star's core. While I've offered the option of outputting a "repaired" but unstretched RGB the purpose of the script is primarily to output repaired H, Sv and V separations so that the V separation can be stretched before recombination with the H and Sv data. This offers a way to stretch an image without the usual loss of colour saturation. Here is the result of passing the V image through the MaskedStretch script (100 iterations, Target Median 0.15), recombining with the H and Sv images and doing a spot of clipping and colour balancing:
Quite an extreme look and not one that will win many prizes. The script can highlight chroma noise quite readily if the underlying data is poor. For comparison here's how the same MaskedStretch settings changed the "repaired" RGB:
And, for fun, here's what the two images look like when added together in equal proportions using PixelMath:
Comments and suggestions are welcome. This is my first attempt at JavaScript, and that probably shows, and my first spot of programming in over ten years having previously dabbled as a self-taught C++ programmer so please forgive the multiple stylistic errors.
Bob.