|
PixInsight Standard Tutorial Planetary Image Processing in PixInsight Standard: Jupiter Image by Chris Go By Juan Conejero (PTeam) Image raw data acquired by Christopher Go |
|
1.1 RGB
Combination 1.2 Channel Alignment 1.3 Initial Crop 1.4 Conversion to a Floating-Point Sample Format 2.1 Defining a Custom RGB Working Space 2.2 Extracting the Luminance 2.3 Previewing Wavelet Layers 2.4 The Wavelet Transform 3.1 Protecting Significant Structures 3.2 Selecting a Noise Reduction Filter and Related Parameters 5. Additional Detail Improvement 6. Rotating, Resampling, and so on 6.1 Rotation and Mirror6.2 Uniform Background 6.3 Resampling |
||||||||||||||||||||
|
|
||||||||||||||||||||
|
Under excellent seeing conditions, and armed with exquisite optics, amateur astronomers are producing today outstanding planetary images that were inconceivable just some years ago. This is possible thanks to low-cost video cameras that allow capturing thousands of frames during relatively brief intervals, which can be registered and integrated with specialized software to yield planetary images with extremely high signal-to-noise ratios. In this tutorial, we present a step-by-step processing example with a high resolution planetary image, utilizing our new ATrousWaveletTransform process that has been included in the default set of modules of the new PixInsight Standard application. As of writing this tutorial, ATrousWaveletTransform is available in the latest time-limited public beta version of PixInsight Standard. We have written this tutorial around a high-resolution color image of Jupiter. Raw RGB data of this image have been acquired by Christopher Go, of Cebu, Philippines, who has kindly given us permission to use it. Chris has made a great contribution by proposing these raw data, of exceptional quality, as a processing challenge on some specialized forums.
Raw data for this example comes as three separate grayscale images corresponding to individual RGB channels. Each one of these images is the result of registering and integrating (also known as stacking) a large set of video frames. This initial preprocessing work has been done in the Registax application. Our first step is combining these channels to form a single RGB color image. Figure 1 shows how the ChannelCombination process can be used to perform a RGB combination very easily.
The ChannelCombination process
must be executed globally to generate a new RGB color image (identified
as Image04 in Figure 1). To execute the process in the global
application context, click the sphere icon ( 1.2 Channel Alignment The three raw channel images have not been mutually registered, so we must carry out this work before going on. At the time of writing this article, the public PixInsight Standard beta application still lacks image registration tools. A specific channel registration process will be implemented and included in the standard set of processes. However, we can use the ChannelMatch process to achieve channel registration very accurately, though this process requires some manual work. Figure 2 shows the ChannelMatch interface being used to register channels in this example.
Red offsets: dx=+7.25,
dy=–2.0 We have assumed that individual RGB channels are neither rotated nor scaled/distorted mutually. Perhaps a more accurate work could be done by registering the raw images in a specialized software, but our results have been satisfactory with this manual procedure. After channel alignment, the image shows colored rows and columns of pixels on some of its borders. This can be problematic because some algorithms that are based on global statistical properties can be fooled by these artifacts. For this reason, and to reduce the area of the working image, which in turn will facilitate our work, we have cropped it at this point. On Figure 3 you'll see how we did this with the DynamicCrop interface.
DynamicCrop allows you to crop, rotate and scale an image interactively, in a single operation. However we have used this process to perform a simple crop with no rotation at this initial stage. The crop size should not be too small, as we are going to work at relatively large scales in subsequent wavelet transforms. We have cropped to more than 500 pixels, which gives us room to work at scales of 128 pixels.
This step is not strictly required, but highly recommended. The raw images have been stored as TIFF files with 16 bits per sample. This sample format is normally sufficient to perform moderately complex processing works, but for complex operations like wavelet transforms, a floating point format is preferable. The PixInsight Standard platform allows you to use the 32-bit and 64-bit IEEE 754 floating point formats (also known as single precision and double precision, respectively). The 64-bit format can be useful to apply some critical operations to images requiring extremely large dynamic ranges. This happens with many deep-sky objects; M42 (The Great Orion Nebula) is a paradigmatic example. For planetary images, the 32-bit floating point format is sufficient. Another good option would be the 32-bit integer format, also available in PixInsight Standard, which provides an even larger effective dynamic range. Needless to say that the 8-bit integer format should never be used with images like the present one. Figure 4 shows the SampleFormatConversion interface applied to the RGB combined image, to convert it to the 32-bit floating point format.
We are proposing here a strategy based on separate processing of the luminance and chrominance components of the image. Sharpening, noise reduction and image restoration techniques should not be applied directly to the three nominal channels of a RGB color image. This includes, without limitation, techniques and algorithms like unsharp mask, deconvolution, and multiscale processing with wavelets. To better understand the problem here, consider that by processing a RGB image as a whole, each channel is being handled as an independent image without relations to the other channels, which is not true. Actually, pixel values on each channel have two contributions to the entire image: one for the luminance —the brightness, independent of color— and another one for the chrominance —the hue and saturation of color, independent of brightness. Human vision has fairly poor spatial resolution when the details to be perceived consist only of color differences. Our vision system perceives detail through the luminance almost exclusively. For this reason, luminance and chrominance should always be handled separately for the tasks of detail enhancement and noise reduction.
So it is clear that we need to separate the image into its luminance and chrominance components. However, such a separation cannot be done (or should not be done) without appropriate tools and implementations. In PixInsight, a different RGB working space (RGBWS) can be defined for each image. A RGBWS defines how luminance/chrominance separations are performed. RGB working spaces are colorimetrically defined and rigorously implemented in PixInsight. Among many other aspects, the most important parameters that a RGBWS specifies are the relative weights, or luminance coefficients, used to define the contribution of each RGB channel to the luminance of the image. These luminance coefficients are expressed in a normalized way: for example, if red counted twice as green to define the luminance, we could have 1.0 and 0.5 as the coefficients for red and green, respectively. Standard RGB working spaces are used for color management, and are associated to particular images through ICC profiles. Color management comprises color spaces and transformations to achieve consistent color through different imaging devices. While PixInsight is a fully color-managed environment, a RGBWS in PixInsight is used strictly for pure image processing tasks. By defining a custom RGBWS, luminance coefficients can be adjusted to represent as much information as possible in the luminance, where the information, under the form of image structures, is actually visible. At this point, you may want to read the documentation section on RGBWS, pertaining to the official PixInsight LE documentation, and perhaps the section about color management. The standard sRGB color space is the default RGBWS in PixInsight. This is by no means the optimal choice, but has been set in this way by design to achieve a default behavior consistent with most imaging applications. The sRGB space defines the following luminance coefficients (relative to the D50 reference white):
The above figures say that green counts in excess of ten times more than blue for the calculation of luminance, and some three times more than red. This can be true in terms of human visual perception, but it is clearly wrong in terms of the information contents transported by each color in an astronomical image. In deep-sky images, green is not present but on stellar images and O-III regions of some planetary nebulae. Contrarily, red and blue are essential to describe emission and reflection nebulae. In our present Jupiter image, is one of the three colors more relevant than the others, in terms of the information that it describes? We don't dare to guess here, so we'll simply define a custom RGBWS where the three RGB colors have identical coefficients, and hence the same contribution to the luminance. While this may not be strictly true, it is not too wrong either. On Figure 5 you can see the RGBWorkingSpace interface with the custom RGBWS defined. Note the three luminance coefficients with a value of 1.0. This RGBWS has been applied to the RGB combined image, and will remain active for luminance/chrominance separations from now on.
The luminance of the RGB image, as the L component in the CIE Lab color space, can be easily extracted as a grayscale image with the ChannelExtraction interface, as shown on Figure 6. This is the luminance that we'll process with wavelets in our next processing step.
Now we are ready to start luminance processing. As we have said, the main tool that we'll use in this example is the new ATrousWaveletTransform process in PixInsight Standard. However, before applying wavelets, it is always a pretty good idea to perform a detailed analysis of the image to learn the kind of image structures that are present in different wavelet layers. This is in fact an essential preparatory step if we want to achieve a consistent and well founded processing. The ATrousWaveletTransform interface has several layer preview modes. In these special modes, the process isolates a given wavelet layer and generates an accurate representation of its contents. An example is on Figure 7, where the first wavelet layer of the image is being isolated in this way.
The ATrousWaveletTransform interface has in fact four layer preview modes:
Now let's use the All Changes layer preview mode of ATrousWaveletTransform to take a survey of image structures at several dimensional scales. The result is on Figure 7a. Figure 7a— The first eight wavelet layers in the dyadic scaling sequence, using the default 3x3 linear interpolation scaling function of ATrousWaveletTransform. Click on the images to see full-size versions.
Figure 8 shows an initial try with the second wavelet layer and default ATrousWaveletTransform parameters, except the increased bias. A wonderful plethora of details and small image structures brings out easily, in a surprisingly natural way, showing us that we are facing an exceptional planetary image, among the best works of its class. A moderate amount of noise also appears, as we of course were expecting, but this is just a first contact with the image —let's continue with our pre-designed plan, and we'll see what this beast is going to afford us.
Our complete wavelet transform for the luminance can be seen on Figure 9. Compare the parameters on the ATrousWaveletTransform interface with our previous plan, depicted at the end of Section 2.3.
There are important aspects about the set of ATrousWaveletTransform parameters shown on Figure 9 that require a detailed explanation.
Figure 10 shows how the high dynamic range extension parameter value must be carefully adjusted to avoid saturation of the brightest details in the image. Under strong magnification, one must watch sample values to adjust the parameter to its lowest possible value. On Figure 10, note the 0.9920 readout being taken. I recall that in PixInsight all pixel values are expressed in the normalized range from zero to one (0=black, 1=white).
Finally, when we are happy with our results, the ATrousWaveletTransform process must be applied to the image. Until then, we have been using a preview to try out parameters. Figure 11 shows the luminance image just after having applied the wavelet transform.
We want to point out that the processing strategy that we have implemented is by no means the only valid path that can be followed with images like the present one. For example, the HistogramTransform and/or CurvesTransform processes could be used to obtain the desired brightness and contrast levels. You may ask now why do we need a specific processing for the chrominance of this Jupiter image. Having processed the luminance, why not combine it with the RGB image, by direct substitution of the L component of CIE Lab, for example? The answer to this question is twofold:
Fortunately, processing the chrominance in images like the present one is not difficult at all: having found a good way to improve the luminance, we'll use just the same procedure, but applying a much stronger noise reduction at small and medium scales. Since the chrominance does a very weak contribution to perception of details, we can smooth it much more than the luminance, as long as we provide sufficient chrominance support to significant luminance structures. So the idea behind chrominance processing is to apply a wavelet transform, with strong noise reduction, to the original combined RGB image. This yields a smooth chrominance and an oversmoothed luminance, which will be discarded and replaced with the previously processed luminance. Figure 12 shows the result of applying the same wavelet transform that we used for the luminance, but this time to the original, combined RGB image. Note that we have selected both luminance and chrominance on the Target section of the ATrousWaveletTransform interface.
The obtained result is not bad, but don't ask now why aren't we happy applying this transform to the RGB image, because we are going to do much better than this. Shortly you'll see this point well demonstrated. If you look at the full-size screenshot of Figure 12, you'll notice the presence of noise. Most of this noise is chrominance noise, which we are going to suppress now.
Our new ATrousWaveletTransform process includes a powerful noise reduction algorithm that works on a per-layer basis. If you are accustomed to the wavelet noise reduction that we implemented in the PixInsight LE application, then prepare to see a completely different, much more efficient and accurate noise reduction in this new process. The new noise reduction works with the help of a sophisticated significant structure detection algorithm. For a given wavelet layer, significant structures are detected and isolated as a protective mask used to avoid degradation of significant details during the low-pass filtering applied to remove noise. The significant structure detection algorithm performs most of its work in a completely automatic way; it just needs two simple parameters to be adjusted by the user: Threshold and Range.
To help the user in the task of finding the optimum values of these two parameters, which is actually very easy, the ATrousWaveletTransform interface provides a special layer preview mode, namely the Significant Structures preview mode. In this mode, white pixels are being fully detected as pertaining to a significant structures, while black pixels are completely outside any significant structure. Gray pixels correspond to partially significant regions. An example can be seen on Figures 13 and 14.
On Figure 13, we have used the default set of parameters for significant structure protection (Threshold=1, Range=3). Note that many bright regions of the image are being considered as significant, and hence they will be protected during noise reduction. This includes many regions where the chrominance should be fully smoothed —remember that we can apply a heavy noise reduction to the chrominance without problems. On Figure 14, we have adjusted significant structure protection parameters to more reasonable values.
We probably could have used even more restrictive parameters for the chrominance (less protected structures).
As of writing this tutorial, the new ATrousWaveletTransform process includes three noise reduction filters (more filters have been planned and will be implemented in future releases):
In all cases, it is generally preferable to use a lower value of the Amount parameter and many iterations, instead of a single iteration with a high filtering amount. By iterating, the filtering process leads to more consistent results and achieves a more efficient noise reduction.
Figure 15 shows the result of our chrominance processing. Note the noise reduction parameters for the second wavelet layer. Four iterations of the directional multiway median filter have been applied with a kernel size of seven pixels. This defines a strong noise reduction in this case, but we can afford it for the chrominance. Finally, we see on Figure 16 how we have applied the wavelet transform to the combined RGB image, after a good trial work on a preview.
Now that we have the luminance and the chrominance well processed, we obviously want to merge them. This can be done very easily in PixInsight with the ChannelCombination process, working in the CIE Lab color space, and extracting the CIE a and b components from the processed RGB image. But once again, we have a much more powerful tool: the LRGBCombination process. With this process, we can:
For a detailed description of the LRGBCombination process and a complete processing example, you can read this tutorial on LRGB combination in PixInsight Standard. Figure 17 shows the LRGBCombination process being tested on a preview of the processed RGB image. Figure 18 shows the result and LRGBCombination parameters in more detail.
Note that we only have to specify the luminance source image, since the chrominance channels are those of the target RGB image. In this example, we are quite happy with the existing chromatic balance, so we haven't used different weights for any of the individual RGB channels. We have applied a slight correction to the luminance (see the Transfer Functions group box on the LRGBCombination interface). This correction has darkened the image, but we definitely like the resulting overall contrast. Of course, we have increased also color saturation. You may think that we went too far in this sense, or perhaps you would have saturated it more than us; this is a matter of personal preferences.
The chrominance noise reduction algorithm included in LRGBCombination is perhaps one of our best creations. It makes it possible to apply even brutal color saturation increments without chrominance noise amplification. Only two parameters govern this algorithm:
To find the optimal parameter values, the best way to evaluate chrominance noise is by inspecting the image using one of the chrominance display channels in the PixInsight application. Figure 19 shows how the image looks like under the "CIE a=R b=G" display mode. In this mode, the CIE a component is mapped to red and the CIE b component is represented as green. Note that in this mode the luminance of the image is not represented at all.
You can also select one of the CIE a, b, c and h components for display, and even the "L=0.5" special mode. In this mode, the image is represented with its luminance replaced with a constant value of 0.5, which isolates the chrominance in true color. The "L=0.5" mode is not very efficient to evaluate chrominance noise, though.
The image looks pretty good now, but we think that it still has many small structures that could be greatly improved. An additional wavelet transform can be applied to the second wavelet layer, where we know that most small-scale structures are contained (see the discussion in Section 2.3). However, this new transform must be applied very carefully, since the noise is at this point awaiting us to make just a small mistake. On Figure 20 you can see our additional wavelet transform, being tested on a preview of the LRGB combined image.
The following important aspects of this additional wavelet transform must be pointed out:
The next mouse-over comparison can be used to evaluate the result of this additional wavelet transform. Of course, there is room for more improvement of small image features, but we like the obtained compromise between detail visibility and natural look. As happens so many times in astrophotography, this is a matter of preferences and common sense.
We are now at the very final stages of our processing work. What remains to be done is usually thought of as a set of cosmetic adjustments, more than as true image processing, when compared to the complex procedures that we have implemented. However, these final steps are no trivia, and failure to apply them properly can ruin our efforts to some extent. We have found that by rotating the image some 67.5 degrees counter-clockwise and mirroring it horizontally, Jupiter's disk is shown with its equator horizontally aligned, and with its north pole facing up. Figures 21 and 22 show these operations.
On Figure 21, note that we have selected the bicubic spline interpolation algorithm for rotation. This algorithm provides higher numerical accuracy than bicubic interpolation, and is well suited when one wants to ensure that there will be no detail lost during rotation. With the selected block size of 5 pixels, the bicubic spline algorithm will interpolate each pixel from its 25 neighbors. After all, this image has required too much effort to degrade it now with a so simple operation... well, rotation is actually not so simple!
The FastRotation process provides rotations by 180 degrees and 90 degrees clockwise or counter-clockwise, along with horizontal and vertical mirroring. This process never interpolates pixels: it performs its actions by copying and swapping pixel values, so there is no image degradation at all. Achieving a uniform background is actually a must for a planetary image —the spectator would be given a bad impression if we'd present this image over an irregular background. By rotating the image, we have introduced a nonuniformity, because the rotation algorithm has filled the four corners of the image with a constant value. In addition, wavelet transforms and other image restoration techniques can produce irregular backgrounds that are perceived as ugly artifacts. The PixelMath process is the perfect cure in PixInsight for all these irregular background problems. With PixelMath you can define an expression that is applied to a set of images, pixel by pixel. Explaining the full syntax and capabilities of a complex process like PixelMath exceeds the scope of this tutorial, but you can review a PixelMath reference document if you are interested. In our present case, we'll use the following PixelMath expression applied to our final image, after rotation and mirroring: Max( $target, 0.03 ) This expression will replace every pixel below 0.03 (in the normalized range 0=black,1=white) with that value. This is simple but pretty efficient. The 0.03 value has been chosen after looking at the statistics of the image to verify that the whole background was below this number. In this way we have achieved a constant density of about a 98% of black over the entire background, which is very dark, but not pure black —a pure black background confers an unnatural look, in our opinion, and should be avoided.
If the image has to be shown at different sizes, the Resample process is the tool of choice in PixInsight. Resampling can become a critical procedure, especially when downsampling extremely detailed images like this one. One must use a high precision interpolation algorithm to ensure that small structures will survive after downsampling, to the maximum possible extent. Figure 24 shows how we obtained a half-size version of the image in this example, by applying Resample with the bicubic spline interpolation algorithm.
|