Category Archives: Astrophotography

Creating star trails with automatic sky glow removal

Creating star trail images is one of the easier astrophotography tasks there is, since it doesn’t require any messing about with tracking devices. You just set a camera to point skywards, with programmable remote control set to snap a few 100 images over a hour or more. There are then software programs which can merge the individual images together to create the final star trail. On Linux, I use a startrails plugin for GIMP to perform the merging of individual frames which is simple to use and works pretty well.

The basic star trail image with no sky glow adjustments applied

The basic star trail image with no sky glow adjustments applied

This is all very straighforward if you’re capturing images under ideal conditions, but life doesn’t always work out that way. The first thing people do is to add in dark frames, which are images captured with the lens cap on. These frames will record any hot pixels or general sensor noise that may be present. The startrail application will merge all the dark frames and then subtract the result from the light frames, removing the hot pixels from the final image.

When taking images in London though, there is a major problem with sky glow from the ever present light pollution. There are number of techniques for removing sky glow, with varying pluses and minuses. A simple way is play with the curves/levels to reduce the intensity of the background glow and/or use colour balance corrections to try and make it less noticeable. The problem with this is that the corrections will apply to the background sky, the stars themselves and any foreground objects uniformly. All too often the sky glow is not uniform, but in fact a gradient from top to bottom of the frame, meaning the results of curve adjustment show up the gradient

The basic star trail image with curve adjustments to reduce intensity of the sky glow. Due to the gradient, it is only possible to remove part of the sky glow

The basic star trail image with curve adjustments to reduce intensity of the sky glow. Due to the gradient, it is only possible to remove part of the sky glow

The overall goal is to produce a background that is completely black. This could be achieved if we are able to extract the background component from the main image and then subtract it, leaving just the stars behind. The layers feature in any photo editor can be used as mechanism for accomplishing this task.

If we make an assumption that sky glow is approximately the same in each frame, we can follow a simple series of steps to extract a reasonable approximation of the sky glow background. Start by opening one of the individual frames. Then select the menu option Filters -> Blur -> Gaussian Blur. The radius setting should be set to a large value such as 150px. The resulting image should now be a very smooth colour gradient just representing the sky glow background.

A single image frame blurred to leave just the sky glow background

A single image frame blurred to leave just the sky glow background

Copy this blurred image, and switch to the star trail image previously produced by the plugin. Create a new layer, paste the blurred image into it and anchor the floating selection. Finally change the layer mode to “Subtract”.

The final star trail image with the gaussian blurred sky glow subtracted

The final star trail image with the gaussian blurred sky glow subtracted

The final result above doesn’t have a completely black background because the sky glow we extracted is merely an approximation, but it should have a less significant colour cast, and lower overall intensity. A small adjustment of curves can further reduce the remaining glow:

The final star trail image with the gaussian blurred sky glow subtracted

The final star trail image with the gaussian blurred sky glow subtracted

While this is much improved, there are still some limitations with this technique. If the sky conditions were changing during the course of the image capture session, any single frame will not be so close to the average glow of the final image, so will either be over or under correcting the sky glow. Weather often plays a part, sending clouds through the scene during capture. Ideally one would simply wait for a clear day before capturing images, but not everyone has such a luxury of time. When some images contain clouds, the final image (as seen above) will have a quite uneven, patchy sky glow which is not easily removed with a simple subtraction layer.

Ideally one would subtract the sky glow from each individual frame before merging them to produce the trail. With 100’s of frames this is quite a tedious process, but since the GIMP startrails plugin is open source GPLv3+ licensed python code, we have the freedom to modify it. To that end I have created a fork which has the ability to perform automatic sky glow removal by applying the gaussian blur technique to each individual frame. This more than doubles the amount of time required to produce a star trail image, but the results are very satisfying indeed.

The star trail when sky glow has been subtracted from each individual frame before merging

The star trail when sky glow has been subtracted from each individual frame before merging

The only downside is that when there are foreground images present, they tend to get a halo around their edges. On the plus side, subtracting the sky glow from each individual frame has totally removed the clouds from the image. The background is a pretty dark gray, but not completely black. This can be tweaked with a little use of curves to produce the final image

The star trail when sky glow has been subtracted from each individual frame before merging, with curve adjustments at the edge

The star trail when sky glow has been subtracted from each individual frame before merging, with curve adjustments at the edge

One final tip is to run a guassian blur with a radius of 1.2px on the final image before saving. This will smooth out any jagged edges on the trails caused by the tiny gaps between successive frames.

Stacking multiple images to reduce noise

One of the critical problems when producing astronomical images is to minimize the amount of noise in an image, while still being able to capture the very faint detail which is barely distinguishable from noise. The post processing technique used to address this problem is to merge together multiple images of the same subject. The constant signal in the images gets emphasized while the random noise gets smoothed / cancelled out. There is specialized software to perform stacking of astronomical images to deal with alignment between subsequent frames, as the earth’s rotation can cause drift over time if the camera mount isn’t compensating. The image stacking technique is not merely something for astrophotographers to use though, it is generally applicable to any use of photography.

