Wide-field Imaging: stretching the output from Deep Sky Stacker, repairing distorted stars and image enhancent.

Taking wide-field images of the heavens is done by using a DSLR or Compact System Camera with a short focal length lens mounted on a tracking mount.  Usually a number of short (to prevent star trailing) exposures are taken which are combine to give the effect of a longer exposure in a program such as Deep Sky Stacker.

The output from Deep Sky Stacker (DSS) often shows fewer stars than in a single image that went into the set of frames that were to be aligned and stacked.  The result will be better and more stars will become visible than in a single frame but to achieve this the 16-bit Tiff image produced by DSS must be ‘stretched’.  This involves lifting up the fainter parts of the image whilst leaving the brighter parts relatively untouched.  The key words of this last sentence are ’16-bit Tiff’.  The program that is used to stretch the image must be able to handle 16-bit images.  The less expensive programs such as Adobe Elements only work with 8 bit images and, until this April, this was also the case with the free program GIMP.  Adobe Photoshop has always been able to manipulate 16 bit depth images but now has to be leased at around £9 a month.  Very pleasingly, the latest version of GIMP can now handle 16-bit images so there is a free program that can probably carry out all of the processing that might be required to produce a final image from the image output from DSS.  There are two free programs, IRIS and FITS Liberator 3, available which can also stretch 16 bit images.

This article is going to take the DSS output file and process it in as many ways as possible to illustrate the processes involved and show how it is achieved in the four programs.  As an example, I have used the result of stacking a number of frames of the northern Milky Way including the constellations Cassiopeia and Perseus along with the Galaxies M31 in Andromeda and M33 in Triangulum.   Images produced by short focal length lenses will often show distorted images of stars towards their corners and the article will show how these can be ‘repaired’.  The final stretched image will then be ‘enhanced’ somewhat to make the brighter stars stand out better and bring the result closer to a film image of the same region.

The frames stacked by DSS were captured in perfect conditions by a Nikon D610 full frame DSLR and 24 mm focal length lens mounted on a tracking mount in the Kerry ‘Gold Tier’ dark sky reserve in south-west Ireland.

IRIS

IRIS can be downloaded for free.  The 16-bit Tiff image that is output from DSS is loaded into IRIS and, usually, a pretty horrific image is seen.  By adjusting the two sliders that appear, this can be greatly improved but this is only adjusting the ‘black’ and ‘white’ points.

To provide a better stretched image, one should click on the ‘View’ tab and in the resulting drop-down menu click on ‘Logarithm’.  The program does several passes and provides an image with quite a good stretch having been applied.  It can be adjusted on screen (but not in the output file) by moving the two sliders if desired.  When this was output as a 16-bit Tiff, the levels needed to be adjusted to bring up the black point in Photoshop or GIMP. (Moving the left hand slider to the right.)

The image required some colour balancing but the final result was very good and I suspect that it would be worth using IRIS as well as Fits Liberator, Photoshop or GIMP and see which result is preferable.  The output can also be output as an 8-bit .bmp file which could be loaded into Photoshop Elements for example.  (But I do think you should download and use GIMP if you do not have Photoshop.)

FITS Liberator

This is quite a complicated program to use, but I was quite impressed with the final result.  It can be downloaded for free and was produced by ESA and NASA for processing professional data that is usually encoded in what is called the FITS format.

Not surprisingly, it requires a .fit image to work on.  The Tiff file produced by DSS can be converted into a .fit file simply by importing it into IRIS, doing nothing and exporting it as a .fit file.

The FITS Liberator program loads into one’s ‘documents/downloads’ folder and a ‘shortcut’ can be made and pasted onto the desktop.

