Author Topic: StarHaloReducer Script  (Read 19904 times)

Offline Silvercup

  • PixInsight Addict
  • ***
  • Posts: 187
StarHaloReducer Script
« on: 2009 September 20 08:53:13 »
Hola a todos:

Por fin he terminado el Script para reducir halos en las estrellas: StarHaloReducer Script.



El script funciona creando varias máscaras artificiales: una protege los bordes del preview, otra protege el corazon de la estrella,
otra enmascara el halo para poder modificarlo y por ultimo hay una máscara que protege (resalta) las pequeñas escalas detrás del halo.

El script es muy intuitivo y como tiene un preview, vemos en todo momento lo que estamos haciendo. Para utilizarlo, creamos un preview centrado
en el Halo.

Si el halo y la estrella son concentricos ya podemos ejecutar el Script.

Si la estrella está desplazada hacia un borde, antes de ejecutar el script debemos mirar en que posición del preview está el centro
de la estrella para despues indicarlo en el script en los parametros Star Center X y Star Center Y.

Una vez ejecutado el script (e indicados los datos del centro de la estrella si fuese necesario) es cuestión de ajustar fundamentalmente
los parametros Luminance Value y Border Protection Value, hasta que veamos una reducción del halo evidente sin efecto ringing y que
case con el borde del halo. Podemos ajustar la proteción del corazón de la estrella con Star Protected Value para que no le afecte la disminución
de luminosidad o de los canales RGB. Por ultimo, si el halo tiene debajo estrellas o estructuras pequeñas podemos recuperarlas con Small Scales Protect Mask
e indicando el valor de proteccion con Small Scales Protected Value.



Al darle a OK nos saldrá una copia de la imagen principal con los cambios efectuados en el script y el mismo preview seleccionado por si queremos ejecutarlo una vez más.


El proceso se puede repetir cuantas veces sea necesario.




Os dejo el código fuente. Espero que os sea de utilidad y que me digais si se puede mejorar algo o cualquier cosa que se os ocurra.

Un saludo. Silvercup.



Hello everyone,


I finally finished the script to reduce halos around stars: StarHaloReducer Script.



The script works by creating several artificial masks: one protects the edges of the preview, another protects the star core,
other masks the halo for editing and finally there is a mask that protects (highlight) the small scales behind the halo.

The script is very intuitive and has a preview to see what we are doing. To use it, create a preview with the halo centered.

If the halo and the star are concentric then we can run the script.

If the star is shifted to an edge, before running the script we should look the position of the star core in the preview
to indicate in the script parameters Star Center X and Star Center Y.

After you run the script (and the data indicating the star center if necessary) is fundamentally a matter of adjusting
Luminance parameters and Border Protection Value, until we see a reduced halo effect without ringing and
matching with the edge of the halo. We can protect the star core with Star Protected Value an the star will not be affected by the decrease
of brightness or the RGB channels. Finally, if there are stars or small structures beneath the halo we can recover it with Small Scales Protect Mask  
and indicating the value of protection with Small Scales Protected Value.


When OK is pressed we will obtain a copy of the main image with the changes in the script and the same preview selected so we can run the script again.


The process can be repeated as often as necessary.


I leave the source code. I hope it will be useful and tell me if I can do anything to improve it or anything you can think of.

Greetings. Silvercup.
« Last Edit: 2009 September 20 09:01:55 by Silvercup »

Offline Simon Hicks

  • PixInsight Old Hand
  • ****
  • Posts: 333
Re: StarHaloReducer Script
« Reply #1 on: 2009 September 20 14:02:48 »
Hi Silvercup.

A great looking script. I am very keen to try it out. I tried downloading the .js file and adding it into PI, but PI doesn't seem to 'see' it in the folder....even though I can see it with Windows Explorer. I have just added two other scripts off the forum using the "Feature Scripts" feature, so I know that is working fine. I have even tried re-downloading the file.

I wonder if there is some reason PI is not 'seeing' the .js file?

Cheers
         Simon

Offline Silvercup

  • PixInsight Addict
  • ***
  • Posts: 187
