## Color Space Geometric Interpretations of Color

To make color images, we capture information as an (x, y) array of (R, G, B) triads. Color images are two-dimensional displays of color points. We can, however, plot the same information as a three-dimensional display of (x, y) pixels. Such a three-dimensional plot is called a color space. In this section, we define three different color spaces and explore how different color spaces can be used to create and process color images.

### 20.6.1 RGB Color Space

RGB color space is a plot of pixels by their (R, G, B) value. Thus far we have considered two different RGB color spaces: the wide-open RGB color space containing image data direct from the CCD camera, and the sharply bounded RGB color space used to display color images. Converting raw image data into display able images, the tasks described in the preceding sections, is essentially that of squeezing as much data as possible from their original wide-open RGB color space into the constrained display color space.

Normal output from a 16-bit CCD camera will have pixel values running from 0 to 65,535, and in stacked images, red, green and blue pixel values can run into the millions. The highest pixel values appear in saturated star images; in most CCD cameras, saturated pixels have values at or near the highest 16-bit integer, namely 65,535.

Consider an image showing a completely blank piece of sky, so that every pixel receives the same exposure. However, instead of a graph in which all of the pixels are clustered at SR , SG , and SB , the statistical variation in the photon

SKY SKY SKY

count (Poisson noise) spreads sky points over the ranges:

where g is the CCD camera's gain in photons per ADU. Because of Poisson noise, a perfectly blank section of night sky will appear as an extended cluster of points centered on the coordinates SR , Sa , and SR

Figure 20.6 shows a plot of (R, G, B) color space for an image set containing

Astronomical Red/Green/Blue Color Space

Figure 20.6 RGB image space is virtually without bounds. Even though many pixels cluster near the sky background, star pixels can attain huge values. In sharp contrast, Standard RGB display space is a cube with values in a 0-to-255 range. To make astronomical color images, it is necessary to squeeze the vast RGB image space into a tiny cube of sRGB color display space.

### Astronomical RGB Image Space

Figure 20.6 RGB image space is virtually without bounds. Even though many pixels cluster near the sky background, star pixels can attain huge values. In sharp contrast, Standard RGB display space is a cube with values in a 0-to-255 range. To make astronomical color images, it is necessary to squeeze the vast RGB image space into a tiny cube of sRGB color display space.

stars and deep-sky objects. Stars in the image appear as lines of pixels extending along a color axis. Deep-sky objects appear as clusters of pixels with values higher than the sky value; if an object appears red, the cluster is offset along the R axis; if it appears blue, its pixels are offset along the B axis, and so forth.

The pixel values in this plot extend over a very wide range, from a sky value of 100 or 200 ADUs to star images saturated at 65,535 ADUs. In such images, it is possible to pick out the faint outer tendrils of a nebula a few ADUs brighter than sky and then trace streamers to the core of the nebula at 10,000 ADUs—the plot spans a very wide range! However, by the time these data appear on your computer screen, each color must be squeezed into a brightness range of 0 to 255.

Although RGB color space might appear ideal for image processing, in ac-

tuality it is not. Suppose an image appears too red: in RGB color space, a logical response is to reduce the red color channel. If you subtract a constant value from red pixel values, the sky becomes green, the image gets darker, and the stars remain white. If you divide the red pixel values, the sky barely changes, the stars become green, and the whole image gets darker. To reduce an overly red image without side-effects, it is usually necessary to both subtract a constant and divide the red pixel values, and also to multiply the green and blue pixel values to maintain the original image brightness.

### 20.6.2 HSL Color Space

Although we capture images in RGB color space, people think in HSL color space, that is, they think in terms of hue, saturation, and luminance. Hue is the color itself: red, orange, yellow, green, blue, violet, and the colors between. Saturation is the intensity of the color: in the case of red, from zero-saturation white, to pale pink, pink, deep pink, light red, and finally 100% saturated deep crimson red. Luminance is the amount of light received, regardless of its hue and saturation.

Geometrically, HSL color space is three dimensional, and takes the shape of a cylinder. Luminance is represented by a distance along the cylinder's axis, saturation by the radial distance from this axis, and hue by an angle around the axis— as shown in Figure 20.7. The color wheel used by artists is a slice through the HSL cylinder.

