Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

Pixinsight improved image stretching


Recommended Posts

I have been working over recent weeks on a new Pixinsight script designed to significantly enhance the image stretching functionality already available within Pixinsight.  The script provides an integrated environment within which to design, appraise and apply stretches to astronomical images.  It incorporates a new set of stretching equations, known as Generalised Hyperbolic Equations, that were initially proposed by Dave Payne.  These equations have been found to provide a wide range of controllable and repeatable stretches that often facilitate significantly improved results compared  to the traditional approaches.  The script also incorporates the traditional Histogram Transformation and Arcsinh stretches and extends their functionality too.  

Dave and I hope this will be a useful additional resource for Pixinsight users and we encourage you to give it a try.  The script, together with detailed documentation, is available from here: https://github.com/mikec1485/GHS/releases/tag/v1.0.  We would welcome feedback from anyone who uses the script, including bug reports or suggestions for future development.

Happy image processing and clear skies!

  • Like 8
  • Thanks 5
Link to comment
Share on other sites

Just had a quick look and the way I was using it was to apply a stretch to an image and create a new image with the result. I then want to make changes and compare the outputs but the tool seems to default to the last image created so I have to remember to go back in there to select my "original" if that makes sense. Am I just being a numpty in how I should use the tool? :-) If I am using it in the right way then, for me at least, keeping the same file selected until purposely changed would make sense.

  • Like 1
Link to comment
Share on other sites

Hi Ouroboros - not a numpty question at all!

Copy the javascript file to your Pixinsight/src/scripts folder.  Then copy the GeneralisedHyperbolicStretch folder (containing the html and images folders) into your Pixinsight/doc/scripts folder.

Once you have done this fire up Pixinsight and go to the Scripts>Feature scripts... menu item.  Click the Add button and select your Pixinsight/src/scripts folder, hopefully it will report one new script found, namely Utilities>GeneralisedHyperbolicStretch which should be ticked for inclusion.  Click Done and now go to your scripts, GeneralisedHyperbolicStretch should appear in your Utilities category.

It should work fine on a Mac - I developed it on a MacBook Pro.

Any problems post back here and I will try to help further.

Clear Skies

Mike

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Phillyo said:

Downloaded it, started to read the documentation website and it went WAY over my head. Went back to using the EZ Soft Stretch :D

Hi Phillyo, thanks for giving the GHS script a try and posting your feedback here - I appreciate your time and interest.  I am sorry that you got "bogged down" in the documentation.  I would hope the script should be pretty self explanatory without even opening the documentation and for many just the tooltips in the script will be plenty to get going and explore the benefits it can bring to your image processing.  I do believe that, for many images, the additional control, flexibility and analytical tools provided by the GHS script, compared to a something like EZ Soft Stretch, can significantly improve the final result.  Certainly not everyone will want to read the documentation "cover to cover" but it is there as a resource to come back to as you wish.  If you feel there are some steps we could make to improve the accessibility of the GHS script please let me know.

Thanks again for your feedback.

  • Like 2
Link to comment
Share on other sites

11 hours ago, 69boss302 said:

This sounds interesting. Thank you for putting in all that work and sharing it with the community, I will try it as soon as I can! Just out of curiosity, do you have any comparison pictures?

Hi 69boss302.  Thanks for your comments.  My collaborator in producing this script, Dave Payne, has recently shared "before" and "after" images of SH2-155 The Cave Nebula on Astrobin.  I have copied his brief comments, which include links to the images, below:

 

"One of the first things I wanted to do upon the release of the script, was to re-process some older images of mine that I though the script would allow me to do a "better" job on.   My first choice was of SH2-155, The Cave Nebula.    The original was stretched primarily with the CT (Curves) process, and my notes have me being very careful on the star -stretch -> https://www.astrobin.com/w0ojfx/0/?r=0    Using the script, I was able to attain better stars, and at the same time, really bring out the background nebulosity, particularly towards the top of the image.   In addition, the nebulosity on the RHS of the image looks more three dimensional now ->  https://www.astrobin.com/w0ojfx/B/?r=0    As an added bonus, the actual stretch took far less time the second time around."  Dave Payne