Image stacking in a non-astrophotography scenarios is in fact simpler than one might imagine. The only physical requirement is that the camera is fixed relative to the scene being photographed, which is trivially achieved with a tripod of other similar fixed mounting facility. In terms of camera settings, it is necessary to have consistency across all the shots, so manual focus, fixed aperture, fixed shutter speed, fixed ISO and fixed white balance are all important. With the camera configured and the subject framed, all that remains is to take a sequence of shots. How many shots to take will depend on the quality of each individual image vs the desired end result. The more noisy the initial image, the larger the number of shots that will be required. As a starting point, 10 shots may be sufficient, but as many as 100 is not unreasonable for highly noisy images.

To illustrate the versatility of the image stacking technique, rather than use images from my DSLR, I’ll use a series captured from the night vision webcam of the Wurzburg radio telescope. A single captured frame of the webcam exhibits large amounts of random noise (click image to view fullsize):

Wurburg Radio Telescope single image

 

Over the course of a few minutes, 200 still frames were captured from the webcam. The task is now to combine all 200 images into one single higher quality image. Processing 200 images in a graphical user interface is going to be painfully time consuming, so some kind of automation is desirable. The ImageMagick program is the perfect tool for the job. It has a option “-evaluate-sequence” which can be used to perform a mathematical calculation for each pixel, across a sequence of images. The idea for minimizing noise is to take the median pixel value across the set of images. Stacking the images is thus as simple as running

# convert webcam/*.jpeg -evaluate-sequence median webcam-stack.jpeg

This is pretty CPU intensive process, taking a couple of minutes to run on my 8 CPU laptop. At the end of it though, there will be a pretty impressive resulting image:

Wurzburg Radio Telescope stacked imageThe observant will have noticed the timestamp in the top left corner of the image gets mangled. This is an inevitable result of stacking process when there is part of the image which is moving/changing in every single frame. In this case it is no big deal since the timestamp can either be cropped out, cloned out, or replaced with the timestamp from one single frame. In other scenarios this behaviour might actually work to your advantage. For example, consider taking a picture of a building and a person walks through the scene. If they are only present in a relatively small subset of the total captured images (say 5 out of 100), the median calculation will “magically” remove them from the resulting image, since the pixel values the moving person contributes lie far away from the median pixel values.

Going back to our example image, the massive reduction in noise can be clearly seen if viewing at 1:1 pixel size with the two images adjacent to each other

Wurzburg Radio Telescope comparison

With the reduction in noise it is now possible to apply other post-processing techniques to the image to pull out detail that would otherwise have been lost. For example, by using curves to lighten the above image it is possible to expose detail of the structure holding up the telescope dish:

Wurzburg Radio Telescope comparisonSo next time you are in a situation where your camera’s high ISO noise performance is not adequate, consider whether you can make use of image stacking to solve the problem in post processing.

 

Planetary astrophotography on a low budget

This posting talks about the key equipment needed to do planetary astrophotography on a low budget. For deepsky astrophotography on a budget, a barndoor mount is a better starting place.

One of the first surprises when learning about planetary astrophotography is that you don’t actually want to capture images. Instead, standard practice is to capture videos of the objects in question, a minute or more in length. These are then processed with a variety of applications to produce an image that is far higher in quality than what you could get if you tried to directly capture a still image. So in terms of equipment, what is needed is a telescope and a video camera of some kind.

The Camera (Modification)

There are plenty of video cameras designed explicitly for astrophotography, able to capture either monochrome or full colour images. For a monochrome camera, coloured filters are used to enable separate videos to be recorded for each colour channel. Dedicated astrophotography cameras are at least £100, often much, much more. As a beginner it is hard to know what will be the choice to start with and even whether the interest in astrophotography will stick. The low cost route is to thus go DIY, which involves taking a regular computer webcam and modifying it to make it suitable for astrophotography. There is an enormous selection of USB web cams on sale in the shops, and an even bigger selection second hand on eBay. Some are more suitable for astrophotography than others, so it pays to do a little research on the forums to figure out which have proved effective. Almost every forum thread on the matter will at some point recommend the Philips Toucam, but these are long since discontinued and postings on eBay sell for an unreasonable amount of money.

A little research, suggested that the Microsoft Lifecam Cinema HD is a good contender, and can be had on eBay for as little as £20. This is capable of capturing at a resolution of 1280×720, which is actually higher than many dedicated astrophotography cameras. It is worth pointing out though, that resolution is not king as the individual pixel size, low light sensitivity and noise characteristics all have a huge impact on the end result. The appealing quality of this particular model were the detailed instructions Gary Honis has written about the modifications needed to make it suitable for astrophotography. The images of Jupiter he posted give an indication of what the camera is capable of. Incidentally his website is a fountain of knowledge when it comes to astrophotography camera modifications.

Microsoft Lifecam Cinema HD, as sold

Microsoft Lifecam Cinema HD, as sold

In essence the mod requires stripping off the case to expose the camera assembly and circuit board, followed by very careful surgery to remove the lens and infrared filter, thus exposing the bare CCD chip. Part of the case is then re-attached before fitting it into a 1+1/4″ cylindrical case the same size as a telescope eyepiece. Gary used a pair of eyepiece extension tubes, but the UK company Billet Parts sells a plastic case custom designed & machined for astrophotography mods of the lifecam cinema. If there website shows out of stock just email them and they’ll produce another batch. Highly recommended, as it comes with a dust cap too.

