Hello,
As already announced in the forum, in the last weeks I worked on an update of the LFHH script. Today, I am pleased to present some significant improvements and enhancements to the script. These cover the following topics:
Membership functions On the one hand I added the MTF function as an additional membership function and also the possibility of normalization for the Sigmoid function. But the most important innovation, however, is a membership function with which you can stretch linear images. The script was originally intended only for contrast enhancement, but the discussion with Alejandro Tombolini in the forum gave me the idea to deal with stretching as well.
When looking for a suitable membership function for the stretching, I was inspired by one of the PixelMath tutorials by Gerald Wechselberger. I adapted the idea of „masking“ the MTF function and developed a special membership function for the use with LFHH. Although PixInsight already has a number of excellent processes for image stretching, the results with the new membership function - I called it „Masked MTF“ - were so convincing that I absolutely had to include it in the script. Apart from this I think that's a good opportunity to thank Gerald for his excellent tutorials!
Here is an example: the first image is stretched with AutoSTF, the second one with the new Masked MTF function.
I did a lot of testing with the new feature and I achieved really good results with it. I would be interested in further experiences. With appropriate feedback, I would invest more work in the development of this functionality.
Extrapolation algorithm for the image bordersThis feature is not visible, but still a significant improvement of the program. Even if all marginal errors, such as stacking artifacts, were removed in the target image, the old version of the script occasionally had problems with the interpolation of the segments at the image borders. By improving the algorithm, these problems could be resolved on all critical test images. The algorithm is now much more robust.
Color imagesBasically, I think contrast enhancement should be applied to the luminance component of an image. Nevertheless, the question arises, how to treat color images. I already described a possibility in the forum: extract the L component from the RGB image, then apply LFHH to the L image and merge it back to the RGB image using LRGBCombination. Another possibility I have now implemented in the script. There the individual colors are modified in the same ratio as the underlying L component.
Here is an example: the target image, contrast enhancement with extracted L component and direct application of the script.
Although the masked MTF function gives good results for color images, it is still not capable for rationally stretching linear RGB images. The script has a check routine, if a processing of an RGB image leads to meaningful results. Basically, the existing stretching processes like MaskedStretch or ArcsinhStretch are better suited for this.
Documentation of parametersIn my numerous tests, I came across the problem of reconstructing the script parameters at a later date. Although the selected parameters have been displayed in the console output so far, this information is lost after a reboot. Therefore, in the new version, all parameter data are stored in the FITS header of the resulting image.
You can read everything about all the new functionalities in the revised documentation you can download together with the updated script from the following link:
https://www.dropbox.com/sh/75ky9j7tj2r08w9/AADMs4zYfUruqSPi7pQ54rFxa?dl=1I hope you like the new features and I would be happy to receive comments and suggestions for further improvement.
Kind regards,
Frank