Zbynek Vrastil

Assisted Color Calibration Tutorial

The purpose of this tutorial is to show you typical usage of AssistedColorCalibration process in order to find out white balance coefficients for your camera. White balance coefficients describe spectral sensitivity of your camera (and filters) to three basic colors - red, green and blue. If the sensitivity differs from color to color (which is almost always the case) proper white balance must be applied to the image to restore true colors of the imaged scene.

There are ways to measure the coefficients - for example by taking a picture of white sheet of paper in full sunlight and computing channel ratios from such image. PixInsight also provides tools like ColorCalibration or BackgroundNeutralization to do the color calibration in automatic or semi-automatic way. However, if you are not satisfied with the result or you want higher degree of control, the AssistedColorCalibration is here to help you. It allows you to tune up white balance coefficients while evaluating approximation of the final processed image.

Once you find out white balance coefficients that give you the result you want, you can apply them to any image taken with the same camera and filters. As the coefficients correspond to spectral sensitivity of your imaging assembly, they are not affected by external conditions or imaged object. Still, you can use AssistedColorCalibration process to check them quickly with your actual image.

Step 1 - preparation

If you are to find the white balance coefficients, choose your image well. An image of galaxy or star cluster is ideal as it provides full-spectrum information. Nebulae are not so good because they typically exhibit only some specific colors. It is also necessary to have reasonable part of image without any deep sky object to serve as background reference.

I have chosen my image of pair of galaxies M81 and M82 in Ursa Major (also known as Bode's Nebulae). The image was taked with Canon DSLR (the original sensor filter removed). No extra filter (like CLS filter) was used. The image was taken about 30km far from the town of Brno (Czech Republic, 400 000 inhabitants) so there is a lot of orange light pollution in the image. The image is already pre-processed with DeepSkyStacker - dark, flat and bias frames were applied to each subexposure and all exposures were registered and stacked together to 32bit TIFF image.

After loading the image into PixInsight we do not see much (which is quite common for astronomical images). So let's use ScreenTransferFunction to see what's really in the image.

We can clearly see both galaxies now. We also see the amount of orange light pollution strongly dominating image colors. Let's switch off ScreenTransferFunction for the time being.

Step 2 - defining previews

First of all, a little bit of theory. Why should we do the color calibration now? Wouldn't it be more convenient to neutralize the background first, stretch the histogram and etc so that we can see what we are doing?

The answer is no. We have to do the white balance as the first step - even before we do anything with the background. That's because everything in our image (even background) is affected by spectral sensitivity of our camera and filters used. Pixel values in our image can be expressed with equation P = k * ( S + B ). P is the pixel value, S is the signal from sky, B is the background and k is the number expressing the sensitivity of our camera to particular color. Our ultimate goal is to have only S in our image. It is clear that we have to divide our pixels by k first and then we can subtract the background B. We know that after these two steps, pixels containing no star or object should have neutral color.

The whole point of this tutorial is to find out correct values for 1.0/k (= white balance coefficients) for each channel. Before we start, we need two previews in our image. The first preview is used to evaluate the white balance coefficents. I've chosen the galaxy M81 and created a preview containing only this galaxy (Preview01). Then we need a second preview containing good background reference. I've created this preview just above the galaxy to minimize the effect of possible background gradient (Preview02).

Step 3 - setting up the process

We are prepared so we select the Preview01 and launch the AssistedColorCalibration process interface. You can find it under the ColorCalibration category.

For the time being, let's keep the White Balance coefficients equal to 1.0. We will first set up the preview so we can see what are we doing. We select the Preview02 as the background reference. We also set up the Histogram Transformation so we can see outer parts of the galaxy. Finally, we boost the Saturation by the factor of 3 and apply the process to Preview. We can clearly see that the result is not what are we expecting. Please note that the background itself is neutral due to background subtraction. However, the galaxy and stars color hue is shifted to orange. That's why we need to correct the white balance.

Step 4 - finding White Balance coefficients

Now try to find correct white balance coefficients by trial and error. We expect the outer parts of the galaxy to be blue as they are dominated by young and hot stars. The core of the galaxy is usually yellowish, containing old red stars.

Firstly, I increased the blue coefficient to get reasonable color in the outer arms. Then, I used the green coefficient to make the core of the galaxy look more natural. I also found it useful to increase Saturation Ehancement to 4.0 to see the result better. After each change we need to apply the process to check the effect. So now we have the image which is much better balanced.

It is not easy to improve the white balance coefficients more without some reference. I used Robert Gendler's image of M81 galaxy here as an ultimate reference. I tuned the green and blue coefficients a little bit more to make my result closer to the reference one.

Step 5 - applying coefficients to image

We have our coefficients and we have to apply them to the original image. Now switch from Preview01 to full image and apply the process to it. Remember, only white balance coefficients are applied to regular images. As no preview-related parameter is used, the image is not changed a lot but it has lost some of its orange hue. We can close the AssistedColorCalibration process interface.

The tutorial for AssistedColorCalibration process could end here. However, just as the proof of concept, let's continue with simple post processing. At first, we apply ScreenTransferFunction again to see more of the image content. We can see that image is still orange. This is correct. Remember, by white balancing we only removed k factor from the equation mentioned in Step 2. We still have to remove background B responsible for the rest of orange color.

We proceed to background subtraction. Our image is suitable for AutomaticBackgroundExtractor process as most of the image is sky background. For more difficult cases DynamicBackgroundExtractor is prefered since it gives you much higher degree of control. We keep default values of AutomaticBackgroundExtractor parameters. In the last section of Target Image Correction we choose Subtraction as a method of correction and we check Discard background model and Replace target image checkboxes. In this way, the process immediately subtracts the background from the image. Keeping ScreenTransferFunction in place, we can see the result clearly. The background is neutral now. However, the image looks almost grayscale. This is because of low color saturation.

We finish the processing with histogram stretch using HistogramTransformation process and with increasing the color saturation using ColorSaturation process. For the color saturation enhancement I used a simple luminance-based mask to prevent increasing saturation of background chrominance noise. The last image shows the result of this simple processing.

Comparison to ColorCalibration process

I also tried standard PixInsight ColorCalibration process using the same image. I've chosen Preview01 as Reference Image in the White Reference section and Preview02 as Reference Image in the Background Reference section. All other parameters were left to their defaults. The computed White Balance coefficients were R = 1.0, G = 1.219, B = 1.683. The values are almost equal to our result, using AssistedColorCalibration: R = 1.0, G = 1.220, B = 1.650.

I take it as a proof that both processes are working correctly. ColorCalibration does really great job and is able to produce coefficients in fully automatic way, as long as it has suitable reference object - close spiral galaxy. AssistedColorCalibration comes handy if you do not have such object in your image. And it can be used to check already computed coefficients on any other image.

Back to main page