This is a short introduction to basic image processing. Your best source for more information would be "The Handbook of Astronomical Image Processing" by Richard Berry and James Burnell (Willmann-Bell Inc., 2000)

Any raw astronomical image is usually considerably affected by noise and vignetting as well as sky background brightness. However, unlike in the case of film-based photograph, those obscuring factors can be easily remedied in electronic image to reveal the true splendor of faint deep sky objects.

So, how does it happen? The example below shows a process of creating a grayscale CCD image of NGC7139 planetary nebula in Cepheus. All frames were taken with a Cookbook 245 CCD camera on Celestron Ultima 8-inch f6.3 SCT and processed using AIP4WIN.

Image aquisition

Raw images

After locating your target, obtain as many and as long integrations as feasible. Accumulated signal and signal-to noise ratio of the image are proportional to the duration of integration. Of course longer integration are subject to tracking/guiding errors, satellites crossing the field of view, saturation of CCD by bright stars, increased chance of cosmic ray hits etc. Of those, tracking problems are most frustrating - that's why I use autoguider (Cookbook 211) for any exposure longer than 1 min.

Below is an example of a single 4 min. integration:


Calibration frames

Those are needed to remove the effetcs of dark current and vignetting/dust shadows from your raw images.

Dark frames - Cap the telescope and take a number of integrations as long as those for raw images.

Flat frames - Attach light box to the telescope and take a number of bright flat exposures with an integration time giving the average signal corresponding to about 1/3 to 1/2 of the dynamic range of your camera. Then cap the telescope and take a set of flat dark frames with the same exposure time.

If your camera does not automatically subtract bias, then, with telescope still capped, take a set of bias frames with the shortest possible exposure.

Image calibration

Master dark frame - median combine (or average) all dark frames to create master frame with lower noise. Below is an example of such master dark created from ten median-combined 4 min. dark frames:

Master flat frame - median combine (or average) bright flats and, separately, dark flats. Then subtract master dark flat from master bright flat to obtain master flat frame:


Because Cookbook cameras automatically subtract bias and add 100 to each pixel, there is no need to obtain bias frames in this case.


Master dark frame is subtracted from each raw image to remove dark current which accumulated on top of the signal caused by light. This subtraction is carried on a pixel-by-pixels basis, with master dark serving as a map of dark current. Below is an example of resulting dark-subtracted image:

While salt-and-pepper patern caused by dark current is gone, this image stil suffers from considerable vignetting and dust shadows. High contrast version below shows those defects better:


Value of each pixel in the dark-subtracted image is then divided by a relative sensitivity of that particular pixel derived from master flat frame. Resulting calibrated image has now even background:


Image stacking

Single calibrated image, while quite improved, still suffers from considerable readout noise and photon noise (corresponding to an uncertainity of signal measurement by camera's electronics and statistical uncertainity of the amount of light arriving from the target, respectively). To improve signal-to-noise ratio, multiple calibrated images can be combined together by averaging or median stacking. The improvement will be roughly proportional to the square root on the number of combined images.

Compare the above single calibrated image to the average of ten calibrated images below - there is more faint stars visible now due to reduced noise:


Image scaling

Unlike the film or human eye, CCD responds to light in a linear fashion. While this makes all the above steps possible, the resulting image usually looks quite "flat". Majority of astronomical targets are barely visible as they are not a lot brighter than the sky background. To display more detail in areas of interest (which makes the whole issue quite subjective of course) brightness and contrast have to be changed.

There are three main types of conversions used to achieve that:

Below are examples of the same image scaled differently:

unscaled stack (black=538 , white=28982)


linear scaling (black=538 , white=2476)


logarithmic scaling (black=538 , white=2476, log mix=0.333)


gamma-log scaling (black=538 , white=2476, gammalog mix=0.350)


tangent histogram shaping (concentration =1.4, peak skew = 0.35)


histogram equilization

The outcome of brightness scaling step depends on the algorithm as well as parameters chosen. It is really up to you to pick a combination which works best on the particular image.

The order of operations

This is the order of operations I use when processing CCD image:

  1. Calibrate each individual image

  2. Align them all to a single image

  3. Scale the brightness of each individual image (linear or non-linear)

  4. Merge by averaging or median filtering

  5. Run deconvolution (AIP4WIN "slow"Richardson-Lucy protocol is my favourite) or unsharp masking if needed

  6. Adjust brightness of the final image if needed

Go back to Main Index

Number of visitors:

ŠJan Wisniewski