## 72898Re: [ccd-newastro] Calculating average brightness in an area of a fits image

Expand Messages
• Jun 2, 2013
• 0 Attachment
I'll add my two cents to this. It's a topic that has been around for a long time, and there are many ways to look at it. I have my own reference points, and I think they are useful ones. There's a long discussion about it in my first book with some visualizations that help show the difference; here's a short version without the illustrations.

I call the two different types of color problems color _bias_, and color _imbalance_.

Let's start with color bias. Any bias is simply an offset. It applies to voltages and other things, as well as to color levels. So if there is a bias in a color, it means that the _real_ values are offset by the same number in all cases. So if one pixel has a true value of 100, a bias of 12 means that the pixel will contain a blue brightness value of 112 instead of 100. Another pixel with a true value of 21 will contain the value 21+12, or 33.

To remove a blue bias, you subtract the same amount from the blue channel of every pixel. The trick, of course, is figuring out what that amount is.

So a bias is a uniform, unwanted signal that affects all pixels equally.

A color imbalance occurs when different amounts of signal are recorded for each channel. In this case, the effect on each pixel is proportional, not fixed. For example, blue brightness might be 20% more intense than the other channels. Using the same brightness values as in the previous example, the pixel with a blue brightness value of 100 would have a recorded value of 100*1.2, or 120. The increase in blue brightness for for a pixel with a blue value of 21 would be 21*1.2, or 25.2.

So you can't simply subtract a uniform value to correct a color imbalance, you need to adjust the percentages of each color channel to achieve balance.

So one key point is this: color _bias_ and color _imbalance_ require different mathematical methods to be solved. That's important because it establishes the need to address each individually. You can't properly balance color if there is a bias; you can't remove a bias by color balancing.

(Not explained here, but you be able to see why on your own: if there is even a very small color bias, changing the color balance will amplify that bias. So you must remove color bias first, then balance color. It's also a good idea to look at the color bias after a color balancing, just in case there was any residual you missed.)

There are good tools for each of these corrections. The trick is in knowing how to tell which is which. Looking at the individual color histograms is the best way to spot a color bias: the black point will be different in each channel. (That is, the rise at the left side will occur at different distances from the left margin.) The appearance of a color bias is more subtle; the actual histogram curves will have different proportions. (Note: an image with a lot of one color can mimic this, as when you image a nebula that is heavily dominate by H-alpha emissions.)

More to the point of your question, sky glow is 'sky color' - you can't really separate things like airglow and light pollution; they are all simply recorded during your exposure. On the other hand, once you learn to remove bias and imbalance separately using whichever tool you prefer, you will automatically correct for _all_ color issues correctly. The source is not nearly as important as making sure the right math gets applied to the right issues!

On Jun 2, 2013, at 10:29 AM, Mark Striebeck <mark.striebeck@...> wrote:

> Hi Stan,
>
> Thanks a lot for these instructions (I was just composing an email asking
> how to do this? :-)
>
> But why is it that sky glow affects star colors differently then sky color?
> In my (naive) view, I thought of sky glow as a kind of filter that distorts
> the color for everything equally in an image.
>
> Thanks
> MarkS
>
>
> On Sun, Jun 2, 2013 at 10:25 AM, Stan <stan_ccd@...> wrote:
>
>> **
>>
>>
>> Obviously the sky background color pollution was not handled and those
>> ratios are invalid.
>>
>> To calculate color/filter ratios, it is imperative to first subtract sky
>> bias levels from each component.
>>
>> To manually calculate:
>>
>> For each filtered image, measure the mode or median of nearby dark sky (no
>> stars or nebula) and then measure the avg of a tight and uniform box
>> surrounding the calibration star (G2); subtract the background from the
>> star and use that for the ratio calculations.
>>
>> To calculate via CCDStack:
>>
>> Create a color image, open the "Adjust Color" form (if not already open)
>> and perform a "set background" (if not done already). Drag a tight
>> rectangle around the calibration star and press the "balance" button (be
>> sure the "factor" radio box is checked). The ratios are automatically
>> calculated and displayed. To normalize ratios to a particular color –
>> double-click the area next to the ratio display box for that color. (read
>> Help: Concepts, Color section)
>>
>> Stan
>>
>>
>>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
>
>
>
• Show all 23 messages in this topic