Author Topic: New script: ColorMask  (Read 81907 times)

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: New script: ColorMask
« Reply #15 on: 2014 November 16 17:48:26 »
I'm definitely not up to speed with Pixel Math yet.  Could you elaborate on that method of combining masks a little?

Sure... you create the magenta mask using ColorMask and let's assume its name is "magenta_mask".  You create a star mask and fatten the stars by whatever method you prefer.  Let's call this mask "fat_star_mask".  Now, you type "magenta_mask*fat_star_mask" as the RGB/K expression in PixelMath and run the process by clicking on the new instance triangle and dropping it on either mask.  This will create a new mask (or replace the one you dropped the new instance on depending on if PixelMath has "replace target image" set.)

The pixel values of the new mask are calculated by multiplying the pixel values in the fat_star_mask and the star_mask.  Because the result of multiplying by zero is always zero, the new mask will be zero anywhere either of the source masks is zero.  You'll only get nonzero values where there is a star and the colour is also magenta.

Hope that helps...

Cheers,
Rick.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: New script: ColorMask
« Reply #16 on: 2014 November 17 03:23:25 »
Hi Rick,

Very nice and useful script. What are the "canned magic hue parameters"? Magic settings, especially when they are used to mimic the behavior of other applications, isn't something we like too much in PixInsight. In my opinion, the Red, Green, etc. color buttons should set device/application-independent hue ranges by default, such as (just sample values, not intended to be these ones precisely):

Red = {330,0,30}
Green = {90,120,150}
...

and so on. Then you can create an auxiliary dialog to define custom color range presets. User-defined color range presets can be stored as plain text files (for example, CSV files) that your script can load very easily on demand. With this change your script would be a really powerful, general-purpose image processing tool. Let me know if you need help to implement this.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline cdesselles

  • PixInsight Addict
  • ***
  • Posts: 164
Re: New script: ColorMask
« Reply #17 on: 2014 November 17 04:18:13 »
Two great responses Rick and Juan.  Seeing this script come into its full potential is exciting to watch.  A learning process all to itself.   :D

Celestron CPC1100 - Canon 550D (T2i) and of course, Pixinsight!

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: New script: ColorMask
« Reply #18 on: 2014 November 17 11:04:07 »
Hi Rick,

Very nice and useful script. What are the "canned magic hue parameters"? Magic settings, especially when they are used to mimic the behavior of other applications, isn't something we like too much in PixInsight. In my opinion, the Red, Green, etc. color buttons should set device/application-independent hue ranges by default, such as (just sample values, not intended to be these ones precisely):

Red = {330,0,30}
Green = {90,120,150}
...

and so on. Then you can create an auxiliary dialog to define custom color range presets. User-defined color range presets can be stored as plain text files (for example, CSV files) that your script can load very easily on demand. With this change your script would be a really powerful, general-purpose image processing tool. Let me know if you need help to implement this.

Thanks, Juan.  The predefined colour parameters are a hangover from the original attempt to emulate Bob Franke's technique for narrowband colour.  I agree that a mechanism to allow for presets is a much better and more general solution.  I'll have a go at implementing that and let you know if I need any help.

Cheers,
Rick.

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: New script: ColorMask
« Reply #19 on: 2014 November 17 11:29:23 »
Rick,

Is it possible to add a selection for a wavelength range? I know the user must define the color space properly but I would think that type of masking would be very helpful.



Mike

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: New script: ColorMask
« Reply #20 on: 2014 November 17 12:04:59 »
Rick,

Is it possible to add a selection for a wavelength range? I know the user must define the color space properly but I would think that type of masking would be very helpful.



Mike

Mike,

Do you mean something like providing a preview and matching the range of hues it contains?  That seems like an interesting idea.

Cheers,
Rick.

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: New script: ColorMask
« Reply #21 on: 2014 November 17 13:42:12 »
Rick,

Exactly. Build bandpass, bandstop filters with masks.


Mike

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: New script: ColorMask
« Reply #22 on: 2014 November 17 13:58:21 »
Exactly. Build bandpass, bandstop filters with masks.

I put that on the wishlist and give it some thought...

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: New script: ColorMask
« Reply #23 on: 2014 November 17 15:04:32 »
Thanks Rick. This might push me into learning the world of PI Scripting.


Mike

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 931
  • Two questions, Mitch . .
    • Jim Morse Astronomy
Re: New script: ColorMask
« Reply #24 on: 2015 January 07 12:18:24 »
RickS,

Got a chance to do some narrowband processing during the holidays with images that had given me fits in the past and I found your ColorMask tool invaluable.  Finally was able to get the Hubble Palette colors where I wanted them.

Thanks for a great script!!  ;D

Best,

Jim
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
Apogee Aspen 16803
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMorse

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: New script: ColorMask
« Reply #25 on: 2015 January 07 18:59:21 »
I'm very glad it was helpful, Jim!  I'm still planning to do a new version based on the feedback I have received.  I just need to stop processing images for a few nights (and spending time with my family) to do it  :D

Cheers,
Rick.

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 931
  • Two questions, Mitch . .
    • Jim Morse Astronomy
Re: New script: ColorMask
« Reply #26 on: 2015 January 08 07:32:08 »
Rick,

I can understand the processing, but the family?  What are you thinking??  >:D

Best,

Jim
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
Apogee Aspen 16803
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMorse

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: New script: ColorMask
« Reply #27 on: 2015 January 08 13:10:15 »
Rick,

I can understand the processing, but the family?  What are you thinking??  >:D

Best,

Jim

Just thought I'd mention it in case my wife walks past the screen  ;)

Offline g.oikonomou

  • Newcomer
  • Posts: 1
Re: New script: ColorMask
« Reply #28 on: 2015 March 27 15:43:24 »
Hi !!!
I would like to learn how can I apply the script colour mask? You must set the parameters in the start, middle and end hue or is by definition for each image

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Re: New script: ColorMask
« Reply #29 on: 2015 March 27 18:43:06 »
Hi !!!
I would like to learn how can I apply the script colour mask? You must set the parameters in the start, middle and end hue or is by definition for each image

Yes, you select a hue range each time you run the script or you can click on one of the colour buttons to select a pre-canned range.

I'm still intending to do a major revamp of the script and implement the suggestions from Juan et al.  I just need to find a spare evening or two...

Cheers,
Rick.