K3CCDTools tutorial1
Deep Sky processing

by Carsten Arnholm

Legal notice: All information in this page is Copyright (c) Carsten A. Arnholm

(This tutorial is based on K3CCDTools, a software program authored and owned by Peter Katreniak. For legal information relating to use of K3CCDTools, see http://www.pk3.org/K3CCDTools/.)

Personal, non-commercial use of tutorial allowed: You may freely use this tutorial for non-commercial purposes, but you are strictly required not to make any form of profit (monetary or otherwise) related to the use of this tutorial. You may not use this tutorial in relation to commercial product(s) you may be marketing.

Commercial use of tutorial prohibited: Any person, company or other entity that markets astronomical products for the purpose of making profit are commercial users. Such persons, companies or other entities are prohibited from using, copying or linking to this tutorial without an express written permission from the author.

This tutorial is an attempt to explain how to use K3CCDTools to process deep sky images captured with long exposure enabled webcams. K3CCDTools is an amazing (and free!) program written by Peter Katreniak. The program can be used for capturing planetary or deep sky images, and also process these images. This tutorial will not discuss processing of planetary images (see the Planetary Wizard in K3CCDTools to do that).

If you have detailed questions about the program, its theory or implementation, I suggest you contact Peter directly. If you have suggestions for how this tutorial can be improved, you are very welcome to send that to me. This is version 2 of the tutorial, dated Nov 27. 2002. It is based on K3CCDTools version

Tutorial Overview

This tutorial will discuss the following steps

Raw Image Data

K3CCDTools can be used for capturing long exposure images. Typically, a series of long exposures are captured and stored as individual frames in an AVI video. These frames are later integrated to form a final image, hence the term video integration.

You can create your own long exposure AVI's, but for the purposes of this tutorial, my M57 (Ring Nebula) files can be found in . It is a 1.49MB zip file containing a M57 video (68 exposures, each 30 seconds long), a dark frame video and a flat field bitmap image.

Please note: In order to facilitiate easy download over the internet, the supplied AVI files have been compressed using DivX codec version 5.0.2. In order to read the AVI files with K3CCDTools, you must install the DivX codec, available for free at http://www.divx.com/divx/. Compressing the files using DivX codec has degraded the image quality somewhat, but it is still very usable as a tutorial example. The original M57/dark frame video size was about 20MB, too big for easy download.

The raw videos were created August 7, 2002 in Norway. At that time of the year we do not have complete darkness, only astronomical twighlight. I used a C8 SCT mounted on a Vixen Super Polaris GEM and a concrete pillar. The focal length was 2032mm (F10). No autoguiding or periodic error correction was in use, and the raw frames suffer from significant periodic error due to imperfections in worm shaft and brass gears between MT-1 motor and worm shaft. The camera is a Phillips Vesta 675K SC, i.e. the simplest no amp-off modification. It was "T-shirt conditions" during the capture, so there are many hot pixels in the images.

Dark frame processing

A dark frame is an image that has been shot with the telescope front cover on. It will therefore only contain unwanted information generated by the camera itself. Here's how I like to think of the dark frames:

captured frame = real frame + dark frame


real frame = captured frame - dark frame

We can figure out what the dark frame is by creating an image whithout allowing any light to touch the CCD chip. This is why we cover the front of the telescope while shooting dark frames. All other conditions, especially temperature, should be the same as when making the real exposures. By subtracting the dark frame from the captured frames, we can make a very good estimate of what the "real frame" should be.

The experts say that, as a rule of thumb, you should capture at least 5 raw dark frames, but the more you capture, the better (especially true for very faint objects). The dark frames will be averaged to form a master dark frame which we subtract from the real frames. The length of each dark frame exposure should be the same as each real exposure, in order to generate the same level in the dark frame images as when you do the real exposures. The master dark frame will contain only averaged internal noise generated by the camera itself. When we subtract this information from the real exposures, the signal to noise ratio will go up, and our image will look much better.

Task: Start K3CCDTools and open the dark_divx.avi video (File | Open video ...).

Here, you see a number of identical looking images with white dots in them. These dots are not stars, they are hot pixels. Hot pixels are a characteristic of CCD cameras, the higher the temperature is, the more hot pixels you get. That is why many cool their cameras with fans or peltier devices. An important aspect of dark frame subtraction is to "remove" the hot pixels in the final image.

Task: Create the master dark frame:

Rough image alignment

Our next step is to roughly align the frames of the real exposures. We do this by clicking on a magnitude 13 star to the lower left of the faint M57 image. We will use the automatic FFT (Fast Fourier Transform) alignment feature, so the same star will be identified in all frames automatically.

Task: Rough alignment:

Dark frame subtraction

Before we go to fine image alignment, we will adjust the image with the dark frame we just created into the process, as the fine alignment works better that way.

Task: Select dark frame:

Flat field adjustment

The second image adjustment we can do, is flat field adjustment. The dark frame will adjust for noise in the camera, while the flat field adjustment can to some degree correct problems with vignetting etc., causing the image to have uneven brightness. Each pixel in the resulting image is treated according to this formula:

Result = (Frame - DarkFrame) * FlatFieldMax / FlatField

One can make a flat field by imaging a uniformly lit area. I didn't do that in this case. Instead, I "faked" a flat field by trying to compensate for the remaining amplifier glow (this procedure is formally incorrect, the dark frame subtraction should remove the glow, but somehow it wasn't quite enough). It turns out that in this case, it works well to make a flat field image based on the dark frame we made earlier. I simply entered the dark frame into Photoshop, and used the levels tool to increase the brightness to a fairly high level. Then I used Gaussian blur to turn it into a completely smooth image and saved it as a normal 24 bit BMP file.

The resulting flat field image is shown below (as JPG). As you can see, it is geared towards fixing the most annoying problem in our raw data, the amplifier glow.

Task: Select flat field:

Fine image alignment

We will now use the magnitude 13 star to align the image the best we can. We will use the Difference Alignment method to calculate fine alignment.

Task: Perform fine alignment:

Image integration

Here, we will add together (i.e. integrate) the 69 exposures. K3CCDTools does this using intermediate 32 bit values for Red, Green and Blue, so there is no information lost in the integration process.

Task: Integrate the aligned images:

Histogram adjustment

We now have our integrated image. We just want it to look better. The best way to do that, is to use histogram adjustments, where the information is mapped into 24bit RGB for proper display.

Task: Ajust the histogram:

At this stage, this is what we have:

Image Export

Now we can export the result to a BMP file for final tweaking in Photoshop, The Gimp, Paint Shop Pro or other image processing program. Even the very lightweight and free program IrfanView does a very nice job, but a program that has a curve tool or advanced histogram/levels tool is preferred.

Task: Save integrated image to BMP:

Final adjustments in Photoshop

Here are some typical adjustments to be done in Photoshop This image is now pretty good, improvements must come from better tracking and more exposures!

Task: Photoshop adjustments:

Final image:

Color balance dialog in Photoshop.

Brighness/Contrast dialog in Photoshop.

Gaussian blur dialog in Photoshop.

Unsharp mask dialog in Photoshop.

Curves dialog in Photoshop.

The end

A big Thank You goes to Peter Katreniak for creating this excellent software and providing it for free!