It is instructive to see how HSL color space fits into RGB color space. The luminance axis of HSL color space runs from black at (0, 0,0) in RGB color space to white at (255, 255, 255). Every point on the line from black and white corresponds to the color gray; all grays satisfy the condition that R = G = B. On the luminance axis, saturation is zero and hue is indeterminate. As you move away from the luminance axis, the R, G, and B coordinates are no longer equal; the saturation is greater than zero, and the hue angle defines a color.

For processing astronomical color images, HSL color space is extremely useful. By converting the RGB coordinates of a pixel into HSL color space, the chrominance components (hue and saturation) are split off from the luminance. Without altering the luminance, it is possible to increase or decrease color saturation. And, without altering the chrominance components, it is possible to compress a wide range of luminance into a short color range that can be displayed on a monitor or printed on a page. Furthermore, processing a luminance channel without touching the chrominance allows you to brighten, darken, smooth, sharpen, deconvolve, or wavelet-enhance images without changing the color balance or adding unwanted artifacts.

Transforming RGB to HSL. Since all color spaces describe essentially the same phenomenon, it is possible to transform from one color space to another color space. Given a pixel with red, green, and blue color channels R, G, and B, the following procedure yields hue, saturation, and luminance channels H, S, and L:

Astronomical Luminance/Hue/Saturation Color Space

Figure 20.7 Humans perceive images as luminance, hue, and saturation. Luminance measures image brightness, while chrominance—color—describes color. Hue measures color itself, while saturation measures the color's strength. Every color that exists in astronomical RGB image space can be transformed into astronomical HSL image space, and vice versa.

### Astronomical HSL Image Space

Figure 20.7 Humans perceive images as luminance, hue, and saturation. Luminance measures image brightness, while chrominance—color—describes color. Hue measures color itself, while saturation measures the color's strength. Every color that exists in astronomical RGB image space can be transformed into astronomical HSL image space, and vice versa.

R = L->60((G-£)/£>) G = L -> 120 + 60((B - R)/D) B = L -> 240 + 60{{R - G)/D)

where D is an auxiliary variable, and Min and Max are minimum and maximum operators, respectively.

Although it might appear somewhat obscure, the procedure is perfectly logical. Equations 20.46 and 20.47 find the greatest and least color channels, and Equation 20.48 finds the difference between them. Luminance is the color channel with the highest numerical value. Although it is possible to define luminance in other ways, this formulation insures that the dominant color channel will appear bright in the final image.

All three channels share the intensity found in the lowest color channel, and since all three channels share that light, the lowest value represents the white or colorless component of the (R, G, B) triad. To find the saturation (Equation 20.49), divide the non-white color component by the highest color component, or luminance. Saturation can never be less than zero (when all three channels are equal) or greater than unity (when one of the color channels is zero).

The hue is an angle between 0° and 360°. Equation 20.50 selects the dominant color channel, and interprets the ratio between the strength of the greatest color channel and middle color channel as an angle. Pure red has a hue of 0°; pure green, 120°; and pure blue, 240°. Intermediate colors are assigned intermediate angles: thus the color cyan, the color complement of red, has a hue of 180°.

When you convert RGB display color space into HSL color space, the luminance, L, will necessarily range from 0 to 255 because R, G, and B always lie within that range. Transforming RGB display space results in an HSL display space. However, although luminance is constrained to the range of RGB values, hue and saturation are not. Regardless of luminance, hue stays between 0° and 360°, and saturation stays between 0.000 and 1.000.

Transforming RGB image space into HSL produces an HSL image space with a range of luminance bounded only by the range of values found in the R, G, and B color images. To convert an HSL image space into HSL display space, it is necessary to change only the luminance component so that it spans a range of 0 to 255; the chrominance components of the image remain the same regardless of changes to the luminance.

By using RGB color space for manipulating and balancing color, and HSL color space for manipulating and scaling luminance, observers can gain access to the best of both worlds.

Luminance Swapping. HSL color space splits the luminance and chrominance components of a color image and makes them independent of one another, thereby opening many interesting possibilities. For astronomy, replacing the original luminance image with a better one is perhaps the most important application of luminance swapping. Since the human eye/brain system responds to luminance more strongly than it does to chrominance, observers seeking superior color images can make a set of RGB images and add a deep unfiltered luminance image. The signal-to-noise ratio of the luminance derived from the RGB image set tends to be rather low, but the unfiltered luminance can be exposed deep and end up with a very high signal-to-noise ratio. Once the image is in HSL color space, the original luminance is discarded and replaced with the high-quality luminance image.