Link to comment
Share on other sites

Thanks Mike

I also just posted an image of The Pleiades, trying to bring out the Merope nebulosity.    https://astrob.in/sn56r7/0/    M45 is a tough nut because the stars are so bright and generally come with halos.   Using the GHS Script, I am able to highly focus the stretch just behind the histogram peak, but above the noise (not at 0 or the black point), and watch all the faint nebulosity come alive.   Because of the focused nature of the stretch, the stars (away from the focused stretch) remain intact.    I would love to see what others think of the script too, but for me, it is my go-to tool now.  

  • Like 2
Link to comment
Share on other sites

I played around with it a bit at the weekend. It seems to work very nicely, although I think I'll have to go back and re-read the how to documentation a few more times, because a lot of it went straight over my head!

My initial thoughts are it seems to give similar results to the way Startools' autodev module stretches data, but perhaps with a little more fine control over how the stretch is executed.

Little more fiddling around and learning required, but pleased so far - thanks to both of you for your efforts in developing the script.

  • Like 1
Link to comment
Share on other sites

3 hours ago, The Lazy Astronomer said:

I played around with it a bit at the weekend. It seems to work very nicely, although I think I'll have to go back and re-read the how to documentation a few more times, because a lot of it went straight over my head!

My initial thoughts are it seems to give similar results to the way Startools' autodev module stretches data, but perhaps with a little more fine control over how the stretch is executed.

Little more fiddling around and learning required, but pleased so far - thanks to both of you for your efforts in developing the script.

Hi "Lazy" (if I may call you that!). Thanks for your interest and comments.

Link to comment
Share on other sites

Thought I would add a bit of a "quick" guide that should get you started - the primer is admittedly a bit of a book.

For most deep sky, you just need fix three parameters to design the initial stretch, using the histogram as a guide.  Put the focus point (SP) between where the histogram just leaves the bottom axis and the histogram peak, ie. to the left of the histogram peak.   You will have to zoom in on the LHS of the histogram to pick this point and you will end up with a low value (<0.01, 0.001? maybe even 0.0001)   This is where you will want to add the most contrast.  Set the local stress intensity (degree of focus, b) value between 5 and 10 (you need a high degree of focus for the initial stretch, because most of the data is tight in the histogram peak - try 10!), then adjust D (the stretch amount) to put the stretched histogram peak somewhere about 1/5 to 1/4 of the way across to the right (you will have to zoom out of the histogram again) and then preview or execute!

Now, the HT process only requires you to adjust one slider (the middle one) to control the amount of stretch, while the GHS script asks you to adjust three parameters, this is what allows you to "tailor, or design" the stretch for your image.   Behind HT/STF is a great all-round stretching function, but is an "off the rack" fit.     Setting three parameters should not be too onerous, we hope, and once  you get the "knack" of it....   If you look at your stars in the stretched image, I would bet that they are less impacted by the stretch (more Gaussian in shape, less bloated) and dimmer nebulosity has been made visible.  Do you like it?

If you want to further adjust the stretch, I suggest trying a different SP (only fine edits of approx. 0.0001 are likely needed), you will see how this transforms the resultant histogram - you likely want the resultant to be as wide as possible.   When changing SP look for a wider histogram result, with less shift to the right or back to the left.    b (and D) will be too large if the peak separates into two peaks, but other than that, go for the maximum focus and stretch amount to taste.   Use the histogram result  and image previews as your guide, and then execute again.   In a couple of tries you would have mastered this important initial stretch.

You may then want to adjust the black point - this is deliberately put as a separate step in the GHS - using the linear stretch selection, which will end up shifting the histogram somewhat to the left again, dimming the background.

Finally you can manipulate the stretch further (using smaller b and D factors) to make the stretch focus and amount less.

Hope this helps.

  • Like 1
  • Thanks 3
Link to comment
Share on other sites

1 hour ago, Gunshy said:

Hope this helps.

