New Tool: HDRComposition

Juan Conejero

PixInsight Staff
Sep 2, 2004
8,283
408
57
Valencia, Spain
pixinsight.com
Hi all,

A new standard tool is now available for all supported platforms: HDRComposition.

HDRComposition allows you to integrate a series of images of the same subject with varying exposures into a single high dynamic range composite image. HDRComposition implements basically the same algorithm originally created by Vicent Peris, and already implemented as a script two years ago by Oriol Lehmkuhl. However, this new tool implements a completely different image scaling algorithm (also published as the new LinearFit tool), much more accurate and robust, and works in a much more automatic way. In fact, you normally will only need to adjust one parameter, and most times you'll get an excellent result just with the default parameter values.

To give you an idea of how HDRComposition works, I've prepared a small example with a set of five Images of the M42 region by Vicent Peris and Jos? Luis Lamadrid. You can see them on the screenshot below.


These are raw linear images acquired with a modified Canon 300D DSLR camera through three different instruments: A Takahashi FC-100 refractor (10 cm @ f/8), a Celestron 80ED (8 cm @ f/7.5), and a Takahashi Epsilon 180ED telescope (18 cm @ f/2.8). The exposures are of 10 seconds with the 80ED; 2, 10 and 30 minutes with the FC-100, and 10 minutes with the Epsilon 180ED, all of them from a very dark location in Teruel, Spain.

Our goal is to integrate all of these exposures into a high dynamic range image. Here is the result after running HDRComposition with default parameters:


Note that the set of source images can be specified in any arbitrary order; HDRComposition automatically computes the relative exposure of each image and sorts the list accordingly. This routine is very robust, and works reliably without requiring any metadata information about exposure times, ISO speed, CCD parameters, etc. (HDRComposition ignores image metadata). In the rare case you need to specify the exposure order manually (which should not happen in any situation we can figure out), you can disable the Automatic exposure evaluation option.

The resulting HDR image is extremely dark, as expected. It is a linear image with a huge dynamic range (the whole range of the M42/M43 region) stored in a numeric range of at least 230 discrete sample values. Note that this HDR image does not fit into a 32-bit floating point image, where you can store a maximum of about 224 discrete values. This HDR image requires either the 32-bit unsigned integer format or the 64-bit floating point format, both available in PixInsight. The HDRComposition tool generates 64-bit floating point images by default, although 32-bit floating point can also be used as an option suitable for moderately large HDR compositions.

HDRComposition also provides, as an option, the set of composition masks used internally. Each composition mask is white where the pixels on a long exposure have been replaced with the corresponding pixels from the next exposure in decreasing exposure order. You can see the four masks generated in this example on the screenshot below.


Composition masks provide you full control over the process. Composition masks are initially generated as binary images (only 0 and 1 values). The Binarizing threshold parameter defines where to cut long exposures to replace their pixels with pixels from the next image in decreasing order of exposure. Normally the default value of 0.8 is quite appropriate, but you can change it if you see that the masks are not driving the composition correctly (which is rare). After binarization, the masks are smoothed to prevent artifacts generated by hard masking transitions. The degree of low-pass filtering applied to composition masks can be controlled with the Mask smoothness parameter, although the default value will usually give excellent results.

Here is the HDR image with an automatic STF applied. STFs are 16-bit look-up tables in PixInsight. Note that a 16-bit LUT causes posterization in the screen representation of this image. There is no surprise here, since as noted this is a 64-bit floating point image storing more than 230 discrete values.


Below is the image after BackgroundNeutralization. Note the tiny upper bound of the background sampling range: 0.0001.


To better evaluate the numerical depth of this linear HDR image, here is a zoomed area with automatic STF:


Note the strong posterization caused by the 16-bit rendition of the image (please click the image to see the full-size version). Now you can see and show a clear example of what happens when 16 bits aren't sufficient. Actually, 32-bit floating point doesn't suffice in this case, either. This is the same area after stretching the 64-bit image with HistogramTransformation:


And this is the whole stretched image:


After stretching, the standard procedure in PixInsight is applying HDRWaveletTransform to compress the dynamic range of the HDR image. This is the result:


And finally, the image greatly benefits from a generous increase in color saturation. Note the chromatic richness in the following screenshot.


Summarizing:

- The best results are obtained when HDRComposition is used with linear images.

- For astronomical purposes, all the images must be accurately calibrated. You normally will calibrate, register and integrate a set of individual frames for each exposure, then the results of these integrations will feed HDRComposition. However, you can also use single calibrated frames, as this example demonstrates.

- HDRComposition requires registered images. In other words, pixel-per-pixel correlation is required for all the images taking part in the composition; dissimilar images cannot be used.

