| PixInsight Standard Tutorial Noise Reduction with ACDNR By Juan Conejero (PTeam) M45 image raw data acquired by Vicent Peris (Pteam) and José Luis Lamadrid |
|
ACDNR Processing Example: M45 DSLR Image Final Processed Image |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In this tutorial we introduce the new ACDNR algorithm and its implementation in PixInsight Standard. ACDNR stands for Adaptive Contrast-Driven Noise Reduction. We begin with a description of this important tool and its parameters, and complete the tutorial with a step-by-step processing example. The ACDNR tool is a highly flexible implementation of a novel, high-performance noise reduction algorithm, based on advanced multiscale and mathematical morphology image processing techniques. The ACDNR algorithm has been created by the Pleiades Astrophoto development team (PTeam) and is the fruit of more than two years of continued research and development work. As of writing this tutorial, ACDNR is available as a standard process in the public time-limited beta version of PixInsight. We hope to continue improving the ACDNR algorithm and our implementation; the feedback from our users is essential to accomplish that task. The idea behind ACDNR —as any nontrivial noise reduction algorithm— is to perform an efficient noise reduction work while preserving significant image structures. As its name suggests, ACDNR is able to adapt to the characteristics of the processed image by modifying its behavior as a function of detected contrast variations. ACDNR includes two mechanisms
that work cooperatively: a special low-pass filter and an edge
protection device. Simply put, the low-pass filter smooths the image by
removing or attenuating small-scale structures, and the edge protection
device prevents significant image structures from being damaged during
low-pass filtering. You can think of ACDNR as a system with two
contrary forces working in opposite directions: the low-pass filter
tends to simplify the image by destroying irrelevant small-scale
features (i.e., the noise), and the edge protection device tries to
avoid destruction of important features by stopping the low-pass filter
when it encounters relevant contrast variations.
ACDNR offers two identical sets of parameters: one for the luminance and another for the chrominance of color images. Chrominance ACDNR parameters are applied to the CIE a and b components in the CIE Lab color space. Luminance parameters are applied to the L component of Lab for color images, and to the nominal channel of grayscale images. In general, chrominance parameters are much less critical and can define a stronger noise reduction procedure than luminance ones. This is because the human vision system is quite poor in detecting image structures defined by chrominance variations: we perceive almost all of the detail through the luminance. However, this doesn't mean that we can neglect fine-tuning chrominance noise reduction parameters, since by doing so we can cause severe lacks of information, especially for relatively small structures with high chrominance contents, as stars in deep-sky images. ACDNR performs luminance/chrominance separations, as do all standard PixInsight processes, into rigorous, colorimetrically-defined color spaces. Conversions to and from the CIE Lab space are carried out in the current RGB working space (RGBWS) of the target image. The RGBWS can be defined with the RGBWorkingSpace standard process and its interface, available under the ColorSpaces category. For both luminance and chrominance subsets, ACDNR parameters divide into two sections: filter parameters and edge protection parameters.
We define an edge as a brightness variation that the edge protection device tries to preserve (protect) from the adverse effects of low-pass filtering. If we consider an edge as the locus of a brightness change, then for each edge there is a dark side and a bright side, depending on the direction we follow when crossing it. ACDNR's edge protection gives separate control over dark and bright sides of edges. For each side, there is a couple of identical parameters, namely threshold and overdrive.
In addition to side-specific edge protection parameters, ACDNR includes three additional parameters that control the overall behavior of the edge protection device: robustness enforcing method, minimum structure size, and prefiltering.
We have implemented an additional feature to improve ACDNR's flexibility and applicability. It is an inverse luminance mask that modulates the noise reduction work. Where the mask is black, original (unprocessed) pixels are fully preserved; where the mask is white, noise reduction acts completely. Intermediate gray mask levels define a proportional mixture of unprocessed and processed pixel values. This mask can be useful to protect high-SNR regions while applying a strong noise reduction to low-SNR ones. A typical example of this is to smooth the background of a deep-sky image while leaving bright regions intact. The ACDNR mask is generated and
controlled with the help of three parameters: midtones balance,
shadows clipping and highlights
clipping. These parameters define a histogram transform that
is applied to a copy of the luminance that is used to mask the noise
reduction process. Take into account that an inverse mask is always
generated, which means that you must reverse your logic when varying
these histogram parameters; with a little practice you'll find no
problem with this. To help achieving a correct mask with a minimal
effort, the ACDNR interface includes a special mask preview
mode. When this mode is enabled, the ACDNR process simply generates the
mask, copies it to the target image, and terminates execution. When
used along with the Real-Time Preview interface, this mask previewing
mode is particularly useful.
This is an optics test shot that has not been calibrated: no darks or flats have been applied. Consequently, the original images have strong gradients and a number of hot and cold pixels. The two raw images were loaded and debayerized. They were then converted to the 32-bit floating point format with the SampleFormatConversion process. The 16-bit integer sample format is normally sufficient to perform moderately complex processing works. However, the PixInsight platform allows you to use five data formats transparently: 8, 16 and 32-bit unsigned integers, as well as 32 and 64-bit IEEE 754 floating point. Transparent here means that all processes can perform without distinction (other than the inherent accuracy differences) on any of the five supported data formats.
After conversion to the 32-bit floating point format, the raw images were registered with DynamicAlignment, then averaged with PixelMath. We'll spare you the details of these two procedures, which are quite simple.
We have applied two iterations of the DynamicBackgroundExtraction (DBE) process, subtracting the generated synthetic background models with PixelMath.
First DBE application. Note the ScreenTransferFunction interface being used. It allowed us to see the unstretched image without actually modifying it. In this way we were able to generate a background model for the linear unstretched image, before applying any nonlinear transform to raw pixel values. We began generating a grid of DBE samples automatically. DBE's statistical rejection system avoided most samples on M45 and its surrounding nebulosity. However, to minimize the contributions of true reflection nebulosity to the generated background model, we manually removed some samples around the central regions. We also added a few samples on the lower left corner, which DBE's rejection system considered too far away from the typical background of the image. The whole procedure was completed in less than five minutes.
First background correction. The synthetic background model was subtracted from a copy of the original image. The result is quite good except for a residual gradient, visible as a horizontal stripe near the bottom. We'll try to remove it with a second DBE iteration.
Second DBE application. Residual background gradients and irregularities are very weak. Note that they appear so exaggerated due to the aggressive screen transfer function used, which we have stretched to the limit. We have taken the same DBE instance used in the previous application as the starting point for this one. This has been possible, of course, because we saved the previous DBE instance as a process icon. This time we have manually added more samples on particularly difficult areas, as the horizontal stripe near the bottom, and some regions with relatively strong color variations.
Second background correction. Again, the synthetic background model, which can be seen at the lower left corner on Figure 9, was subtracted from a copy of the resulting image after the first correction. The result, at the lower right corner, is more uniform, though still not perfect. Take into account, however, that the images are being shown here heavily stretched with aggressive screen transfer functions. We could go further perfectioning background modelization/correction, but we think that what we have now is reasonably good for an uncalibrated DSLR image.
Figure 10 shows the initial histogram stretch being adjusted with the HistogramTransform interface working in real time preview mode. We have been very careful to avoid clipping too many background pixels at this stage: note the shadows clipping point located just at the starting point of the main histogram peak. The background is strongly dominated by the noise now, and setting many background pixels to zero now would largely complicate a subsequent noise reduction. By clipping background pixels, contrast is strongly increased between adjacent noisy pixels. Noise reduction algorithms, especially those based on local contrast gradients like ACDNR, may have a hard time trying to distinguish significant image structures under such situation. After having applied noise reduction, we'll be able to stretch the image appropriately, as we'll demonstrate later.
In our next step we set a custom RGB working space (RGBWS) with equal luminance coefficients. This step is important because the RGBWS determines how luminance/chrominance separations are performed in PixInsight. The luminance coefficients are taken as relative weights to determine the contribution of each color to the luminance of the image. Most processes in PixInsight work separately for the luminance and chrominance components of images, and ACDNR is no exception. With a uniform RGBWS (equal luminance coefficients) we are telling PixInsight that the three individual RGB colors have the same importance for the calculation of luminance in this image. This will allow us to gather more information in the luminance, where visible image detail is actually supported.
Below is a series of mouseover comparisons that will help you in evaluating our noise reduction results with ACDNR. We are quite satisfied, but no image processing technique yields perfect results, and of course our implementation is no exception. On these comparisons, please note that all small-scale noise has been virtually suppressed, while significant image structures have been well preserved in both luminance and chrominance. This must be the goal of any serious noise reduction procedure. Bright stars show colorful diffraction spikes on the original image, which our noise reduction process has left mostly discolored. Note that this side effect has been intentional, as we don't like colorful spikes (we do like spikes, but when they are colorful, we think that they steal protagonism to the astronomical subjects).
Step 4: Defining an ACDNR Luminance Mask
An efficient noise reduction is not the easiest task for this Pleiades image. What makes it a difficult target is the fact that fine details are defined by very subtle contrast variations, but at the same time, relatively high amounts of noise are present on the background and larger areas covered by faint nebulosity. Normally, ACDNR doesn't need the help of a mask to work very efficiently. This is true for most deep-sky and diurnal images. However, there are difficult cases, like the present one, where a protection mask is necessary to achieve the appropriate noise reduction strength for all image areas and features at the same time. For this reason we have implemented a specific luminance mask generation tool in the ACDNR interface. As can be seen on Figure 13, the generated luminance mask will limit noise reduction on the brightest regions of the nebulas, where the signal-to-noise ratio is relatively high, and delicate structures need extra protection.
Step 5: Defining Luminance and Chrominance ACDNR Parameters As we stated earlier in this document, ACDNR provides two identical sets of parameters: one for the luminance and another for the chrominance components. Each set must be defined separately for color images.
This is the step-by-step practical procedure to work with ACDNR for color images:
We start with the luminance. On Figure 14, you can see how our luminance ACDNR parameters are being fine tuned with the separate technique explained above.
Once luminance ACDNR parameters have been accurately defined, we proceed with the chrominance. Again, we use the separate technique explained at the beginning of this section. On Figure 15, note the Chrominance a/b special display mode. This mode is being used to see the chrominance of the image isolated from the luminance. This is the most effective way to work with ACDNR for the chrominance. Remember that in this mode red and green are used, respectively, to render the a and b components of the CIE Lab color space.
Finally, we must try the whole ACDNR process with several previews of our image. Both luminance and chrominance parameter sets have been activated (Apply check boxes checked), and the normal composite RGB display mode has been selected.
Step 6: Histogram Stretch After Noise Reduction
After an efficient noise reduction work, no part of the image is dominated by the noise now. This is particularly evident on the sky background and other dark areas, where the signal-to-noise ratio was very low. A direct consequence of this is that the histogram shows now a nice unused portion at the shadows end. We call it nice because it allows us to increase the overall contrast of the image without losing any data. In other words, now we can use the histogram to stretch the image as necessary, because the histogram is no longer dominated by the noise, but only by significant data.
Step 7: Building a Mask for Selective Color Correction
In the next step we are going to apply a color correction to enhance the blue color of reflection nebulosity. However, we want to apply that correction to the most illuminated areas of the image exclusively, not to the background. The background is nicely neutral now, and we don't want to change this by no means. So what we want is to apply some processes selectively, limiting their effects to appropriate areas of the image, and to achieve that a mask must be used in PixInsight.
Step 8: Selective Color Correction
As we have said, we want more blue reflection nebulosity. It is too cyan, in our opinion. The excess of green can be fixed in several ways. One quite obvious is a set of transfer curves applied with the CurvesTransform process. That would work for sure, but we want to try something new here. The SCNR process (Subtractive Chromatic Noise Reduction) has been designed to remove green noise in deep-sky images. You can read more about the SCNR algorithm on a specific section of the official PixInsight LE documentation. The implementation of SCNR that we have included in the default set of processes for PixInsight Standard adds new features, with respect to the version included in PixInsight LE. One of them is a new protection method, namely minimum neutral, that can be used in cases like the present one with great results. We have to say that this use of SCNR is not quite orthodox, but it works very well indeed. We always want to have our mind open to discover new processing strategies, and this is just one of those cool things that bring out of our imagination. On Figure 20, you can see how a correct dosage of minimum neutral SCNR achieves the exact blue color that we were looking for. Of course, the luminance mask that we built in the preceding step is essential here to avoid altering the background, whose neutrality must be preserved.
How about improving the colors of the stars? There are many red stars in this image that contrast beautifully with the dominant overall blue. This is just the kind of things that we pursue when we process an excellent astrophoto like the present M45 image. We indeed can't resist the temptation to increase star color saturation, but this isn't a simple task. If we'd just increase color saturation for the whole image, we'd get a complete disaster: the bright nebulas would become severely oversaturated, and a lot of chrominance noise would be originated on the background. So once again, a special mask is required to apply the necessary color saturation transform just where it is needed. We need a mask that comprises only the stars of the image. Furthermore, we don't want to saturate the brightest stars of M45, since they are already highly saturated in brightness. The ideal tool to build star masks is the ATrousWaveletTransform process in PixInsight. With wavelets, we can isolate image structures within a given range of scales. We have devised many techniques based on multiscale processing to build star masks. One of them is pretty simple and very efficient in most cases. You can see it in action on Figure 21. Pay special attention to the following aspects of the wavelet transform (please see the full-sized Figure 21):
Finally, the mask can be stretched with HistogramTransform, if necessary (for example, to clip faint nonstellar features if they have been included in the mask), and a further wavelet transform can be used to remove small-scale layers, which smooths star edges.
Figure 22 shows the applied saturation curve. It defines a very aggressive color saturation increment for pixels that are poorly saturated. Of course, without the help of a special star mask, such an increment would be completely impossible.
The mouse over comparisons below clearly show what we call large-scale noise, and how we have managed to remove it with ACDNR. Large-scale noise affects low signal-to-noise ratio areas, especially the sky background and the dimmest nebular regions. ACDNR with a large filter and an appropriate protection mask can deal with this type of noise efficiently.
On Figure 24, note that the ACDNR mask for large-scale noise reduction is very restrictive. This is because this type of noise exists only on low-SNR areas, which correspond to the least illuminated image areas: the sky background and the dimmest nebular regions. Hence, only those regions must be left unprotected by large-scale noise reduction masks. Remember that unprotected areas are those where the mask is white. On the other hand, a large ACDNR filter is necessary to deal with this type of noise, because it is characterized by relatively large structures. The aggressivity of the required filter would destroy small-scale structures and delicate nebular features without appropriate protection.
On Figure 25 you can see the applied large-scale noise reduction procedure. The filter used is large and aggressive: standard deviation of five pixels and three iterations. Figure 25 shows luminance ACDNR parameters; chrominance parameters are very similar. The luminance mask that we built in the preceding step has been activated for both luminance and chrominance ACDNR parameter sets. This ensures that only those regions with very low signal-to-noise ratios are being smoothed. In addition, note that ACDNR's edge protection is working flawlessly even on unprotected areas with such an aggressive filter. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||