Author Topic: Star Removal Using StarMask and DefectMap  (Read 7173 times)

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1176
    • View Profile
    • astrobin
Re: Star Removal Using StarMask and DefectMap
« Reply #30 on: 2017 November 23 10:06:38 »
And from the same image the section of the NGC7000.



Mike

Offline Dimitris Platis

  • PixInsight Addict
  • ***
  • Posts: 181
    • View Profile
Re: Star Removal Using StarMask and DefectMap
« Reply #31 on: 2017 November 24 06:27:10 »
Really looking forward for the video-demonstration of Fabian's method!

Offline pscammp

  • PixInsight Addict
  • ***
  • Posts: 115
    • View Profile
Re: Star Removal Using StarMask and DefectMap
« Reply #32 on: 2017 November 24 11:36:56 »
Me Too

Offline MikeOates

  • PixInsight Addict
  • ***
  • Posts: 278
    • View Profile
Re: Star Removal Using StarMask and DefectMap
« Reply #33 on: 2017 November 24 13:47:45 »
Hi Mike,

I wanted to try your method using ClassicStarMask (not used it before) but when I ran it, I got the following error.

Code: [Select]
Processing script file: C:/Program Files/PixInsight/src/scripts/ClassicStarMask.js
*** Error [001]: C:/Program Files/PixInsight/src/scripts/ClassicStarMask.js, line 50: ReferenceError: HDRWaveletTransform is not defined

Does this work in 1.8.5 ?

Mike

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1176
    • View Profile
    • astrobin
Re: Star Removal Using StarMask and DefectMap
« Reply #34 on: 2017 November 24 14:47:45 »
Hi Mike

Yep that's what I'm running. This is the script so you can do a quick compare of the beginning code if you want. Also what console should look like while executing.


Mike

Offline MikeOates

  • PixInsight Addict
  • ***
  • Posts: 278
    • View Profile
Re: Star Removal Using StarMask and DefectMap
« Reply #35 on: 2017 November 24 15:08:37 »
Thanks for that Mike,

My script at line 50 says:
var HDRW = new HDRWaveletTransform;

While yours has:
var HDRW = new HDRMultiscaleTransform;

The same code is used a few times, so perhaps I have the wrong version, but I don't see any other to download. I got it from:
https://pixinsight.com/forum/index.php?topic=3410.5

Mike

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1176
    • View Profile
    • astrobin
Re: Star Removal Using StarMask and DefectMap
« Reply #36 on: 2017 November 24 15:32:48 »
Not Sure Mike. I know many years ago I changed the lines in the code to HDRMultiscale to make it work but this install of 1.8.5 is completely fresh I thought. You can search the code and change the instances of HDRWaveletTransform to HDRMultiscaleTransform and everything should work. I can't remember when HDRWaveletTransform was retired but the parameters seemed to be the same as HDRMultiscale but I'm sure the math is different and better. The script with Multiscale produces a mask and with a little extra help seemed to work for my 45mm needs. I don't think there are any other bombs in the code :surprised: 

I do like PI for fact that we can make changes in the scripts or for that matter the real code. I'm not a programmer or someone who could write a script from scratch but PI provides enough info in the console that I can hack my way through issues. 


Mike

Offline Salvatore Giambruno

  • Newcomer
  • Posts: 33
    • View Profile
Re: Star Removal Using StarMask and DefectMap
« Reply #37 on: 2017 November 24 21:56:59 »
No worries about hijacking, Adam - except for the explosive keyword itself, lol.

Looking forward to seeing the video.

-Sal


Hi Salvatore,

Thanks for writing. By the way, I felt a little bad about bringing up Fabian's example in your thread. I somewhat hijacked your post. Sorry about that.
Concerning the background, yes you are correct. The dark background was just my non-linear stretch that I actually used when I blended in the data. The background is unchanged in process of removing stars. I just didn't have the non-linear image of the stars removed with a lighter background that is all.

To everyone that might read this- I connected with Fabian...and I am working on making the video. However, he is in the process of reviewing my work (it is his implementation of this technique in PI after all)- and he is a busy guy! So it is still a work in progress... but very much in play.

-adam


Thanks for sharing, adam. 

Fabian's sounds like an interesting technique - I'll be sure to check it out as soon as I get a chance. 

I think you tried to explain why the sky background levels are different in the before/after images you posted as an example, but I'm not sure I understand the explanation.  Correct me if I am mistaken, but I believe you were trying to explain that the difference was not a shortcoming of Fabian's process, but that it turned out that way as a result of you rushing to prepare the example.

Hi Salvatore,

For the past few years Fabian Neyer has been demonstrating a technique of star removal that is based on practices that professionals use. He cites this paper of showing the intragalactic glow between members of the virgo cluster:

http://iopscience.iop.org/article/10.1088/0004-637X/720/1/569/pdf

The technique you demonstrate is something like a first order approximation of the idea. The full technique employs some other clever steps including using MLT to calculate the local sky value of stars at different scales. When you use the defect map, you are only using those pixels that are immediate neighbors to your regions. But varying the scale of MLT you can properly get better sky values (and therefore substitution) for the stars. In addition, and this is really clever- you can create a sky subtracted star images that you blur and then subtract from the real data in order to get rid of stellar halos and the wings of PSFs. This takes care of OldWexi's question.

(on a note of computing, Fabian's technique does not require the computational overhead of what the defect map does by looking at each neighbor pixel.)

I just completed an image that uses Fabian's technique. Below is a version of SH2-68 before and after star removal. (I did not see the black levels the same...just quickly grabbed). If there is interest, I can post my version of this tutorial (I will ask Fabian... but I think it isn't a problem). I added a few variations to Fabian's technique. It is a longer process, but the results are commensurate with the effort.


-adam
--Sal

Offline Salvatore Giambruno

  • Newcomer
  • Posts: 33
    • View Profile
Re: Star Removal Using StarMask and DefectMap
« Reply #38 on: 2017 November 24 22:02:20 »
Mike,

That came out well.  It's all about getting the starmask and binarizing tweaked just right.  Works great on small to medium stars - it's always the large stars that are difficult to remove/replace.  Thanks for posting your effort.

Just for fun I took my 45mm shot of Cygnus and decided to see what the DefectMap could do. So first this is a simple image processing. ABE and then extract the red channel from the RGB. I use STF with HistogramTransformation for the stretch. Now the decided to try the ClassicStarMask script to generate the star mask. I then inverted the mask. Next I used Binarize with a very high setting of 0.97. This is the mask for the DefectMap to use.

I think it turned out very well for such a low resolution image. On the left is the full image and on the right is a 3:1 scaling of the section with Sadr.

Mike
--Sal

Offline MikeOates

  • PixInsight Addict
  • ***
  • Posts: 278
    • View Profile
Re: Star Removal Using StarMask and DefectMap
« Reply #39 on: 2017 November 25 04:32:17 »
Thanks Mike, did as you suggested and that worked fine.

Mike
You can search the code and change the instances of HDRWaveletTransform to HDRMultiscaleTransform and everything should work.   
 
Mike

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1176
    • View Profile
    • astrobin
Re: Star Removal Using StarMask and DefectMap
« Reply #40 on: 2017 November 25 08:11:07 »
Salvatore

Thanks. I've been trying to find a decent method since 1.8.5 came out. In 1.8.4 I used Carlo's TGVInpaint with great success but that module no longer works in 1.8.5


Mike

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1176
    • View Profile
    • astrobin
Re: Star Removal Using StarMask and DefectMap
« Reply #41 on: 2017 November 25 08:12:19 »
Mike

Good to hear you've got the script working :smiley:


Mike