Author Topic: ColorClip script for repair of blown-out star cores  (Read 4994 times)

Offline TinySpeck

  • PixInsight Enthusiast
  • **
  • Posts: 81
ColorClip script for repair of blown-out star cores
« on: 2019 February 20 09:14:50 »
I do my astrophotography with a 14-bit DSLR, and find that I usually have several bright stars with blown-out "magenta" cores in my images.  The magenta comes from out-of-range values being created in the debayering process, way early on during stacking.  With a 14-bit camera all my raw pixels should be 0.25 or less in the normalized PixInsight data range, but in my blown-out cores I see values much higher.

The Repaired HSV Separation script doesn't work well for me.  It helps, but star cores are still blown out.  It also puts a break in the image history since it creates a new repaired image.

ColorClip replaces out-of-range pixels with the mean of neighboring in-range pixels.  This can be done early in the linear phase, so dynamic range during stretching is maximized.  It does a decent job of replacing blown-out cores with the color immediately outside the blown-out region and results in more natural-looking stars.  The threshold is adjustable, with 0.25 the default (for 14-bit cameras).

I hope people find this useful.  You can get the script at https://github.com/CarpeCimex/ColorClip .  Please let me know if you find bugs or problems.  It's my first Java script so I'm sure there are some beginner gaffes in there.
Gerrit

Offline aworonow

  • PixInsight Addict
  • ***
  • Posts: 258
    • Faint Light Photography
Re: ColorClip script for repair of blown-out star cores
« Reply #1 on: 2019 February 20 09:52:51 »
Gerrit,

It works for me. I tried it on a fully processed image from a grayscale camera (RGBHS). It added color to the biggest brightest stars (and to some quite small, but, presumably, bright stars). The effect was to dull the stars a bit, but I think that can be remediated without much difficulty.

Thanks for a nice addition to the tool set.

Alex

BTW, I often use Repair HSV Separation to good effect, but this is faster and does the job well.

Offline TinySpeck

  • PixInsight Enthusiast
  • **
  • Posts: 81
Re: ColorClip script for repair of blown-out star cores
« Reply #2 on: 2019 February 20 10:08:06 »
Great feedback, Alex, thanks!
Gerrit

Offline niccoc1603

  • Newcomer
  • Posts: 42
Re: ColorClip script for repair of blown-out star cores
« Reply #3 on: 2019 October 02 13:16:23 »
it doesn't work with 1.8.7?

Offline TinySpeck

  • PixInsight Enthusiast
  • **
  • Posts: 81
Re: ColorClip script for repair of blown-out star cores
« Reply #4 on: 2019 October 02 13:19:34 »
Thanks for the report @niccoc1603.  I just downloaded 1.8.7 myself last night, and will look into this tonight.
Gerrit

Offline TinySpeck

  • PixInsight Enthusiast
  • **
  • Posts: 81
Re: ColorClip script for repair of blown-out star cores
« Reply #5 on: 2019 October 02 17:25:27 »
It works fine on 1.8.7 for me.  This was after installing the update from 20191002-windows-x64-core-c.zip, but that was a single bug fix and shouldn't have made a difference.

Can you describe what problem you're seeing?
Gerrit

Offline niccoc1603

  • Newcomer
  • Posts: 42
Re: ColorClip script for repair of blown-out star cores
« Reply #6 on: 2019 October 03 10:07:15 »
I copied the js file in script folder, then go to Script-Feature Script-Add and point to the folder, but after the scan there is no new filters showing up

Offline TinySpeck

  • PixInsight Enthusiast
  • **
  • Posts: 81
Re: ColorClip script for repair of blown-out star cores
« Reply #7 on: 2019 October 03 10:28:28 »
When I did that it looked like nothing happened, but ColorClip showed up in the Scripts / Utilities menu.  You may need to restart PixInsight to see this.
Gerrit

Offline aworonow

  • PixInsight Addict
  • ***
  • Posts: 258
    • Faint Light Photography
Re: ColorClip script for repair of blown-out star cores
« Reply #8 on: 2019 October 03 12:59:21 »
just installed my previous set of scripts, including ColorClip w/o any trouble, and w/o need to restart PI. (Windows 10)