Monday 12 July 2021

Hidden in the Dark: A look at 16-bit astronomical imaging

I first published this article in 2020, in Issue 2 of Redux Cygnus, the e-magazine of the Swansea Astronomical Society. It is presented here as a prelude to the article on: 

Getting Started with AstroDMx Capture.

If you are going to link to this article, please use the following URL:

https://x-bit-astro-imaging.blogspot.com/2021/07/hidden-in-dark-look-at-16-bit.html

Hidden in the Dark

Below is a stacked image of an astronomical object (a stack of 40 x 60s exposures), captured by an Atik 314L 16-bit monochrome camera, with a H-alpha filter, using Nicola Mackin’s AstroDMx Capture for macOS. However, everything would work exactly the same way in AstroDMx Capture for Windows, Linux, Raspberry Pi Linux and Chrome OS Linux.

Can you guess what the object is?

I doubt it because all of the exquisite details of this object are hidden in the dark. But, we shall reveal them in all their magnificent beauty and in the process look at exactly what a 16-bit image is, and why the 16-bit format is so important for deep sky imaging.

The differences between 8-bit imaging and 16 bit imaging

ADC bit depths

Some cameras such as the QHY 5L-II-M and the SVBONY SV305, along with many other astronomy cameras and some DSLRs have 12 bit ADCs (Analogue to digital converters that digitise the analogue signal from the light sensor of the camera)

Other cameras such as the ZWO ASI178MC have 14 bit ADCs as do some other astronomy cameras and some DSLRs such as the Canon 4000D.

Cameras such as the Atik 314L mono have 16 bit ADCs as do a number of other astronomy cameras.

Most cameras with 12 bit or 14 bit ADCs can also save out 8 bit data, which is a rapid process that allows them to have high frame rates when doing lunar, solar and planetary imaging.

What do 8 bit, 12 bit, 14 bit and 16 bit mean in terms of cameras and images produced?

8 bit image data contain 28 that is 256 levels of brightness 

Ranging from 0 (black) to 255 (white)

12 bit image data contain 212 that is 4096 levels of brightness

Ranging from 0 (black) to 4095 (white)

14 bit image data contain 214 that is 16384 levels of brightness

Ranging from 0 (black) to 16383 (white)

16 bit image data contain 216 that is 65536 levels of brightness

Ranging from 0 (black) to 65535 (white)

Astronomical objects have continuous levels of brightness and the larger the number of bits used to capture the data, the more of the intermediate levels of brightness are actually captured and steps in brightness from one digitising level to the next within images are avoided.

Saving 16 bit image data from 12 bit and 14 bit ADC cameras

There are only 8 bit, and 16 bit integer image formats routinely used in astronomical image capture. This means that image data can be saved in 8 bit image containers or in 16 bit image containers (files). Tiff files can be 8 bit or 16 bit. (As an aside, Deep Sky Stacker automatically saves the stacked image in a 32 bit floating point TIFF or FITS file, whatever bit depth and format you chose to save out the stacked image. This is because Deep Sky Stacker, like some other stacking software, sums the registered images into a 32 bit floating point image file). However, the typical images worked on by astronomers are 8 bit or 16 bit integer files. When you save out a stacked image from Deep Sky stacker or Autostakkert! Into a 16-bit file, you are saving the image, scaled to 16 bits, you are NOT saving the average. The Gimp image processor can read and manipulate 32 bit image files and can convert them to 16-bit or 8-bit images AFTER processing is complete.

8 bit data are stored in 8 bit files.

12 bit and 14 bit data are stored and saved in 16 bit files, usually TIFF or FITS files.

All processing is done on the high bit-depth images and only when post-processing is finished is the bit depth converted to 8 bits and saved, usually as an uncompressed PNG file that can then be used for display and sharing.

What to expect when doing 8-bit imaging and 16-bit imaging

8-bit imaging

With 8-bit imaging, what you see on the capture preview screen is what you get in the final data.

Video streams of planets, the Moon or the Sun will appear on the preview screen more or less as they will appear in the final data. 

16-bit imaging

With 16-bit imaging, whether you are using a camera with a 12-bit ADC, a 14-bit ADC or a 16-bit ADC, the image data will be saved in a 16-bit image container. The format I prefer is the TIFF format to the FITS format, although this is very much a personal preference, and Fits files contain rich meta-data that can be very useful.

Unlike 8-bit imaging, what you see in the preview window is not necessarily the same as what you get in the results, although there are several controls that allow you to get a preview that is closer to what you actually save.

I will explain why this is so:

In our example we are using  AstroDMx Capture for macOS to capture the image data. However, everything would work exactly the same way in AstroDMx Capture for Windows, Linux, Raspberry Pi Linux and Chrome OS Linux.

Imagine you are working in 8 bits and that a 1 second exposure makes the image very bright (it will depend what object you are pointing at) and that many of the brighter regions of the image are getting close to say 200 (on the 0 to 255 scale). If you now change to an exposure of 2 seconds, those regions of the image should now have values of about 400; but they can’t because the 8-bit image scale is 0 to 255. Any value of greater than 255 will simply be recorded as 255 and most of the image would be saturated.

