Author Topic: New Script: LocalFuzzyHistogramHyperbolization  (Read 16956 times)

Offline jtalbot

  • PixInsight Enthusiast
  • **
  • Posts: 78
    • http://www.starscapeimaging.com
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #30 on: 2018 January 06 14:35:51 »
Love this script!  I recently processed an Ha only version of the area around the flame nebula with the script.  I found that if the stars were removed prior to running the script, I got excellent results.  I found this easier than creating a star mask with the star exactly the right size.  I then added the stars back in.  Here is the processed version.

Best,
Jon Talbot
Clear Skies

Jon

Offline FrankW

  • PTeam Member
  • Newcomer
  • Posts: 25
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #31 on: 2018 January 09 14:22:19 »
Jon,

that' s a great image! And it's a really interesting idea how to handle the 'star problem'. Can you give a brief description how you remove and add the stars.

Cheers,
Frank

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #32 on: 2018 January 09 15:26:33 »
I used LFHH to enhance starless Ha and Oiii data to produce this CTA 1 image in the gallery: https://pixinsight.com/forum/index.php?topic=12015.0  It's a very useful script!

There are probably quite a few posts on the forum about star removal.  Here's a recent one: https://pixinsight.com/forum/index.php?topic=11879.msg73080

Cheers,
Rick.

Offline jtalbot

  • PixInsight Enthusiast
  • **
  • Posts: 78
    • http://www.starscapeimaging.com
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #33 on: 2018 January 10 08:53:24 »
Hi Frank,
I basically followed a technique similar to the link Rick posted.  My technique wasn't quite as involved, or as good, as what is in the link however it seemed to work just fine.
Again, thanks for a great script.

Best,
Jon
Clear Skies

Jon

Offline FrankW

  • PTeam Member
  • Newcomer
  • Posts: 25
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #34 on: 2018 January 12 02:19:42 »
Jon, Rick,

Thank you very much. I tried the method and I am really excited.  :D  At the moment I work on an update of the script to apply LFHH to color images and even use the algorithm for stretching linear images. I am not sure if I can include your method in the script but it is a great hint anyway.

To give you an impression how the update works, I attached one of my test images. For this image of the Pelican Nebula most of the contrast enhancement was achieved with LFHH. I hope I will finish the work in the next weeks.

Cheers,
Frank

« Last Edit: 2018 January 19 03:32:34 by FrankW »

Offline FrankW

  • PTeam Member
  • Newcomer
  • Posts: 25
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #35 on: 2018 April 16 12:00:13 »
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 borders
This 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 images
Basically, 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 parameters
In 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=1


I hope you like the new features and I would be happy to receive comments and suggestions for further improvement.

Kind regards,
Frank

Offline CharlesW

  • PixInsight Enthusiast
  • **
  • Posts: 87
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #36 on: 2018 October 11 09:54:24 »
Win 10, fully updated copy of PI. I used the script for the first time. I found that the command window never released back to Ready, even after the new image had been created and the script had apparently stopped running. I was able to exit out of the script.

Offline FrankW

  • PTeam Member
  • Newcomer
  • Posts: 25
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #37 on: 2018 October 11 10:55:55 »
Hello Charles,

It's the first time I hear of a problem with the script. Can you please send me the console output of the script.

Kind regards,
Frank

Offline CharlesW

  • PixInsight Enthusiast
  • **
  • Posts: 87
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #38 on: 2018 October 11 14:29:29 »
It occurred on my Mac Pro also.

Offline FrankW

  • PTeam Member
  • Newcomer
  • Posts: 25
Re: New Script: LocalFuzzyHistogramHyperbolization
« Reply #39 on: 2018 October 12 07:19:36 »
This looks normal. It is intended that the console will be left open after completing the calculations to view the log. The console does not close until you press the script's EXIT button. (As long as a script is open, no other process can be started anyway.)
During the calculation, all input fields and buttons turn gray, after the run they all become active again. If that happens, everything is ok.