Author Topic: Need help with Colormask script and TVGInPaint  (Read 3385 times)

Offline calan

  • Newcomer
  • Posts: 34
Need help with Colormask script and TVGInPaint
« on: 2017 May 06 20:05:17 »
I'm trying to use the colormask script and TVGInPaint to remove the hot pixel defects in this image, but not having any luck at all. I can never get the color mask to select the right pixels, and can't get TVGInPaint to fully remove what is masked. The image linked below is 340 stacked OSC frames from a ZWO ASI224MC camera. It has had the channels extracted, LinearFit applied, recombined, and then had DBE, background neutraolization, and color correction applied.

https://www.dropbox.com/s/ppatnx5h6b8wzdv/M51_combined_DBE.xisf?dl=0



Someone want to give it a shot and tell me how to get rid of these hot pixel streaks? Other than those defects, there seems to be some pretty good data there I think.

Any help much appreciated.

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: Need help with Colormask script and TVGInPaint
« Reply #1 on: 2017 May 06 20:51:19 »
I just used a little PixelMath to create a mask that matches the defects reasonably well.  The expression is: $T[0]>m*mean($T[1],$T[2])||$T[1]>m*mean($T[0],$T[2])||$T[2]>m*mean($T[0],$T[1]) with a symbol value m=1.35.  It is simply a test for any pixel that has a R, G or B value that is significantly brighter compared to the other two colours.  There should be a saved PixelMath rocess icon attached to this post.

Just invert the result and use it as the support image for TGVInPaint.

A better fix would be to remove the hot pixels before stacking, of course.

Cheers,
Rick.

Offline calan

  • Newcomer
  • Posts: 34
Re: Need help with Colormask script and TVGInPaint
« Reply #2 on: 2017 May 06 21:11:51 »
That is awesome! Worked much better, even with a rough first pass of TVGInPaint.

Any tips for improving up the TCGInPaint process?

Thanks Rick!

Offline calan

  • Newcomer
  • Posts: 34
Re: Need help with Colormask script and TVGInPaint
« Reply #3 on: 2017 May 06 21:32:27 »
Rick,


How can I change your PixelMath to output an inverted mask? It works great, but the mask needs to be inverted to use InPaint. (Just saves an extra step if PM does it)

****

NM - as simple as wrapping the whole equation in ~().   



Offline calan

  • Newcomer
  • Posts: 34
Re: Need help with Colormask script and TVGInPaint
« Reply #4 on: 2017 May 06 21:41:11 »
Magic!

I've attached a process icon group for anyone else that needs this. It includes Rick's pixelmath (modified to output an inverted mask called "defect_mask"), a convolution process to slightly blur the mask, and TVGInPaint to remove the bright pixels.

Can't wait to try it on a bunch of other data I have that suffers from this.

Thanks again Rick.

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: Need help with Colormask script and TVGInPaint
« Reply #5 on: 2017 May 06 23:07:04 »
Glad it was helpful and I'm pleased that you managed to tweak the rough idea and get it working to your satisfaction.

Offline calan

  • Newcomer
  • Posts: 34
Re: Need help with Colormask script and TVGInPaint
« Reply #6 on: 2017 May 06 23:59:14 »
I can't believe how well it worked. It's like the hot pixel streaks were never there at all, with no visible blurring or loss of data.

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: Need help with Colormask script and TVGInPaint
« Reply #7 on: 2017 May 07 06:37:19 »
Very nice calan.

Rick, you and Gerald make Pixelmath look easy.


Mike

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: Need help with Colormask script and TVGInPaint
« Reply #8 on: 2017 May 07 15:43:14 »
Just remember that the masking tool within PixInsight has a simple 'Invert Mask' capability that allows you to toggle between normal and inverted. Judicious use of this can help you understand what will or will not be protected (masked) when a process is applied to an image.
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: Need help with Colormask script and TVGInPaint
« Reply #9 on: 2017 May 07 16:35:32 »
Rick, you and Gerald make Pixelmath look easy.

Thanks, Mike.  Long PM expressions can look intimidating but they aren't too hard to understand if you break them down into simpler pieces.  Someone needs to write a comprehensive PM tutorial.  Are you listening, Warren Keller?  :D

Offline Warhen

  • PTeam Member
  • PixInsight Old Hand
  • ****
  • Posts: 490
    • Billions and Billions
Re: Need help with Colormask script and TVGInPaint
« Reply #10 on: 2017 May 11 13:58:53 »
And two more cents Calan- the hot pixels are 'smeared' over several pixels after alignment. The best fix is to nip these in the bud during calibration, before debayering and alignment occur. Using dithered guiding, a CosmeticCorrection template or process, and the appropriate rejection algorithm during integration will kill these puppies so you aren't faced with fixing them after the fact. Remember too, that the CloneStamp can me useful if it's just a few errant ones.
Best always, Warren

Warren A. Keller
www.ip4ap.com

Offline calan

  • Newcomer
  • Posts: 34
Re: Need help with Colormask script and TVGInPaint
« Reply #11 on: 2017 May 11 15:39:57 »
And two more cents Calan- the hot pixels are 'smeared' over several pixels after alignment. The best fix is to nip these in the bud during calibration, before debayering and alignment occur. Using dithered guiding, a CosmeticCorrection template or process, and the appropriate rejection algorithm during integration will kill these puppies so you aren't faced with fixing them after the fact. Remember too, that the CloneStamp can me useful if it's just a few errant ones.

Thanks Warren, but this image is an example of a live-stacked OSC image from SharpCap...so stacking and pre-processing options are limited. Thus, the reason for finding an option to fix it as it stands, while relying on CloneStamp as little as possible.

BTW - I just received your book yesterday, and so far it looks really nice!