The 16-bit tif image, m8+m20.rnclark.c08.12.2015.19frames.test-c1b5x5.tif, is available at the
previous article in this series.

All the images and plots below were made by rnc-color-stretch automatically.

M8 + M20

The algorithm reads the image and analyzes the histogram of
each color (Figure 1). The first step is to determine the amount of
skyglow to subtract to bring each color channel to the reference level
and rnc-color-stretch does this automatically
(Figure 2). This assumes there is an appropriate patch of black sky to
determine the block point. If there is no such patch, the use must give
an estimate of the color of the dark patch, and will be discussed in
the next article in this series.

Figure 2. Rnc-color-stretch automatically determined the sky level
and subtracted the sky to make the lower left side of the histograms
line up.

The next step rnc-color-stretch does is to apply the power stretch
(Figure 3). Notice the image is brighter and more faint details can
be seen. The sky level is re-established in Figures 4 and 5 in a
2-step iterative process. The command line indicated a 2-pass stretch
(-rootiter 2 on the command line above). The second power stretch
is applied in Figure 6. Notice how the histograms have been widened.
The sky level is re-established in 2 iterations (Figures 7 and 8).

Figure 3. Result from power stretch, power factor = 5.0, before new offset
subtraction.

The final step is analyzing the colors in each pixel in the stretched
image versus the original. Note because the original image is faint we can't
easily see the colors. The stretching process, and this applies the the stretches
in this algorithm and in general all stretching, compresses the image intensities
at the high end, losing color. The rnc-color-stretch restores the color that was in the
original image and lost in the stretch. That is shown in Figure 9 and is the final
output image from the algorithm. In this case, the command line includes the
-enhance 1.2 option so the colors were enhanced 20% over their originals.

Figure 9. Data from Figure 8 with color that is in the original input image (Figure 2) restored and enhanced 20%.

Download

Conclusions

The rnc-color-stretch algorithm automates the stretching process and
can produce a final or close to final stretched
astrophoto in many situations. Use the -display and -plots options
to show the intermediate steps and histograms of the stretching process.

Optimal results from rnc-color-stretch depends on input parameters.
I suggest making a small image, like that shown here, so the computation
time is faster. Use the -jpegonly flag to minimize disk space of 16-bit png files.
Explore different power stretches and the effects of the scurve1 and scurve2 flags.
Once you find a set of parameters that works well with your image, then
turn off the jpegonly flag and run it again to make the 16-bit png file.

If you find the information on this site useful,
please support Clarkvision and make a donation (link below).