Re: StarHaloReducer Script
« Reply #2 on: 2009 September 20 14:20:31 »
Hi Simon:

You must add this lines:

Code: [Select]

#feature-id Utilities > StarHaloReducer
#feature-info A simple script for reducing star halos.<br><br/>\
   <br/>\
   Copyright &copy; 2009 Juan M. Gómez


But the script isn't part of PI platform officialy, so I don't put those lines.

Greetings, Silvercup

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: StarHaloReducer Script
« Reply #3 on: 2009 September 21 03:41:52 »
Hola Juan Manuel

Extraordinario trabajo. El script funciona realmente bien, y el algoritmo que has ideado es elegante y eficiente. Bienvenido al desarrollo de scripts en PixInsight  8)

Si no tienes inconveniente vamos a añadir también este script al conjunto de scripts estándar en PI 1.5.8. Hay algunas cosas que he visto al vuelo. Una de ellas es que quizá se podrían usar textos más explicativos acerca de algunos parámetros. Por ejemplo, en vez de "border protection value" podríamos poner "star mask diameter", que creo que se entiende mejor. Déjame echarle un vistazo más a fondo y pensaré en más sugerencias. Aparte de esto, en cuanto a mejoras en la usabilidad, vendría bien tener tool tips que explicasen los parámetros, al menos los más críticos (por ejemplo, explicar que los parámetros "Center" están en coordenadas del preview, y cosas así.

En cuanto a mejoras, se me ocurre la posibilidad de proporcionar una previsualización ampliada en el script (como opción). También podría ser interesante poder controlar el grado de "softening" que se aplica a la máscara. Iremos pensando en más cosas, pero desde luego es un trabajo excelente. Muchas gracias, y ¡felicidades!  ;)


===============================


Hi Juan Manuel,

Outstanding work. The script works really well, and you've devised an algorithm that is both elegant and efficient. Welcome to PixInsight script development 8)

If you don't mind, we can add also this script to the standard set in PI 1.5.8. There are some things that I've seen on the fly. One of them is that perhaps we could use more explanatory texts about some parameters. For instance, instead of "border protection value" we could write "star mask diameter", which I think is more understandable. Let me take a more thorough look and I'll think on more suggestions. Besides that, concerning usability improvements, it would be convenient adding some tooltips to explain parameters, the most critical ones at least (for example, explaining that the "Center" parameters are in preview coordinates and the like).

Regarding functionality improvements, the script could provide a zoomed preview, as an option. Also interesting could be to provide control over the degree of softening that is applied to the mask. We'll be thinking on more improvements, but this is indeed an excellent work. Many thanks, and congratulations! ;)
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Simon Hicks

  • PixInsight Old Hand
  • ****
  • Posts: 333
Re: StarHaloReducer Script
« Reply #4 on: 2009 September 21 04:53:11 »
Hi Silvercup,

Thanks for the info. I inserted the lines and it imported just fine. Its a really nice script. I love the slider bars working on the live preview...this really helps with tuning the parameters.

I'm not too sure of the convention here, but I would be really pleased if you put the extra lines in every sample script you did....I can add them and remove them from my Sample Script box whenever I want....but if they are all this good then they will be added and stay there! Well done.

I have a copule of simple questions about the script though....

Does it apply the halo reduction to all of the stars in the Parent Image, or just the brightest or largest ones? How does it determine which ones to apply it to?

Cheers
Simon

Offline Silvercup

  • PixInsight Addict
  • ***
  • Posts: 187
Re: StarHaloReducer Script
« Reply #5 on: 2009 September 21 07:44:45 »
Hi, Simon:

The Script only manage one star halo, the one selcted by the preview. If there are more star halos you must run the script for every one. The script uses three concentric mask and they are individual for each star halo case.

As an example, I have slightly corrected Stephan's Quintet by Hubble in less that ten minutes:



Juan, I agree with your comments, there are some bugs too. For example, if you close de window script with the x button the images used by the script don't close.

Greetings. Silvercup.

