Author Topic: Masks Again  (Read 9974 times)

Offline sreilly

  • PixInsight Padawan
  • ****
  • Posts: 791
    • Imaging at Dogwood Ridge Observatory
Masks Again
« on: 2011 December 29 12:34:07 »
I have been going over the tutorials for MMT and HDRMT with great interest but always come back to generating the useful mask. With me it seems to be a lot of trial and error, mostly error. What I seem to find is that very bight stars have a tendency to be missed. Seems that in order to get them included in the mask I need to increase the number of wavelet layers from the default of 5 to 7. That seems to get the brights stars but then I'm left wondering what else have I done. Is the a way to see a real time preview of the affects the change of settings is having? Using the live preview with tools such as MMT show you exactly the affect on your image and assist a great deal with dialing in on the right parameters. As it is now I spend a good deal of time generating one mask after another and applying them to see if they cover the needed regions, discarding the ones that don't and trying again. Am I making this harder then it needs to be? Right now I'm working on two images, M33 and M42. The M33 image has some brights stars that get excluded and of course I'd really like to protect the Trapezium stars as well in M42. Suggestions would be very welcomed.

Thanks,
« Last Edit: 2011 December 30 05:25:49 by sreilly »
Steve
www.astral-imaging.com
AP1200
OGS 12.5" RC
Tak FSQ-106ED
ST10XME/CFW8/AO8
STL-11000M/FW8/AO-L
Pyxis 3" Rotator
Baader LRGBHa Filters
PixInsight/MaxIm/ACP/Registar/Mira AP/PS CS5

Offline RobF2

  • PixInsight Addict
  • ***
  • Posts: 189
  • Rob
    • Rob's Astropics
Re: Masks Again
« Reply #1 on: 2011 December 30 02:02:30 »
I'd be very interested to hear people's approaches to these sorts of things too....
FSQ106/8" Newt on NEQ6/HEQ5Pro via EQMOD | QHY9 | Guiding:  ZS80II/QHY5IIL | Canon 450D | DBK21 and other "stuff"
Rob's Astropics

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Masks Again
« Reply #2 on: 2011 December 30 10:23:50 »
i suppose depending on whether or not your image has been stretched, you might be able to use RangeMask to pick up the large stars, and then smooth the mask with atrous. and then if need be, use pixelmath to merge the 'large structure' mask with a regular star mask.

Offline sreilly

  • PixInsight Padawan
  • ****
  • Posts: 791
    • Imaging at Dogwood Ridge Observatory
Re: Masks Again
« Reply #3 on: 2011 December 30 11:23:02 »
Sorry to be daft but you've completely lost me on that.
Steve
www.astral-imaging.com
AP1200
OGS 12.5" RC
Tak FSQ-106ED
ST10XME/CFW8/AO8
STL-11000M/FW8/AO-L
Pyxis 3" Rotator
Baader LRGBHa Filters
PixInsight/MaxIm/ACP/Registar/Mira AP/PS CS5

Offline marekc

  • PixInsight Addict
  • ***
  • Posts: 177
Re: Masks Again
« Reply #4 on: 2011 December 30 18:12:42 »
Sreilly, I think I have the same desire that you do, if I understand your original question.

It sounds like you're asking how to mask the largest, most `bloated' stars in an image, especially after stretching the image (e.g. with Histogram Transformation).

I'm intrigued by pfile's suggestion, although I, too, don't quite understand how one would implement it. I'll go look for RangeMask - I've never noticed that before.

Most importantly, I'm curious about this specific suggestion from pfile:

``...use PixelMath to merge the `large structure' mask with a regular star mask.'

Which PixelMath operator should we use for that? Simple addition of two images (i.e. `+')? Max? Min? Please forgive me for being so dense about this, but this is the kind of `PI basics' that I don't yet know.

- Marek

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Masks Again
« Reply #5 on: 2011 December 30 21:05:05 »
oh, sorry, i meant "RangeSelection." it pretty much just selects pixels which fall inside of some range. so if you told it to select 0.8 to 1, you'd be picking up the brightest structures in the image, for instance.


Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Masks Again
« Reply #6 on: 2011 December 30 21:13:44 »
so ferinstance, check the attached screenshot. the starmask was made with the default parameters. the rangemask was made with the parameters shown, and then i just hit it with the Atrous shown. finally, i used the pixelmath expression ~(~star_mask-range_mask), but star_mask|range_mask would also work okay.

i dunno if this particular mask makes sense or not, but there you go...

Offline marekc

  • PixInsight Addict
  • ***
  • Posts: 177
