Introduction: Astrophotography: Star Photo Stacking
Ever wondered how people take those amazing photos of the night sky, filled with nebulae, galaxies and all sort of impressive sights? Well, you don't need the Hubble telescope for a great photo of the night sky. You can get great results with just a digital camera and a computer. How? The magic of stacking.
In this Instructable I'm going to show how a little statistics-based magic can help you get outstanding star photos, even with a regular compact digital camera. All you really need are a camera and a computer, although a remote control for the camera and a tripod will make your life much easier.
Step 1: Why Stacking?
The main problem with stars and things you want to photograph is that they're so dim. Very little light reaches the earth from a dim star, so just pointing your camera at the sky and clicking the shutter will only capture a few of the brightest stars. Ideally, you want to leave your shutter open for as long as possible, but there are problems with this.
Firstly, the stars move around the sky, so on any exposure above about 15 seconds the stars will stretch out into curved streaks. This is a cool effect if it's what you're after, but if you want a picture of the sky as it appears to your eyes it's not helpful.
The second problem is that digital cameras pick up stray radio signals, cosmic rays, thermal vibrations and all sorts of other things which aren't starlight.
Thirdly, most cheap digital cameras will only take single exposures for a maximum of 15 or 30 seconds. An SLR with bulb mode will happily leave the shutter open for as long as you want, but this is a guide that will work with any camera. Fortunately, stacking images can get rid of all of these problems and increase the amount of detail visible in return for a little effort.
My examples will be taken from a set of photos I took of Cassiopeia and the surrounding sky. The image above shows a comparison of just Cassiopeia between one of my raw photos and the finished stack.
Step 2: How Does It Work?
This step is more about the theory of how stacking works- if you don't care about random distributions and would rather get going, feel free to skip it.
Roll a dice once and you might get any result from 1 to 6. Roll it a thousand times, and you can be pretty sure the results will average out to about 3.5. If the results average to a different value, you can be fairly sure your dice is loaded. There's no way you could know that from a single roll, but by taking the average of lots of rolls you can see the pattern of behaviour. Your camera works the same way. If you take a single photo in the dark, it will look speckly. This is because of the random signals, or noise, the sensor picks up. This noise obscures the actual subject of your photo and means you can't tell what is a speckle and what is a dim star.
Taking lots of photos is the equivalent of rolling a dice a lot of times- you are taking a lot of samples of each individual piece of sky and taking the average brightness to eliminate random variations. The average value of a pixel that was pointing at a star will tend to be slightly brighter than a pixel that was pointing at dark sky, but this difference might be smaller than the random variations on any single photo.
In general, the more photos you take, the more uniform the background noise becomes after averaging and the more detail you can pick out. A statistician would say that the averaged photo contains more information than a single exposure- there's more meaningful detail.
Once you've got a composite made of the average of many photos, you can tweak the levels with image editing software so the background is the black you expect from the night sky and the stars stand out.
Step 3: How Do We Do It?
Take a lot of photos of the night sky. That's largely all there is to it. You'll want to set your camera to a reasonably high ISO, though perhaps not the highest it has as this tends to exacerbate random noise. Set it to a longish exposure- 10 seconds is plenty, 30 might be too long as stars will begin to turn into streaks at this length. If you can, set it to infinite focus manually, but if you can't you might need to point it at a bright star or a planet for it to autofocus properly.
Point it at an interesting patch of sky, and take lots of photos. I use a tripod but you can just lie your camera on its back on a flat surface or prop it up. Ideally, take these photos using a remote so you don't have to touch your camera and risk jogging it. Even more ideally, use an intervalometer- there will be more on the intervalometer I made at my intervalometer Instructable. You can make one that works with many digital cameras with an Arduino and an IR LED.
For the best results, now put the lens cap on your camera or somehow block out all the light, and take more photos. You'll want to take the same number as you took of the sky, with the same ISO and shutter speed, with the camera at the same temperature. These are called dark frames, and they are used to improve the job of removing noise from photos. You don't need to do this if your camera has digital noise reduction (a feature where the camera takes a dark frame and subtracts it from the image for you).
Step 4: Get Processing
Now we have fifty photos of the sky and fifty photos of the inside of your camera's eyelids. What next?
Well, if you're using software like RotAndStack or DeepSkyStacker, download your photos to your computer, remove any you don't want (if they have clouds on them, trails from aeroplanes flying overhead or other things you don't want) and open them with the software. It does all the tedious alignment, stacking and other bits and pieces for you. All you will have to do is to tweak some settings for the best results, and edit the levels once the stacking has been done for the best brightness balance.
The software is doing a few tasks that you can do by hand, but it's incredibly tedious. First it aligns all the photos so that the stars are in the same place. Good stacking software will save copies of your photos once it's aligned them so you can play with them in Photoshop if you want to by opening all the photos as layers.
Next, it does dark field subtraction. Sensor noise isn't entirely random- your camera's sensor will have a pattern to where the noise appears. On my camera, the noise tends to be brighter in the middle, fading to darker at the sides with a brighter patch at the bottom- see the image. Your stacking software will work our your camera's noise profile from the dark photos you took with the lens cap on. Subtracting this from the image means that whatever is left should be truly random noise distributed evenly over the image, so your end photo won't have brighter and darker regions.
Lastly it stacks all the photos up and takes the average of each pixel. This is the statistical wizardry that finds stars too dim to make out in any single exposure by reducing background noise. It may also save an image showing the brightest value seen for each pixel- this is usually a compromise, more speckly than the averaged image but with more faint stars visible.
At this point you have an averaged image which contains as much detail as you are going to get from your raw photos. It's now up to you to tweak the light levels of your stack to make your image look better. Tthe aim is to adjust the levels so that the background grey in the image is just darkened to black, and all levels above that are lightened to make the stars more visible. You can do this in your favourite image editor, where the Curves operator comes in very handy, but it's out of the scope of this Instructable to explain that.
Finally, I can't leave out a mention of GuiltyPixel's instructable on astrophotography. He goes into way more detail than I have here, and if you want to know more about the subject it's well worth a read. Incidentally, I was just about to publish this Instructable last November when his was published first, and I was so dispirited by how much better it was that I put off publishing mine until now :)
We have a be nice policy.
Please be positive and constructive.
So we take 50 shots, ten second exposure each of the night sky, then 50 shots with the same settings with the cap on and then do the precessing right? This is a lot of time how does this not produce huge star trails?
Because we use stacking software to align all the photos together so you only ever see 10 seconds worth of star movement. 50 x 10s exposures comes out looking the same as a 500 second exposure where you re-oriented the camera to the apparent movement of the sky every 10 seconds. (This is the alternative approach: make a motorised mount which tracks the sky and then just stack all of your exposures directly on top of each other).
Stacking software corrects the position of the stars, by shifting the frame on each exposure