Thanks @Gunshy This helps (me) a lot! I can definitely see the improved stars but feel I'm losing contrast in the steps I'm taking (likely incorrectly) - I need to try again and also on some different images

1 hour ago, Gunshy said:

You may then want to adjust the black point

So it's normal for the first stretch (1/5 - 1/4 along) to need the black point adjusted significantly? Just checking!

Thanks to both of you (inc @mike1485) for sharing this.

Example:

image.thumb.png.88b7fbdf9985297782b7a885117af16a.png

image.thumb.png.3804c4ca277f59d3d0993a3ac0b2cae8.png

One other image:

image.thumb.png.d8f7e30e105d2a6f8d91847c426ca11f.png

Edited by geeklee
Added examples
Link to comment
Share on other sites

Your images are looking great!

Technically, you can  the blackpoint adjust before the first stretch, but practically this is hard to do.   Generally I do it after the first big stretch. 

There are multiple ways of doing this, the easiest is with the linear stretch (I think it is call linear-prestretch), where you simply change the stretch type, set the blackpoint and then execute.   The blackpoint will be substantial in most cases, and execution will shift the histogram significantly back to the left, and dim somewhat, the image again. 

Then it is time to use a much smaller, or negative b (much less stretch focus) and adjust your image.   This part is quite initeractive and much to taste - but basically you can put the stretch and additiona contrast addition/subtraction wherever you want;.   The documentation tries to give some hints of what to look for to avoid artifacts and highlight what you want.    Otherwise, play a bit.   Avoid creating addtional peaks and valleys in the histogram, or fix them if they appear.   What the stars, and the previews and play.   Soon you will get the "knack".

C.S.

Dave

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Gunshy said:

The documentation tries to give some hints of what to look for to avoid artifacts and highlight what you want.    Otherwise, play a bit.   Avoid creating addtional peaks and valleys in the histogram, or fix them if they appear.   What the stars, and the previews and play.   Soon you will get the "knack".

Thanks for the explanation Dave, I'll persevere.  It's just that missing contrast I need to bring back.  I guess I can do that after with other tools if needed.

Link to comment
Share on other sites

Thanks for keeping with it.  The GHS script is meant as a multistage process, that is meant to be applied a few times to an image to control the stretch as you go.   What I was trying to describe was just the initial stretch (or two if you include the black point correction.

After the initial, highly focused stretch, you really have three options,

1) repeat the initial stretch, using a different SP or b, to see if a "better" focus point and/or degree of focus emphasizes the parts of the image you like more.  This is the "design" feature of the script.  Use the histogram and preview to guide you.

2) continue to apply GHS to the image - you have complete control over where you put the brightness and contrast.  Again use the histogram and preview to control.

3) After the initial stretch, then go to STF or your other one-step stretcher to finish it off.  You will get some of the benefits of the GHS script this way, but not all, because you are relinquishing control to the automatic stretcher somewhat.

The GHS script should only be compared, when finished stretching and is designed to not be automatic, or a single step solution,  ie. Free your inner artist.

Having said that, from the posted images, it seems that your initial stretch might help from a slightly higher SP, or focus point to hide the background noise a bit more and stretch the brighter nebulosity more  but that is a matter of taste.

Hope this helps

 

 

  • Like 1
Link to comment
Share on other sites

I’ve been trying this out the last few days, admittedly I haven’t dug into the documentation yet but it’s become my first port of call for the stretch. I like this, it’s certainly working for me on the narrowband images I’ve been working on & so far just “playing around” with setting’s to see how things look is giving me decent results. I’m going to dig in deeper with the docs & further info in this thread now I’ve got the feel of it. I really appreciate the effort that’s gone into this. 👍

  • Like 1
Link to comment
Share on other sites

Hi Sp@ce_d

I am glad you are finding it useful and stuck it out.  It is a bit of different approach - but once you get used to it, I find it really grows on you.   The way that Mike has put the whole script together with the interaction of the histogram and the previews, really makes it feel like you are in control of what happens to the image.  By including the HT transform and Arcsinh transform as selections too, even adds functionality to these stretches too. 

Cheers and Clear Skies!

Dave 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.