Transforming HSL to RGB. After carrying out an operation such as lumi nance swapping in HSL color space, it is necessary to transform the image back to RGB color space to display it. Given a pixel with a hue, saturation, and luminance of H, S, and L, the following procedure yields red, green, and blue color channels with values R, G, and B:

Then, depending on the value of i:

= 1 ->R = b,G = L,B = a = 2->R = a, G = L,B = c = 3 -> /? = a, G = b,B = L = 4->/? = c, G = a, B = L = 5 ~^R = L,G = a,B = b where i, f a, b, and c are auxiliary variables.

Although the process is somewhat obscure, it is logical. The auxiliary variable i takes the hue and determines whether R, G, or 5 is the dominant color, and the auxiliary variable/is the fraction of the hue comprised of the second strongest color. The auxiliaries a, b, and c hold the strengths of the middle and lowest color channels based on the saturation. Finally, depending on the dominant color channel, R, G, and B receive their assigned pixel values.

This procedure underscores the separation of chrominance and luminance. The values of R, G, and B remain scaled fractions of the luminance, retaining unchanged their strict relationship to one another. It is clear that H and S control the chrominance—regardless of what happens to L.

### 20.6.3 Lab Color Space

Lab color space is a color geometry designed as a uniform color space. Geometrically, it consists of one luminance coordinate, L, and two chrominance coordinates, a and b—so Lab is not an abbreviation for laboratory, but instead a coordinate system with (L, a, b) coordinates. Geometrically, the Lab color space is similar to HSL color space, but instead of the hue angle H and the saturation radius S, a slice through Lab space reveals an (<a, b) plane perpendicular to the L axis.

Lab color space corrects a bothersome problem with HSL color space: that H and S are not uniform. When S is large, a small change in H produces a big change in the color that the eye sees, and when S is small, a large change in //produces almost no change in perceived color. Because they are tightly bound together, H and S produce a nonuniform color space, a color space in which changes in

Coordinates in Chrominance

Red Red

Red Red

Hue/Saturation Chrominance Lab (a,b) Chrominance

Figure 20.8 Chrominance values can be expressed in hue and saturation—an angle and a radius—or as two orthogonal coordinates, a and b. Changes in the hue angle and saturation radius produce erratic color changes, whereas changes in the Lab color space a and b coordinates are relatively smooth and equal.

Hue/Saturation Chrominance Lab (a,b) Chrominance

Figure 20.8 Chrominance values can be expressed in hue and saturation—an angle and a radius—or as two orthogonal coordinates, a and b. Changes in the hue angle and saturation radius produce erratic color changes, whereas changes in the Lab color space a and b coordinates are relatively smooth and equal.

the value of a coordinate and the change to the image are only loosely related.

In Lab color space, the a component represents a redness-greenness axis, and the b component represents a blueness-yellowness axis. The important characteristic of the (a, b) plane is that changes in the coordinates produce a more-or-less uniform change in chrominance. Increasing or decreasing the a coordinate, for example, changes the red/green appearance of saturated colors and unsaturated colors in much the same way.

In astronomical imaging, Lab color space is especially valuable for blending and smoothing irregular or noisy chrominance. In HSL color space, a weakly colored pixel can drain color from nearby saturated pixels, but in Lab color space, pixels with widely differing chrominance have equal influence on a color blend.

• Tip: AIP4Win selects the most appropriate color space for each job or process, and carries out its calculations in that color space. For example, AIP4Win joins colors and adjusts color balance in RGB color space, swaps luminance in HSL color space, and smoothes away sky background noise in Lab color space.

20.7 Luminance/RGB (LRGB) Color Imaging

In LRGB imaging, the observer makes a deep "white-light" image in addition to RGB filtered images. To create a color picture from these data, we combine the

RGB components to create coarse chrominance and luminance data for each pixel in the image, and then replace the original luminance component with a high-quality luminance from the white-light image.