- Additive gradients, if they are dissimilar across the set of integrated images, will hurt the accuracy of the HDR composition process. If possible, all additive gradients should be removed prior to HDR composition. This involves applying the DBE or ABE tool to the linear images.

- To speed up the process, you can define a sampling region of interest (ROI). This is a rectangular area used to restrict image scaling. This has the additional advantage that if there are slight flat fielding errors near the edges of the images (which is frequent), one can define a central ROI to improve accuracy of image scaling.

That's it. Happy HDR compositing!

 

Juan Conejero

PixInsight Staff
Sep 2, 2004
8,283
408
57
Valencia, Spain
pixinsight.com
There are lots of astronomical objects that pose high dynamic range problems. Along with the already mentioned objects, any relatively bright galaxy has a bright nucleus that can benefit from HDR processing. Also don't forget planetary nebulas, where a very bright object is frequently surrounded by dim structures; see this nice example with the Cat's Eye nebula (NGC 6543), with raw data from the Nordic Optical telescope processed by Vicent Peris with the old HDRComposition script.  
 

Nocturnal

Well-known member
Sep 12, 2007
2,727
0
CT, USA
www.carpephoton.com
I think all this depends a bit on the optical system and camera used as well. Large scopes gather more light and will saturate more quickly. Shallow wells overflow more quickly.

I took subs of M31 with my C11/HS and even with 4m exposures I still see detail in the core with my QHY8. I suppose I should try some 1m exposures and see if that reveals extra detail in the core.

I used M31 to demonstrate HDRWT at MWAIC and I think the attendees will agree that detail was recovered from the bright areas without any problems :)
 

vicent_peris

PTeam Member
Sep 3, 2004
995
12
Valencia (Spain)
www.astrofoto.es
Hi Sander,

As we learnt at the Adler, HDRC is not only to make HDR compositions of the main subject. It can be actually used as a true debloomer. :)

I showed that, instead of using a software "fake" debloomer, it's way better to make some short exposures of your FOV and recover the bloomed areas with *real* data. The output masks are also very useful for denoising this areas.


Regards,
V.
 

Nocturnal

Well-known member
Sep 12, 2007
2,727
0
CT, USA
www.carpephoton.com
Hi Vicent,

I suppose with blooms you have no choice but to replace the bloom with short exposure background or truly making stuff up. In both cases though the pixels aren't comparable to their neighbors. If there are faint targets hidden by blooms they will not become visible with short exposures. The only real solution is to use ABG sensors :)
 

txiripiri

Well-known member
Jun 30, 2009
52
0
The objects that pose more high dynamic range problems are the stars which appear in all our astrophotos  ;D
Specially shooting with a DSLR this is an issue. In the past I've used the HDRcomposition algorithm with long and short exposures to recover the saturated stars... but didn't get good results... after stretching the hdr image the stars got saturated again. One possibility to keep the stars under control is to do the initial stretch with MST... but I don't like it very much becauase the whole image gets flat and there is a considerable lost of constrast.

Any ideas about how to face successfully the problem of dynamic range of the stars?

Sergi

Juan Conejero said:
There are lots of astronomical objects that pose high dynamic range problems. Along with the already mentioned objects, any relatively bright galaxy has a bright nucleus that can benefit from HDR processing. Also don't forget planetary nebulas, where a very bright object is frequently surrounded by dim structures; see this nice example with the Cat's Eye nebula (NGC 6543), with raw data from the Nordic Optical telescope processed by Vicent Peris with the old HDRComposition script.  
 

vicent_peris

PTeam Member
Sep 3, 2004
995
12
Valencia (Spain)
www.astrofoto.es
Nocturnal said:
Hi Vicent,

I suppose with blooms you have no choice but to replace the bloom with short exposure background or truly making stuff up. In both cases though the pixels aren't comparable to their neighbors. If there are faint targets hidden by blooms they will not become visible with short exposures. The only real solution is to use ABG sensors :)
Yes, but it's far better to cover the blooms with real data than with completely synthetic data. Yes. this real data is weak, but real. Some of the stars and other objects under the blooms will appear. Also, if your bloom is over a nebula, you will recover valuable data of it.


Regards,
Vicent.
 
A

astropixel

Guest
The speed is phenomenal. Two questions though. What are optimal settings for terrestrial shots? Should I first calibrate daylight images?

This is the result of HDRcomposition of RAW images.

 

Attachments

Carlos Milovic

Administrator
Sep 2, 2004
2,172
1
Santiago, Chile
www.astrophoto.cl
If you are working with raw, linear data, it doesn't matter. Since color calibration at this point is just a scale factor (multiplicative factor), you may apply it to the result, or the individual frames, with the same result.

Having said that, it would be easier for the algorithm to replace saturated data, and to merge the data with similar SNR if you calibrate after the HDR composition.