Re: Masks Again
« Reply #7 on: 2011 December 30 23:22:25 »
Thank you very much, that's just the information I was looking for!

Offline RBA

  • PixInsight Guru
  • ****
  • Posts: 511
    • DeepSkyColors
Re: Masks Again
« Reply #8 on: 2011 December 31 00:40:16 »
If you want to target only the larger stars in your image, also try high values for Shadows and Midtones in the StarMask tool - something in the neighborhood of 0.8 ~ 0.9



Offline sreilly

  • PixInsight Padawan
  • ****
  • Posts: 791
    • Imaging at Dogwood Ridge Observatory
Re: Masks Again
« Reply #9 on: 2011 December 31 11:23:10 »
Keeping with the example of M81/82 and using MultiscaleMedianTransform and HDRMultiScaleTransform, the mask is suppose to protect the bright areas of the image so noise reduction is performed on the background area (lower S/N areas), at least that's my understanding. Using the StarMask tool as is I find that if I have really bright stars, M42 Trapezium stars for example, they don't get masked and therefore aren't protect properly which usually leave artifacts in their place. While this is an extreme example, the M33 image had 2-3 very bright stars I also could not get covered in the mask. That is from my lack of fully understanding how to control how to control the mask coverage area and so far I haven't come across any information in lay terms that I can understand that explains this. Harry's video covers the basics very well but leaves the finer points as "experimentation required" which is where I guess I'm at.

What would be very helpful for this topic of masks might be a list of processes that need  masks and an example of how to approach making a proper mask for that situation. I love PI, as it offers more control than any program I've ever used, has vastly improved my image processing results, and has so much potential to do even more. I'm at a point where I'm trying to discover what more can be done, why, and how.

At this point I basically use PI to align my images, stack the individual into master images (red, green, blue, luminance, Ha), combine into RGB image, neutralize the background, color calibrate, create basic masks sometimes successfully, apply the HDRMultiscaleTransform tool for finer detail (depth), apply histogram stretching, reduce noise using MMT, use dynamic crop for cleaning up the edges of images as I dither my exposures, use DBE for background issues, and LRGB Combine to integrate the master luminance image with the RGB image after using Dynamic Align to align the two images.

I guess I went off point there for a minute except to say that some of these processes benefit from the proper use of masks. I should also point out that the order I use the above is not as listed. The attached M42 image shows what I'm referring to. While I think it turned out fairly well, I could not use the HDRMultiscaleTransform tool as I could not create an appropriate mask to protect the central stars of the Trapezium. I suspect there is more faint detail I could have brought out if I could have created the proper mask.

Thanks,
Steve
www.astral-imaging.com
AP1200
OGS 12.5" RC
Tak FSQ-106ED
ST10XME/CFW8/AO8
STL-11000M/FW8/AO-L
Pyxis 3" Rotator
Baader LRGBHa Filters
PixInsight/MaxIm/ACP/Registar/Mira AP/PS CS5

Offline RBA

  • PixInsight Guru
  • ****
  • Posts: 511
    • DeepSkyColors
Re: Masks Again
« Reply #10 on: 2011 December 31 13:38:05 »
One thing some people maybe don't think of doing is to:

a) Prep the image BEFORE applying StarMask.  You can sometimes create a duplicate of your image and apply some processes to it so that later StarMask can better produce a suitable mask.

b) Do some processing to the mask generated. Yes, sometimes the star mask produced by StarMask may not be the most suitable mask for the task at hand, but some further processing to the mask itself might, whether it's applying some gaussian blur, MT, histogram adjustments, etc.

Particularly for masks targeting very large stars, some post-processing to the mask may be needed, as it's rather complicated (sometimes nearly impossible) to generate a star mask right out of StarMask that does the "right" protection. I personally don't usually bother with very large stars, but there might be situations when someone might feel something "needs to be done"...


Just some things to think about...

Offline sreilly

  • PixInsight Padawan
  • ****
  • Posts: 791
    • Imaging at Dogwood Ridge Observatory
Re: Masks Again
« Reply #11 on: 2011 December 31 14:32:05 »
I can honestly say that processing a mask is something I never thought of. Maybe this is what Juan eluded to in his example of M81/M82 using MMT. Might be worth looking into although I'm not sure what processes may be appropriate. I will say that I always do a histogram stretch to a clone and then create the mask. I don't think a linear image is any good at helping to create the mask as most of the detail is very hidden. One most often use I have for masks is HDRW where I would create the mask, apply it, invert the mask leaving only the, in most cases, galaxy to be processed. This may not be an intended use but it keeps the stars from being processed further.

