Contacter l'auteur / Contact the author

Recherche dans ce site / Search in this site






Composites by Examples

Image of M42/M43 created by Akira Fujii and postproceed by the author.

Case studies (I)

We have seen in the previous page that astronomical pictures taken by amateurs display sometimes dominances and artifacts which can be easily suppressed if we take the time to apply some specific algorithms and image processing techniques.

In order to improve the quality of your pictures, let's see briefly several of these techniques :

1. The unsharp masking in sandwich with images of various time exposure to enhance features

2. The RGB composite of three monochrom channels

3. The LRGB composite uisng 3 monochrom channels and the Luminance

4. The exposures composite and stacked images

5. The isophote mapping to separate area of same density

6. The H-alpha Trichromy similar in its principles to RGB composite

7. The balance alteration to get special effects

Unsharp Masking

Many amateurs that I contacted to write these pages told me that the description of unsharp masking technique is often very vague for a casual photographer or too complex to understand. More, there are many ways to process an image to improve its features, working both on the amplitude and the frequency of signals. These profiles can in fact take almost an infinity of shapes. So this is a true challenge for me to explain you such a technique in very few pages with ordinary words.

In order to get a better understanding of this technique, we must first define the vocabulary in use and compare the various methods to get a clear view of this process.

By refering to the history of this technique, the unsharp masking for astronomy was historically implemented by making an out-of-focus negative film - the unsharp mask - and then printing the original in sandwich with this negative film.

So with words borrowed to the optical counterpart of this processing, we can define an unsharp mask basically as an out-of-focus image, blurry or fuzzy as a "blop", without defined outlines or contours. This unsharp image displays only what electronician call low-pass features, without sharpness, the latest being defined as high-pass features because they represent all small scale features of the image.

The goal of the unsharp mask is to increase the contrast of your original image. That means enhancing all these small scale features hidden in both bright and dim area and called high frequencies. Functions performing these tasks are called high-pass filters. The unsharp mask or blur mask performs electronically such an action.

In the past, we had to use the argentic method, placing an unsharp negative in sandwich with the original and repeat the operation several times in the dark, a tedious laboratory process as I explained in another page (in French). Today, thanks to imaging software, this process became much easier and can be performed by a casual photographer used to work with an image processing software (e.g. PhotoShop, MaxIm DL, Picture Window Pro, etc).

Using such tools keep always in mind that your goal is to enhance all details by removing graininess and the low light attached to it and not at all to murder your image !

The unsharp masking

A left a raw image of M42 and at right after unsharp masking. The image is now very rich of details. Picture taken by David Malin, Anglo-Australian Observatory.

1. A bit of theory

To understand how work this electronic process we must separate the two main actors :

- The operations that produce the detailed image

- The making of the unsharp image.

Addition, substraction and other operations

The electronic unsharp masking is a kind of high-pass filter, not a low-pass one in that sense that high parts of the image are revealed after processing :

Original image (high and low frequencies) - Unsharp image (low frequencies) = High frequencies (details)

There are several ways to get this improved image. If we refer to the traditional technique, the optical unsharp masking, we must use together a negative and a positive image. Mathematically speaking, the only language accessible to computers, if N is the negative and P the positive image, the sandwich of both images means to process N*P. This simple formula being already hard to understand for some readers, it means that we combine N with P, in other words we "add all N with all P", like 4*1 = 1+1+1+1; adding images means to make... a multiplication.

Indeed astrophotographers at AAO or the famous John Russ, author of a handbook about Image Processing confirms that this procedure is clearly a multiplicative effect, not a substractive effect as seems to say the above formula. So why to speak about a substractive method ?

Mathematician use many tricks and stratagems to simplify their formulae and explain difficult concepts. Here is one more example.

Take the log of N*P, a simple formula we learned at school :

Log (N*P) = Log (N) + Log (P)

P-term, the positive image is usually the negative of a negative, thus in fact (- k*N) until you reached the desired mask density. So our formula writes now :

Log (N*P) = Log (N) - Log (kN)

The resulting images sandwich is like... a substractive effect, Quod Erat Demonstrandum. 

Remind that this substractive process can not be reproduced manually in a digital darkroom because the enlarger cannot for example "multiply by 0" as even a clear glass presents a multiplication factor of 1.0. In its principle this substractive process is however very similar to the optical unsharp masking.

Substractive and dividing methods are also quite similar. Take an example. If a pixel presents an intensity of 200 in a range from 0-255, to reduce its intensity to 100 there are two possibilities : do 200 - 100 or 200/2. However, the first method does not produce the same result in bright and dim areas. In a bright area 255 - 100 = 155, but in dim area showing an intensity of 10 for example we can get negative value which is illogical. So using a mask with an intensity of 100 for example from the center to the edge will be most of the time useless, excepting to reduce the overall contrast or brightness of your image. 

Using as such to create an unsharp mask, the resulting image will look like more contrasted but will not necessary show more features in bright area. The dark zones will however be still darker.

A left, a raw image of M42 recorded by Akira Fujii with a 300 mm f/5 scope equipped with a cold camera. 50 minutes of exposure on Fujichrome R-100. The center part seems overexposed. At center, under Photoshop I applied an unsharp mask over the bright area and duplicated it several times until details appear. At right, the unsharp mask having offered all its potential, we added an image displaying a very low gamma (0.3 instead of 1.0) extracted from the second step to still enhance details. The processing can be repeated but with the risk to enhance artifacts and shift colors. Here is the resulting full image. Remember that the original image was recorded on a film, not with a CCD.