Microsoft Lifecam Cinema HD, modified

Microsoft Lifecam Cinema HD, modified

One final point is that the CCD chip is sensitive to infrared and the built-in IR filter was removed during the modification. So for doing normal colour imaging of planets, a replacement IR filter will be required. Any standard 1.25″ eyepiece filter can screw into the custom billetparts case, and suitable 1.25″ IR filters can be had for about £20-25 online.

The Capture Phase

With the camera chosen (or built), the first actual step in producing an image is to capture a video. When targetting Jupiter, it is generally recommended that video captures be no more than 2 minutes in length, otherwise features will begin to suffer from motion blur due to its high speed of rotation. If capturing the 3 colour channels separately with a monochrome camera & filters, that means each individual channel is limited to no more than about 40 seconds (and that assumes you have a filter wheel for fast changes). When targetting the Sun or the Moon, it isn’t necessary to worry about rotational speed of the target, so videos can be as long as desired.

For video capture on Linux, the open source program guvcview offers full control over all the camera settings and the video codecs used, which is an important requirement for astrophotography. Maintaining maximum possible detail/quality in the initial video is key to being able to bring out good details in the final image. Critically, transcoding the video from one format to another is to be avoided, as this will usually loose information. The goal is thus to capture in a format that the video stacking application will be able to read directly. The best choice is thus an AVI file, ideally with raw uncompressed codec, or failing that something common like MJPEG. Before going out at night to capture something important, do a quick test capture of 15 seconds and try to load it into the stacking program you intend to use, to verify that it can indeed understand the codec you chose. Using raw uncompressed video results in massive file sizes even for a 60 second capture and may have a lower maximum frame rate; MJPEG is inherently throwing away detail so can compromise the final image quality but allows for higher frame rates. The frame rate is fairly important as the more frames that can be stacked the better the final image will typically be. Pick your poison.

Accurate focusing of the telescope is also a very important factor when capturing the videos. Slight mistakes in focusing can really badly impact the final result. It is worth investing in a focusing aid like a Bahtinov mask for your telescope instead of trying to judge it by eye. While you can make your own, another UK company Morris Engraving produces high quality masks from toughened black acrylic, custom designed for every telescope you’re likely to need, at a very reasonable price on eBay. Again, highly recommended.

Bahtinov Mask

Bahtinov Mask

I am using a Celestron Nexstar 4 GT telescope, which is a Maksutov Cassegrain design with 4″ / 102mm diameter lens and 1398mm focal length, giving approx f/13 aperture. The long focal length is quite good for planetary imaging & observing, but makes it fairly poor choice if deepsky imaging is your plan (a fast refractor is a better choice for deepsky). The equivalent model sells new for about £500, but I got mine second hand from a friend for considerably less.

Celestron Nexstar 4 GT

Celestron Nexstar 4 GT

The final piece of equipment is of course a laptop, which presumably most people have access to. Laptops screens are optimized to work in pretty bright ambient conditions, so their screens are correspondingly bright. Upon taking a laptop outside at night it quickly becomes obvious that the screen is far too bright, even on the lowest brightness setting. This totally ruins night vision adaptation and will be very annoying to any other astronomers near by. The solution is to place a piece of red acetate film over the screen which reduces the brightness to a level which does not negatively impact night vision adaptation. Some astronomy shops sell this pre-cut to the size of your laptop screen at vast expense. The secret to getting a deal is to know the word “Rubylith”. Type this into eBay and many vendors will appear offering the perfect material for the purpose. It is also suitable for use as safe-light protection in photographic darkrooms. A sheet for £4.99 was large enough to cover a large laptop, a small netbook, a smartphone and a little left over to make a red light torch.

Rubylith

Rubylith

Summary

To summarize the key pieces of equipment for doing planetary astrophotography on a low budget are

  • Microsoft Lifecam Cinema HD – £20 from eBay
  • Lifecam eyepiece adapter case – £16 from Billet Parts
  • 1.25″ IR blocking/cut filter – £20 from eBay or other sources
  • Bahtinov mask – £15 from Morris Engraving via eBay
  • Rubylith sheet – £5 via eBay
  • Laptop – any that can control the webcam.
  • Telescope with tripod & mount – almost any, but Cassegrains are a good option for Planetary use. £200-300 for a second hand Nexstar 4, or £300-£350 for a brand new Skywatcher 127 which is a real bargain for what it provides – pretty comparable to the Nexstar in what it provides. Or pick from 100’s of other possible scopes.

The setup described above is suitable for imaging The Sun, to capture sunspots, but it is MANDATORY to have a protective filter in front of the telescope. These can be built using a sheet of Baader Astrosolar Safety Film for approx £20. For carrying all the kit around, skip the official cases and adapt a regular sports / holdall bag.

For a selection of the photographs I’ve produced using this setup, browse the ‘lifecamcinema’ tag on my Flickr profile