This is where examples of step by step processing of nebula in general, although M42 isn't exactly a normal nebula, and galaxies with current releases would be very helpful. Of course I also realize that there is no "right" way to do this as many will have their own approach and goals. PI is an extremely complex program but well worth studying. What I also would find extremely useful is there being a reference as to when logically a tool would typically be used and especially if it is intended on linear or non-linear data.

Thanks,

I've learned a lot but have so far to go.......
Steve
www.astral-imaging.com
AP1200
OGS 12.5" RC
Tak FSQ-106ED
ST10XME/CFW8/AO8
STL-11000M/FW8/AO-L
Pyxis 3" Rotator
Baader LRGBHa Filters
PixInsight/MaxIm/ACP/Registar/Mira AP/PS CS5

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Masks Again
« Reply #12 on: 2011 December 31 19:03:56 »
your HDRW flow is exactly right with respect to masks.

regarding processing of masks... yes. for starters a lot of times you want to smooth the mask out, so some atrous is useful to remove small-scale structures. or, sometimes your mask will end up with some large scale structures that you don't want, so again atrous to the rescue. a lot of times i will make a deconvolution mask from the extracted and stretched luminance, and try to clip the blacks as much as possible to really completely mask off the background. or, sometimes i'll look at some of the dimmer areas of the mask and set all values below that value to 0 with the following pixelmath expression: iif($T<0.1,0,$T), where 0.1 is the cutoff threshold in this hypothetical example.

i'll usually just use autoSTF to stretch the luminance, and the median value of the mask won't be bright enough to really let whatever process through... so again HT or curves to the rescue to boost the highs in the mask.

as for the M42 example above, don't you want the brightest parts of the image unmasked or nearly unmasked to compress the dynamic range there? that's where it's needed the most. if you try to mask stars that are surrounded by bright nebulosity you'll probably end up with dark haloes around the stars unless you really nail the mask star size (and perhaps iterate with different masks, sort of the way the masked stretch script does...)

you might try local histogram enhancement on the brighter parts of the M42 image to improve the contrast a little bit... again thru a mask to protect the low SNR areas.

Offline sreilly

  • PixInsight Padawan
  • ****
  • Posts: 791
    • Imaging at Dogwood Ridge Observatory
Re: Masks Again
« Reply #13 on: 2012 January 02 12:30:39 »
I have downloaded all the video and example tutorials I can find over time and just watched Harry's video on Mask Saturation again. I learned something I didn't know being that by extracting the luminance from the color image and applying it to the color image creates a mask. In this particular instance Harry was using the mask to increase color saturation only for the stars and object (M106) leaving the background alone thus not increasing the background noise. Somehow I missed this when I first watched the video or I watched so many videos in a short period of time that it just was too much information too fast. Looks like going back over these from time to time will result in a few aha moments.

What I'm not clear about is what the original actually is. By that I mean is this from a one shot color camera resulting in a processed RGB image or is this by means of separate red, green, blue, and luminance images used to create a LRGB image? Does it make any difference? My cameras are mono so I end up with the later using filters to image through. Does this mean that I would create my RGB image and then use the open aligned luminance image to drag over the RGB to create the mask or would I extract the luminance from the RGB image as Harry does in the video? Again, would it make a difference keeping in mind that the master luminance image made from many luminance subs frames would most likely be of a higher s/n ratio as it would have more luminance data than the extracted luminance from the RGB.

The mentioned use of the Atrous process in the last post is something I have yet to learn and using pixel math just blows me totally away altogether. Not saying I couldn't understand it in layman terms but most of what little I've seen of it just seems to go over my head. I need to find a good reference to using pixel math. What little I've used it in other programs was basically by means of adding, subtracting, dividing, or multiplying one image from another so the expressions were completely hidden.


Steve
www.astral-imaging.com
AP1200
OGS 12.5" RC
Tak FSQ-106ED
ST10XME/CFW8/AO8
STL-11000M/FW8/AO-L
Pyxis 3" Rotator
Baader LRGBHa Filters
PixInsight/MaxIm/ACP/Registar/Mira AP/PS CS5

Offline RBA

  • PixInsight Guru
  • ****
  • Posts: 511
    • DeepSkyColors
Re: Masks Again
« Reply #14 on: 2012 January 02 15:00:37 »
Well you can do anything you want, but I wouldn't do masked saturation until I have my LRGB data all combined into one. I usually do some mild saturation on my RGB after a non-linear stretch during the LRGB combination though, but of course without masks.