For all these reasons we should use the second method, dividing the whole image by a coefficient, 2 for example. In this way the brightest zones of a nebula will see their intensity reduced from 200 to 100 and the dim areas, from 10 to 5. This solution processes the whole image in the same way but in this case the mask looks like a gradient; the center is denser while edges display a very low intensity. This way of working, dividing the original image with a gradient unsharp mask is very similar to the traditional optical technique. Using such an unsharp mask, the resulting image will show immediately faint features in both bright and dim areas. But reducing this way the global intensity level of the image, its contrast (gamma) will also be reduced.

However electronic images can not be processed like argentic images. We know for example that computers cannot divide by 0 or they produce immediately a "divide by zero" error. To avoid this potential error dividing a small signal by a large coefficient we have to create a bias, for example by averaging several pixels around the true value. This function is call an hyperbolic transfert function and is used to compress the dynamic range of the image :

y = x / (<x> + a)

Now there is another subject to discuss : the shape of the mask

Unsharp mask and averaging

Making an electronic unsharp mask means averaging all signals. In creating a blurry mask, we get a second image in which stars look like small circular dots, very fuzzy. The theoretical unsharp mask should have very low frequencies around each point in order to extract the object from the background. The first idea that comes to our mind is using the Gauss's curve. Why this specific function ?

Mathematically speaking, an average is like a gaussian curve (the famous bell shape) showing a strong level in the center and low to null at the edges where there is no more information to extract. This is equivalent to a low-pass filter. But how can we stop it to the edges ? We must use an unsharp mask that mathematicians call a convolution with gaussian Point Spread Function, oops !

Simulation of a star image as seen through a 4" refractor free of aberration with its PSF in superposition. The PSF extends horizontally over 5 arcseconds each side. The image is enlarged for more clarity. Created by the author with Aberrator.

Being given that this explanation requests some knowledges of mathematics and statistics, to make short we can say in a few words that to get an electronic gaussian unsharp mask, similar to its optical counterpart, programmers convert the gaussian function using a Fourier Transfert function because the resulting distribution is still gaussian.

We can use other shapes to create this mask but trying to use a rectangular one for example, its Fourier Transfert function is a sine function. Its deconvolution is much more hard to process by the fact this is a heavy job of programming.

So, the principle of unsharp masking is to create two images :

- The original constituting of pinpoint stars on which is applied a convolution with a PSF of a few pixels size

- The unsharp mask using a gaussian PSF, pinpoint or slightly negative.

The processing will consist in substracting the second image from the first one.

At left, the theoretical shape of a pinpoint PSF and a negative PSF added to a pinpoint PSF. The left image shows the result of using a substractive unsharp PSF. Too strong, it enhances the edge of stars, producing an unaesthetic effect. A just equilibrium has to be found by experimenting various mask intensities (or threshold, level, depending on your software).


If the PSF is our best algorithm to extract objects is a blurry image, we must take care of it when it is applied to enhance the edges of this object, whether it is a star, a satellite, the line of moon terminator, the limb of planets or structures like Saturn's rings.

As the above drawing try to show it, adding a too strong negative PSF to a pinpoint PSF may produce artifacts like de Gibbs effect, the famous "black eyes" that sometimes surrounds stars. So imaging software like MaxIm DL, mainly renowned for its deconvolution function, has to be use with care to avoid such defects which occur quite easily. 

Some amateurs do not use the standard gaussian mask but have created their own. Kazuyuki Tanaka for example uses an arctangent transfert for all his pictures of DSO or planetaries. Electronic processing have a lot of freedom and he justifies his solution by the fact that it provides the best images for his instrumentation. The problem using a CCD is that the image does not look like an argentic image. The user has to consider how the image saturates at high level and he should correct this problem. So, using the arctangent transfer, Kaz get a very smooth image, almost as it was recorded on a traditional argentic support.

Shape and pixel size of the mask

The last parameter to select is the shape and the pixel size to use for the unsharp mask. Smaller is the pixel, lesser is the way of blurring to consider. It is easy to understand that using a too large pixel size we destroy the original image by creating a huge blop in place of increasing the resolution. A too small one will produce a too low resolution both horizontally and vertically or will produce no modification at all.

Usually the resolution of a gaussian unsharp mask is in the range 3x3 to 7x7 pixels, showing a square shape, the most common and easiest shape available in imaging programs. Custom masks can be created in most powerful imaging software for specific subjects. You can for example use a rotational or rectangular gradient to improve the tail structure of a comet or the vertical resolution of a elongated object.

At left, the original image of M51 unprocessed. At right, after postprocessing with an unsharp mask of 5x5 pixels. The image is now crisper and stars in the galaxy arms are much more numerous.

Voilą in a few words the theory to know before using the unsharp masking. The way of making use of this technique depends of tools available in your imaging software but in all cases it requires several steps we are going to explain in the next page.

Next chapter

Unsharp masking, 2d part

Page 1 - 2 - 3 - 4 - 5 -

Back to:


Copyright & FAQ