Hi Steve,
As often happens in astrophotography, the star mask generation problem is actually a dynamic range problem. Bright and large objects usually block stars and other small-scale structures that we want to include in the mask. To isolate all of these structures, we have to compress the dynamic range first.
Let's take a look again at the stretched working grayscale version of Sara's M82 image:
This image is the result after applying DBE (in two iterations) to the original RGB image, extracting its L component as a new grayscale image, and applying a histogram transformation with STF AutoStretch parameters. To build an efficient star mask we have to solve two main problems. One is the subject of the image, M82, which is a bright, large-scale structure. Actually, M82 is not a big problem in this case because it is a well isolated structure. Other images pose much more difficult problems with larger nebulae extended under rich star fields. Anyway, the standard procedure is to compress the dynamic range with a rather aggressive instance of HDRMultiscaleTransform (formerly HDRWaveletTransform):
After this process the image has basically a flat illumination profile that facilitates isolation of small-scale structures. As an extreme example of this technique's power, the following screenshot shows a star mask for the M42/M43 region, where we have been able to isolate all of the stars inside these objects, including all the Trapezium stars:
Back to Sara's M82 image, the second problem is less evident but somewhat harder to fix: noise. The background is rather noisy, and the StarMask routine can easily get fooled with relatively bright noise structures whose shapes and sizes are comparable to those of the dimmest stars we want to isolate. The ATrousWaveletTransform tool can be used in these cases with two purposes: remove the background and suppress small-scale noise:
After this step the StarMask tool works like a charm:
Here you can see the generated star mask active for the original RGB image. As expected, every star in the image has its counterpart in the mask:
The core of M82 contains some small-scale, star-like bright structures that have been included in the mask. This is a correct and in general desirable result: if we want to (un)protect the stars, why should we give a different treatment to similar structures in the galaxy? In case we have a good reason to do so, we can either tweak the star mask generation process, or use the CloneStamp tool to remove the undesired mask structures. While we can easily figure out cases where this kind of manual interventions are necessary for a star mask, they are close to the line separating admissible from unacceptable practices, so they should be applied with caution, and not before thinking about what we want to do and why.