The technique of LRGB imaging works because the human eye and brain readily perceive noise in luminance, but are relatively insensitive to noise and errors in chrominance. Broadcast television exploits this quirk of human physiology by devoting 3 MHz of bandwidth to luminance information but giving only 1 MHz to chrominance signals.

In addition to gains derived from the improved quality of the luminance image, chrominance/luminance imaging gives you the ability to adjust the image color (chrominance) and the image brightness (luminance) separately. You can carefully tweak the RGB controls for perfect color balance knowing that when you adjust the image brightness, the color balance will remain unchanged.

The transmittance of an ideal white-light filter is:

The ideal filter blocks all light outside the visible part of the spectrum. Filter leakage in the ultraviolet and infrared passbands will increase the signal, but the human eye cannot see this light. Signals that originate outside the range of visibility have the potential to distort brightness relationships in the final color picture.

Upon substituting the filter transmittances into the filter equation (Equation 20.5) and adding the sky contribution, we obtain the following signals from a celestial object:

SL = FrArTrQr + FgAgTgQg + FbAbTbQb + SZsKY . (Equ. 20.55)

Because the spectral response of most CCDs does not match that of the human eye, luminance images made using an "ideal" filter often show excess brightness in red and blue areas of the image. To match the spectral sensitivity of a human observer, the luminance filter should ideally be chosen so that the product of the filter transmittance and the telescope and CCD sensitivity is:

However, as a practical matter, few observers want to filter their luminance exposures to match the spectral sensitivity curve of the human eye because doing so results in significant loss of light.

• Tip: AIP4Win stores images internally using the HSL color space. This allows users to apply the same suite of processing tools to color images that they can to monochrome images. When appropriate, however, AIP4Win converts images to RGB or Lab color space for processing, and then returns them to HSL color space.

### 20.7.1 Creating an Artificial Luminance Image

An alternative to making a luminance image at the telescope is to combine a set of filtered RGB images to create a luminance image. Combining the filtered images produces a luminance image with a higher signal-to-noise ratio than any of the individual filtered ones, resulting in a better color picture.

As we saw above, when RGB color is transformed into HSL, luminance is the maximum value in a color-balanced (R, G, B) triad. This guarantees that any strongly colored object is assigned a high luminance value. However, the human retina responds less strongly to red and blue than it does to green. Strictly speaking, the (.R, G, B) triad should be weighted so that:

From an aesthetic point of view, weighting the red and blue contributions to luminance in this way makes ruddy HII regions appear too dim and blue reflection nebulae fade into the sky background. To improve the situation somewhat, the {R, G, B) triad can be given equal weighting:

As a practical matter, however, most observers want the highest signal-to-noise and color penetration they can get. Those who are willing to sacrifice strict color accuracy will therefore prefer the maximum of a color-balanced (R, G, B) triad as luminance.

### 20.7.2 Enhancing the Luminance Image

In HSL color space, the luminance image can be enhanced by sharpening, decon-volution, nonlinear brightness scaling, digital development, or any combination of techniques without altering the color balance of the color picture. Although enhancements have the potential to give the resulting color image an artificial appearance, they can also be used to improve the aesthetics of it, or to reveal features that might otherwise be difficult or impossible to see.

### 20.7.3 Creating LRGB Images

Prior to generating an LRGB color image, you must have a set of RGB images and a luminance image. To correct for atmospheric extinction and filter variations, it is best to have determined G2V standard star weight factors (see Equations 20.24 through 20.26) for your CCD and filter set.

Begin with these quantities for the RGB images:

• SR ,SG , and 5« , the pixel value of the residual sky back-

ground in each image. Measure this in a star-free region.

• WR, WG, WB, the weight factor determined from a G2V star.

Begin with these quantities for the luminance image:

• *Sz,SKY > the pixel value of the sky background,

• ¿>lmax , the pixel value of the brightest significant feature in the image. Although subjective, it can be estimated as a histogram endpoint, typically between 0.99 and 0.9995.

Creation of the color image begins by computing, for each pixel in the RGB image, a set of coordinates in RGB color space:

Was this article helpful?

0 0

## Telescopes Mastery

Through this ebook, you are going to learn what you will need to know all about the telescopes that can provide a fun and rewarding hobby for you and your family!

Get My Free Ebook