When opened it looks for a .fit file in your folder.  Clicking on this and then the ‘open’ tab brings up the (small) Liberator window.  Slightly annoyingly, each of the three colours has to be processed separately.  Under the (blue coloured) ‘Image data’ heading it will say ‘Image 1, Plane 1’ (which is the red channel).  Under the (blue coloured) ‘Scaling and stretch (advanced)’ heading, one can select from a very wide variety of stretching functions.  The one that is often recommended to use is ‘ArcSinh(ArcSinh(x)’.  This was the one I chose and, having FITS Liberator having processed the data, exported it as the red channel as a 16-bit Tiff.

I then selected plane 2  (Image 1, Plane 2)  and exported the result as the green channel.

Followed by plane 3 (Image 1, Plane 3) as the blue channel.

These were all grayscale images.  To make the colour image, a new image of the same size is created in 16-bit RGB mode and its channels selected − a blank image results .   The three grayscale images  were loaded as well as seen below.

A new 16-bit RGB image of the same size with its ‘channels’ opened along with the the three R, G and B grey scale images.

In turn,  each grey scale image was copied (Ctrl A, Ctrl C) and and pasted into the appropriate channel (Ctrl V).

Pasting the red channel.

Adding the green channel.

Finally the blue channel when, with all selected, a colour image appears! 

The 16-bit RGB image  should be saved as a Tiff file with a appropriate name and then reloaded to apply any further processing.

I did like the result − it is a more sophisticated stretch than the others used – and although it takes some time, is well worth pursuing.

Adobe Photoshop and GIMP

The stretching in both these programs can be done either using the ‘levels’ or ‘curves’ commands.  In Photoshop the functions can be made into an ‘action’ so making one application the result of pressing a function key.  GIMP does not have actions so one has simply to repeat the process setting up the levels or curves function each time.  [Note that in GIMP one has to ‘export’ not ‘save’ the resulting image.]

In Photoshop

Using Levels

In the levels command the central slider is moved to the left to the 1.2 position.  This increases the brightness of the fainter parts of the image but less so the brighter parts.  This is repeated as desired.

Finally, the overall image will become too light and then the left hand slider moved to the right to lift up the ‘black point’.

 

Photoshop output stretched with levels

Using Curves

A curve is used, as shown below, to again brighten the fainter parts of the image, but leave the brighter parts untouched.   The black point will need to be brought up either in levels or curves.

The applied curves function

Stretched using the curves function

Making an action in Photoshop

  • Open the Action panel by ticking beside it in the Window drop down menu.
  • Click on the menu box at the top right of the Action panel that is displayed.
  • Click on ‘New Action’ and a window opens to allow one to choose a function key which is used to initiate the action. Then click ‘Record’.
  • Now carry out the desired steps as in the sequences described above.
  • Finally click on the menu box at the top right of the Action panel again and click on ‘Stop Recording’.

A single press of the specified function key will now initiate the chosen stretching function.

In GIMP

The ‘Levels and Curves’ processes in GIMP are identical to that in Photoshop. (But, surprisingly, found within the ‘Colours’ drop down menu.)  I would simply repeat the process the few times that it is necessary.  One can ‘export’ (not ‘save’) a 16-bit Tiff or 8-bit Jpeg for further processing in another program or, as is likely, continue in GIMP.

Using Levels in GIMP

This shows the histogram after stretching.  The left hand slider should then be brought over to the left hand edge of the histogram to set the black level.

Using Curves in GIMP 

The curve function in GIMP – used several times

Note how the left hand end of the curve has been brought up to the edge of the histogram to bring up the ‘black point’ of the image.

Repairing stars and enhancing the Stretched Image

The different methods of  stretching the DSS output gave very similar results but I preferred that had been produced by the FITS Liberator program and chose it to work on in Adobe Photoshop.

Repairing star images

No lenses are perfect and brighter stars near the corners of the image were showing a form of coma – in this case looking like little seagulls.   It is possible to make a brush tool which keeps the central part of the distorted star present, but overwrites the surrounding ‘wings’ from the surrounding area.

Making a star repair brush tool in Adobe Photoshop:

  • Make a new blank image 500 x 500 pixels in size.
  • Use the elliptical selection tool to make a circle ~300 pixels in diameter centrally within it and paint its interior black.
  • Remove the selection and apply a Gaussian blur with a radius of 15 pixels to blur the black disk edges.
  • At the centre of the black disk make a circular selection of ~80 pixels across and paint its interior white. Remove the selection.
  • Make a circular selection surrounding this of ~150 pixels across and apply a Gaussian blur of ~12 pixels. This blurs the edges of the white disk and will define how ‘sharp’ the repaired stars will appear.  If too sharp, the blur radius should be increased. Remove the selection.
  • Under ‘Edit/ Define Brush Preset’ make this into a brush called ‘coma’.

Steps in making the ‘coma’ clone stamp tool

This can then be used to repair star images adjusting the size of the brush as required.  Select the ‘clone stamp’ tool and double click on the ‘coma’ brush from the brush selection drop down menu where it should now reside.  The size of the stamp tool (using the ‘[’ and ‘]’ keys) should be adjusted so that the white circle is just large enough to cover the ‘good’ part of the star image.  Select from an area close to the star and clone over the star with the ‘good’ part of the star visible in the central ‘hole’.  The ‘wings’ will be replaced from the selected area.

Increasing the local contrast in the image

To accentuate the darker regions of the Milky Way, I used the ‘Unsharp Mask’ filter to provide some local contrast enhancement.  For this use, the radius should be set to a high value, say 200, and the amount initially set to a low value, say 12%, and then adjusted to suit.

Making the brighter stars stand out

Digital wide angle sky images have a similar problem as when one observes the sky under very dark conditions – it is very hard to make out the main constellation stars such as, in this case, those making up the ‘W’ of Cassiopeia.   When film was used, ‘halation’, the scattering of light within the emulsion, made the brighter star images larger in size so that they stood out rather in the same way that in star charts brighter stars are made bigger.  (Theoretically, all star images should be just identically sized disks of light determined by the resolution of the lens.)  Digital images do make the brighter stars larger but not to the same extent.  I thus produced a ‘bright stars’ image by taking the un-stretched output from DSS, applied a gaussian blur of a few pixels to make their images larger and then brought their brightness back using the ‘Brightness/Contrast’ tool.   This can be applied a few times as desired.  If desired, their colours can be ‘enhanced’, perhaps by using the ‘Match Color’ tool (American spelling).   I painted the two areas of the Double Cluster’ black to remove them from the bright stars image as I did not want these to be overwritten in the original image.

The ‘bright stars’ image

The bright stars image was copied and pasted over the enhanced and repaired image and the ‘Screen’ blending mode chosen before flattening the image.  The amount by which the bright stars are added can be adjusted by using the ‘opacity’ slider.

This then was the final result.  A larger scale image can be found at here.

Below is an annotated version.  It shows the constellation outlines and star names, the Double Cluster in Perseus, and also, very pleasingly M31, The Andromeda Galaxy, its companion M110 along with M33 in Triangulum.  A nice open star cluster, NGC 752, is also visible.  [I find it interesting comparing such a wide field image with the star charts in the wonderful ‘Interstellarum Deep Sky Atlas’ which I cannot recommend too highly.]

 

A crop of the region containing M31, M33 and M110.

Return to Astronomy Digest home page