Offline Simon Hicks

  • PixInsight Old Hand
  • ****
  • Posts: 333
Re: StarHaloReducer Script
« Reply #6 on: 2009 September 21 07:53:05 »
Hi Silvercup,

Wow, that is really cool. So this effectively lets me say "I'll just select that star there for halo reduction" by putting a small preview over it and applying the script to that preview. And repeating this process for the five big blobby stars in my image.

So is it just looking at the brightest / largest star in the preview? In other words, how does it know which one to choose?

Cheers
         Simon

Offline Ignacio.R.

  • PixInsight Enthusiast
  • **
  • Posts: 77
Re: StarHaloReducer Script
« Reply #7 on: 2010 January 03 10:10:09 »
Hola Silver.

Tengo algun problema con el script. En cuanto intento ajustar el primer parámetro, sea cual sea, el cuadro del preview experimenta un aumento brutal de luminosidad que no hay forma de corregir. Y de ahí no paso...

Saludos

Offline Simon Hicks

  • PixInsight Old Hand
  • ****
  • Posts: 333
Re: StarHaloReducer Script
« Reply #8 on: 2010 January 04 10:25:30 »
I have also seen this problem.....the first slider that I touch results in the preview region turning almost black and it is stuck like that for the rest of the session. It is an intermittent problem, because I have tried it the next day and it was fine. Intermittent problems are always the worst to track down!

I really like this script but I'm having great trouble using it. The problem is that the image at the top of the process window (the short wide preview) is a bit too small for me to judge whether I am tweaking the parameters correctly. It would be good if the image could be quite a lot larger and much closer to a 1:1 aspect ratio....prefereably equivalent to the Preview that is defined.

Cheers
         Simon

Offline Silvercup

  • PixInsight Addict
  • ***
  • Posts: 187
Re: StarHaloReducer Script
« Reply #9 on: 2010 January 06 04:20:09 »
Hola Ignacio:

Voy a bajarme la ultima version del pixi a ver que ocurre. Tengo la versión anterior y el script responde perfectamente a los ajustes.

Me acabo de bajar el PI 1.5.9 y a mí el script no me da problemas. Uso Vista 64 bits. Tengo que probarlo con más imágenes. Es algo raro lo que te pasa Ignacio.

Simon:

You can change the preview's size editing the line no. 1195 width the script editor:

Code: [Select]
this.setMinSize(600,150);
Change the 150px height width a value that ajust to your screen.

Code: [Select]
this.setMinSize(600,250);



Un saludo
Silvercup
« Last Edit: 2010 January 06 05:17:13 by Silvercup »

Offline Ignacio.R.

  • PixInsight Enthusiast
  • **
  • Posts: 77
Re: StarHaloReducer Script
« Reply #10 on: 2010 January 07 04:30:56 »
Pues yo voy con la 1.04.09.0553 eng (X86) y no puedo bajarme nada nuevo. Como mucho podría reinstalar pero poco más.
El caso es que he pensado como has hecho tu la prueba y he deducido que has abierto PI, luego una imagen y finalmente te has puesto a probar el script. Pues exactamente como comentas, el script va perfecto. El problema por lo que veo viene cuando has estado previamente procesando. Debe haber algún conflico con la memoria de alguna otra herramienta o alguna cosilla de esas.
De todas formas ya aprobecho para agradecerte el trabajo con este script. Mis halos son bastante molestos y muy frecuentes así que me viene de lujo.

Saludos

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: StarHaloReducer Script
« Reply #11 on: 2010 January 09 15:28:40 »
I am have trouble get a good result back ground comes out black. I have a beta version it does not have a background adjustment.

Max

Offline cfranks

  • PixInsight Addict
  • ***
  • Posts: 138
Re: StarHaloReducer Script
« Reply #12 on: 2010 January 27 22:20:16 »
Since this script can be used recursively, is there a way to keep it on screen between executions.  I haven't got the hang of it yet, my star has artifacts remaining from the (reduced) halo but my star image is bloated. I then have to select Script/Utilities/StarHaloetc and the parameters I used have been reset to the defaults.

Charles