PixInsight Forum (historical)

PixInsight => Release Information => Topic started by: Juan Conejero on 2010 September 13 07:01:03

Title: New Tool: HDRComposition
Post by: Juan Conejero on 2010 September 13 07:01:03
Hi all,

A new standard tool is now available for all supported platforms (http://pixinsight.com/forum/index.php?topic=2317.0): 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 (http://pixinsight.com/forum/index.php?topic=913.0) two years ago by Oriol Lehmkuhl. However, this new tool implements a completely different image scaling algorithm (also published as the new LinearFit tool (http://pixinsight.com/forum/index.php?topic=2302.0)), 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.

(http://forum-images.pixinsight.com/20100913/HDRC/01-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/01.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/01.jpg)

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:

(http://forum-images.pixinsight.com/20100913/HDRC/02-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/02.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/02.jpg)

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.

(http://forum-images.pixinsight.com/20100913/HDRC/03.jpg)

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.

(http://forum-images.pixinsight.com/20100913/HDRC/04-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/04.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/04.jpg)

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

(http://forum-images.pixinsight.com/20100913/HDRC/05-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/05.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/05.jpg)

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

(http://forum-images.pixinsight.com/20100913/HDRC/06-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/06.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/06.jpg)

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:

(http://forum-images.pixinsight.com/20100913/HDRC/07-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/07.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/07.jpg)

And this is the whole stretched image:

(http://forum-images.pixinsight.com/20100913/HDRC/08-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/08.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/08.jpg)

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

(http://forum-images.pixinsight.com/20100913/HDRC/09-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/09.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/09.jpg)

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

(http://forum-images.pixinsight.com/20100913/HDRC/10-tn.jpg) (http://forum-images.pixinsight.com/20100913/HDRC/10.jpg)
Click here to see a full-size image (http://forum-images.pixinsight.com/20100913/HDRC/10.jpg)

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!

Title: Re: New Tool: HDRComposition
Post by: Carlos Milovic on 2010 September 13 08:08:14
Looks great :) Good job with this one.
Title: Re: New Tool: HDRComposition
Post by: Nigel Ball on 2010 September 13 08:34:48
This product just gets better and better

VERY impressive   ;D

Nigel
Title: Re: New Tool: HDRComposition
Post by: Enzo De Bernardini on 2010 September 13 08:40:07
Excellent!

And the button "From Preview" in both process...you read my mind  ;)

Thanks!

Enzo.
Title: Re: New Tool: HDRComposition
Post by: sleshin on 2010 September 13 10:48:48
Very cool Juan. Thanks or all your hard work.

Steve
Title: Re: New Tool: HDRComposition
Post by: Harry page on 2010 September 13 11:16:08
oh Yes

 excellent tool all I need is something to work with  >:D


Harry
Title: Re: New Tool: HDRComposition
Post by: Nocturnal on 2010 September 13 11:18:23
Which target besides the Orion Nebula would be a candidate?
Title: Re: New Tool: HDRComposition
Post by: georg.viehoever on 2010 September 13 11:25:05
Which target besides the Orion Nebula would be a candidate?

Andromeda, deep M51, moon, jupiter+moons, ...
Title: Re: New Tool: HDRComposition
Post by: Jack Harvey on 2010 September 13 12:17:32
Iris Neb
Title: Re: New Tool: HDRComposition
Post by: Juan Conejero on 2010 September 13 12:56:30
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 (http://forum-images.pixinsight.com/legacy/HDRscript/ngc6543not2.jpg) (NGC 6543), with raw data from the Nordic Optical telescope processed by Vicent Peris with the old HDRComposition script.  
Title: Re: New Tool: HDRComposition
Post by: harist on 2010 September 13 13:17:33
Excellent!

Tasos
Title: Re: New Tool: HDRComposition
Post by: Nocturnal on 2010 September 13 13:36:07
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 :)
Title: Re: New Tool: HDRComposition
Post by: vicent_peris on 2010 September 14 01:10:04
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.
Title: Re: New Tool: HDRComposition
Post by: Nocturnal on 2010 September 14 06:21:10
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 :)
Title: Re: New Tool: HDRComposition
Post by: xatamec on 2010 September 14 08:25:44
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

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 (http://forum-images.pixinsight.com/legacy/HDRscript/ngc6543not2.jpg) (NGC 6543), with raw data from the Nordic Optical telescope processed by Vicent Peris with the old HDRComposition script.  
Title: Re: New Tool: HDRComposition
Post by: vicent_peris on 2010 September 15 12:01:54
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.
Title: Re: New Tool: HDRComposition
Post by: Niall Saunders on 2010 September 22 17:25:24
Thanks again for another excellent tool to add to our PI toolboxes.

However, I am still waiting for that DeClouder and DeMooner script - any news ::)
Title: Re: New Tool: HDRComposition
Post by: RobF2 on 2010 September 23 03:34:54
Yes, thanks for another wonderful tool.
I've been really looking forward to "Orion season" this year, and perfect timing to make such a practical tool available   :D  :P
Title: Re: New Tool: HDRComposition
Post by: astropixel on 2010 September 24 03:27:09
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.

Title: Re: New Tool: HDRComposition
Post by: Carlos Milovic on 2010 September 24 07:43:55
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.
Title: Re: New Tool: HDRComposition
Post by: vicent_peris on 2010 September 24 08:42:02
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.



Hi,

This algorithm is designed to work with calibrated data. In daylight, as exposure times are very short, you don't need to subtract thermal noise. Also, if all the HDR exposure set is done with the same aperture value, you don't need to correct vignetting. But you must always correct all the image set by subtracting bias.

Just a note: to me it seems that you're making the HDR composite image with bayer matrix images. You must debayer all the images before making the HDR composition.


Best regards,
Vicent.
Title: Re: New Tool: HDRComposition
Post by: astropixel on 2010 September 24 13:16:13
Thanks Carlos and Vicent.
I'll have to take some bias frames for this particular camera.
Debayering was the solution. A bit too much colour saturation may be?
Title: Re: New Tool: HDRComposition
Post by: vicent_peris on 2010 September 24 14:00:35
Hi,

did you apply HDRWT to this image?

I think you can raise a bit more the midtones because the foreground objects are very dark.


V.
Title: Re: New Tool: HDRComposition
Post by: astropixel on 2010 September 24 14:50:29
Not to the previous image. This one has HDRWT 2 layers 5x5 Gausian to luminance with deringing, plus a saturation and RGBK curve and additional colour saturation.
Title: Re: New Tool: HDRComposition
Post by: vicent_peris on 2010 September 24 15:16:17
Hi,

better would be to use more layers. With only two layers you are having too much contrast in the sea, over the reflected Sun light.

OTOH, after HDRWT is better to use curves to enhance colors, because HDRWT mutes the color saturation of the highlight areas. Do a curve to saturate only the color of the less saturated pixels.


Regards,
Vicent.
Title: Re: New Tool: HDRComposition
Post by: astropixel on 2010 September 24 20:28:31
Thanks Vicent. I think this one is a lot better. I'm almost tempted to write up a small tutorial for the procedure.

I've created and calibrated the images with a master bias, debayered, HDRComposition, SCNR green channel, HDRWT 6 layers 5x5 gaussian to luminance with a mask and deringing, a bit of saturation with CurveTransformation in H, b and RGBK, and that's it.

The only point, is that the colours could be saturated more or the contrast increased I suppose. Depending on personal preference.



Title: Re: New Tool: HDRComposition
Post by: Carlos Milovic on 2010 September 24 21:43:23
Now you nailed it :D Looks terrific!
Title: Re: New Tool: HDRComposition
Post by: astropixel on 2010 September 24 23:05:57
'bout time  ;D Thanks again to all :)
Title: Re: New Tool: HDRComposition
Post by: vicent_peris on 2010 September 25 02:43:12
Hi,

try this process icon set. I made it from your first posted image. Remember to read the texts inside each process icon (small red button).

It's all I can do with your JPEG.


Regards,
Vicent.
Title: Re: New Tool: HDRComposition
Post by: astropixel on 2010 September 25 03:44:05
Vicent - thanks so much. I'll try those over the weekend.
Title: Re: New Tool: HDRComposition
Post by: Alejandro Tombolini on 2011 February 19 16:57:29

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.


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.



My image is even with more posterization. Is there any way to visualize correctly and apply 
deconvolution without use histogram and lose linearity..., I can not see it good enough, mainly in dark regions.

Alejandro.
Title: Re: New Tool: HDRComposition
Post by: -Amenophis- on 2018 March 13 10:04:11
Hello,

Should we go through this process absolutely or can we stack all the images with different exposure times with the "ImageIntegration" process and then use the HDRMultiScale Transform process ?

Thank you