New script: ColorMask

Hi Boris - me again! One small point if I may, you still have DEBUG set to "true" in this version, so users will get loads of debug information output to their process console.
CS, Mike
 
Hi Boris - me again! One small point if I may, you still have DEBUG set to "true" in this version, so users will get loads of debug information output to their process console.
CS, Mike
Thank you, Mike, for noticing this!
I've update zip archive (also fine tuned interface elements like label alignment, etc)

CS,
Boris
 
Inspired by Boris's excellent work on this script it occurred to me that it would be really cool if we could select the hue for the mask by clicking on the target image. So I hope Rick and Boris will not object if I offer the attached further modification which allows this. The target image can be zoomed by click and drag and pixel hue values can be obtained and reflected in the hue wheel by clicking on the image.

CS, Mike

ColorMaskScriptSmall.jpg
 

Attachments

  • ColorMask mod4.zip
    154 KB · Views: 198
Last edited:
so, i've been using this script forever to make hubble palette SHO images as outlined in the first part of the thread. i had noticed over the years the problems selecting colors outside of the flow for SHO, but i always assumed i was too stupid to understand the colorspace and thus the problem was between the keyboard and chair. i've also met rick personally and he's a smart guy so that just added to my bias.

i guess i'd have to go repeat the experiments in adam's video to understand exactly what colors are being selected when you click green/cyan/yellow for the flow given above. it's got to be reasonably close or i don't think the colors would come out right. i do notice though that the final results always differed a little bit based on the project, though i kind of liked that aspect.

has anyone gone thru an SHO image after making the CIEh -> H fix or these improved versions of the script?

we should get @Juan Conejero to distributed this fixed script with PI, since the old one was clearly wrong.
 
Inspired by Boris's excellent work on this script it occurred to me that it would be really cool if we could select the hue for the mask by clicking on the target image. So I hope Rick and Boris will not object if I offer the attached further modification which allows this. The target image can be zoomed by click and drag and pixel hue values can be obtained and reflected in the hue wheel by clicking on the image.

CS, Mike
Mike,

I have try it and I think this is very useful feature for mask fine tuning. Previously you would need to switch probe readout mode to HSV and (probably with the help of napkin) try to to memorize those hue readout values. Great job!

If I might suggest - i think it would be useful to add autostretch button to preview, because sometimes you need to work with linear images

CS,
Boris
 
Mike,

I have try it and I think this is very useful feature for mask fine tuning. Previously you would need to switch probe readout mode to HSV and (probably with the help of napkin) try to to memorize those hue readout values. Great job!

If I might suggest - i think it would be useful to add autostretch button to preview, because sometimes you need to work with linear images

CS,
Boris
Thank you for your kind feedback Boris.

I think an STF facility is a great idea. I have updated the zip file in my previous post (to avoid a proliferation of versions!) to include this suggestion. What I have done is to add an "Enable STF" checkbox. This will then apply the STF of your target image to the preview - that way you can reflect a custom STF not just the PixInsight auto STF.

CS, Mike
 
Thank you for your kind feedback Boris.

I think an STF facility is a great idea. I have updated the zip file in my previous post (to avoid a proliferation of versions!) to include this suggestion. What I have done is to add an "Enable STF" checkbox. This will then apply the STF of your target image to the preview - that way you can reflect a custom STF not just the PixInsight auto STF.

CS, Mike
Mike,
I've tested your new release and it works like a charm.
Also added probe size choosing to average hue readings - useful in case of noisy image (backround readings in particular).

UPD. Hue averaging is done with the help of so called circular mean.

CS,
Boris

P.S. May be it's a time for asking @Juan Conejero to include it in PI?;)

1678694103296.png
 

Attachments

  • ColorMask mod5.zip
    153.7 KB · Views: 344
Last edited:
Mike,
I've tested your new release and it works like a charm.
Also added probe size choosing to average hue readings - useful in case of noisy image (backround readings in particular).

CS,
Boris

P.S. May be it's a time for asking @Juan Conejero to include it in PI?;)

View attachment 18014
Hi Boris

I initially had a probe size option in my code but I removed it. You get some spurious answers, especially in the Red regions, if you average over Hue values. For example a Hue of 359 (definitely red) and one of 1 (also definitely red) will average to a Hue of 180, ie Cyan! As another example Hues of 0 (red) and 240 (blue) will average to 120 (green - nothing to do with either!). I concluded better to leave this option out as it really wasn't helpful, in fact worse than that - confusing, and better to allow the user to drag the colour reticle around to area pixel by pixel and examine the hue ranges for themselves.

What do you think?

CS, Mike
 
Hi Boris

I initially had a probe size option in my code but I removed it. You get some spurious answers, especially in the Red regions, if you average over Hue values. For example a Hue of 359 (definitely red) and one of 1 (also definitely red) will average to a Hue of 180, ie Cyan! As another example Hues of 0 (red) and 240 (blue) will average to 120 (green - nothing to do with either!). I concluded better to leave this option out as it really wasn't helpful, in fact worse than that - confusing, and better to allow the user to drag the colour reticle around to area pixel by pixel and examine the hue ranges for themselves.

What do you think?

CS, Mike
Hello Mike,

Just in case you wish to revisit the problem of averaging angle-like quantities, have a look at the
 
Hi Boris

I initially had a probe size option in my code but I removed it. You get some spurious answers, especially in the Red regions, if you average over Hue values. For example a Hue of 359 (definitely red) and one of 1 (also definitely red) will average to a Hue of 180, ie Cyan! As another example Hues of 0 (red) and 240 (blue) will average to 120 (green - nothing to do with either!). I concluded better to leave this option out as it really wasn't helpful, in fact worse than that - confusing, and better to allow the user to drag the colour reticle around to area pixel by pixel and examine the hue ranges for themselves.

What do you think?

CS, Mike
Hello Mike,

Just in case you wish to revisit the problem of averaging angle-like quantities, have a look at the
Good point, guys!
UPD. Thank you for pointing out that bug. The math was changed. Now hue values of 355, 5 and 15 degrees are correctly averaged into 5 degrees.

UPD2. Mike is right this is not so usefull option in case of noisy images. So this is feature more from "just in case" category.
 
Last edited:
Good point, guys!
UPD. Thank you for pointing out that bug. The math was changed. Now hue values of 355, 5 and 15 degrees are correctly averaged into 5 degrees.

UPD2. Mike is right this is not so usefull option in case of noisy images. So this is feature more from "just in case" category.
Your's is now downloading fine and works well - Good work!

CS, Mike
 
Boris & Mike: This is brilliant. I concur with pfile: we should get @Juan Conejero to distribute this script with PI. If that happens a little documentation would be nice. This is now a very powerful script, with more complex features than the original.
 
To answer you question about downloading and running this script (also helpful for other scripts) you need to:
  • Download the ColorMask mod5.zip above.
  • Unzip and place the two files (ColorMask_mod.js and hue-wheel.png) into your PixInsight\src\scripts directory.
  • From within PixInsight, go to Script>Feature Scripts... and click Add.
  • Navigate to your PixInsight\src\scripts\ directory (ie the directory you just added the new files to)
  • Click to Open the directory.
  • PixInsight should then present you with a message saying a new script is found - click OK and then Done.
  • The ColorMask_mod script should now be available under Script>Utilities (note the old ColorMask script will also be there so don't confuse them!)
 
Thanks, Mike. It was step two that I was unsure as to how to place the two files into PI.

Greatly appreciate your help as I have enjoyed using this script the past 5 years and am highly anticipating using the new version.
 
Back
Top