However, if the data were not being put into an 8-bit image container, but were being put into a 16-bit container, the values of about 400 would have no trouble going into a container with a brightness range of 0 to 65535. In fact, they would be so far down the bottom of the range that they would be too dim to see.

This is where the extra display controls of AstroDMx Capture come in. They are in two categories. 

Transformations

The first category comprises several transformations of the preview display data.

The transformations are applied to the preview image to enable you to see what you are imaging, but they are not applied to the saved data. 

The transformations are:

1 Clipping

2 Linear

3 ArcSinH

4 ArcSinH of the ArcSinH

Transformations 3 and 4 are only for Deep Sky imaging.

There is also a coefficient slider that can be applied to the transformation to control the dark level.

There is a 16 bit brightness control that brings up the brightness of a 16 bit image to help it become visible, and bring it out of the darkness.

Software Controls

The second category of controls  are the non-destructive Software Controls

1 Gamma

2 Brightness

3 Contrast

The term non-destructive means that they only affect the displayed preview image and do not affect the saved data.

By experimenting with the transformations and the other controls it is possible to influence the display  so that you can see what you are imaging. The object is NOT to produce an image that is like the final image once it has been processed, it is just to see what is being imaged and no more.

In our example we have the 16-bit Atik camera at the prime focus of a 102mm f/4.5 ED refractor. 40 x 60s exposures with matching dark-frames were captured of our object. A dark frame is an image of the same exposure, captured with the cap on the end of the scope. These dark-frames contain any systematic noise such as hot pixels. Using the transformations and software controls to allow us to see what we are capturing. 

A screenshot of AstroDMx Capture during the capturing process looks like this:

Screenshot of AstroDMx Capture gathering 16-bit image files.


The Transformations and the Software controls have been used to make the object visible (but remember, they do not change the data that are saved). 

However, one of the captured images looks like this:

Everything is hidden in the dark, but we know that it is there! We have another 39 images like this.

We are now going to dark-frame correct and stack the images using Autostakkert! stacking software. Autostakkert will register and stack the 40 images and save out the result in a 16-bit file. (Other software, such as Deep Sky Stacker, Affinity Photo, Registax or Sequator could have been used to do the same job).

When the images are loaded into Autostakkert! and the dark-frame correction applied, (the Master Dark-Frame is subtracted from every image to remove the systematic noise).

This is what the first image looks like in Autostakkert

Once again, everything is still hidden in the dark. However, Autostakkert! has a viewer control that allows the hidden parts to be revealed just to satisfy yourself that it really is there and also help later with alignment points. 

This viewer control does not affect the data, just as the Transformations and Software controls in AstroDMx Capture allowed you to see what you were capturing, but did not affect the data.

The image ‘brightness’ control has been set to 32x.

The object has become visible, but more importantly, the stars in the image have also become visible, so we know where they are.


This allows us to place alignment points/boxes on a large number of stars so that Autostakkert! can use this information to register (align) the images before they are stacked.

Autostakkert Stacks all of the images into a 16-bit file that now contains all of the information accumulated in 40 x 60s exposures i.e. in a total exposure time of 40 minutes.

When we load this file into an image processor such as Photoshop, or as we are using here, The Gimp (GNU Image Processor), as before, everything is hidden in the dark.

However, in this case, there is 40 minutes worth of information hidden in the dark of the 16-bit file.

We now start to apply Curves stretching to the image.

You can see that the Curve has been pulled towards the left. The image is just starting to appear, but clearly more is needed. OK is clicked to preserve the change just made.

Then Curves are invoked more times

This time, when the curve is gently pulled to the left, the object starts to appear. OK is clicked to preserve the change.

Curves are invoked more times and the image gets brighter. The curves are brightening the image in a non-linear way, so that the dimmer regions become brighter without saturating the brighter areas. We pull the curve carefully to make sure that it is not overdone.

When the curve is gently pulled to the left and the base is pulled to the bottom of the histogram at the left, to keep the dark areas dark, the object is made even brighter, with more details appearing in the peripheral areas of the nebula.

Lastly, we invoke Levels to finish the brightening process.

The mid tones have been brightened and the process is virtually finished. The two blue arrows show where the triangular control handles have been pulled.

All that now remains is to save the image and look at the finished image.

This is of course M16, the Eagle nebula. which contains the ‘Pillars of Creation’.

Here are the Pillars of Creation, extracted from the image and placed in a more familiar orientation

 A final word now that all has been revealed.

It might seem that the 40 minutes of exposure time used here is quite a lot, but it is Not! Many astrophotographers will capture many hours of exposure time over many sub frames (individual exposures). This will allow them to extract even more fine and faint detail from the wonderful objects lurking in the dark, night sky.

It is hoped that this article will be studied before doing deep sky imaging, so that the imager properly understands what she/he is doing and what they are trying to acheive.