Histograms brightness and contrast 1341 Histograms

Photography Jobs Online

Learn Digital Photography Now

Get Instant Access

A histogram is a chart showing how many of the pixels are at each brightness level. You've already seen histograms on pp. 36 and 149; Figure 13.4 shows another. The histogram of a daytime picture is normally a hump filling the whole brightness range; astronomical images often leave much of the mid-gray range unused.

13.4.2 Histogram equalization

A common task is to equalize the histogram, i.e., spread out the pixel values so that more of the range is used. This can be done with the Levels adjustment in Photoshop (which looks like Figure 13.4) or the corresponding adjustment in MaxDSLR or other software.

1 A. S. Fruchter and R. N. Hook (2002). Drizzle: a method for the linear reconstruction of undersampled images. Publications of the Astronomical Society of the Pacific 114: 144-152.

Under the histogram are three sliders. Do the following:

• If the whole brightness range is not used, move the left and right sliders in so that they just span the range of the histogram that is non-zero.

• If you want to treat the stars as overexposed, move the right slider farther leftward, toward the middle of the range.

• Move the middle slider toward the most heavily populated part of the histogram.

This should generally be done in several small steps, and if you are working with 8-bit pixels, you should convert the image to 16-bit before equalizing it, even if you're going to convert it back to 8 bits for output.

13.4.3 Curve shape

The characteristic curve of any imaging system is the relationship between input brightness and output brightness. Perfectly faithful reproduction is a straight line (after gamma correction and the effect of the screen or printer).

Almost all image processing software lets you adjust curves. For one example, see p. 158, and for a whole gallery of curve adjustments with their effects, see Astrophotography for the Amateur (1999), pp. 226-228.

Left to themselves, when producing JPEG images for output, most digital cameras reduce the contrast of the shadows; that is, they darken the shadows, both to reduce noise and because this is generally considered a pleasing photographic effect. Canon DSLRs, but not Nikons, also compress the highlights so that most of the contrast is in the midtones. You can bypass these effects by working from camera raw images.

13.4.4 Gamma correction

When your camera saves a picture as JPEG, or when you decode a raw image file with ordinary (non-astronomical) software, the image undergoes gamma correction, which is needed because pixel values do not mean the same thing in a raw image that they do on a computer screen or printer.

In the raw image, the pixel values are proportional to the number of photons that reached the sensor. But the brightness of a computer screen follows a power law that approximates the eye's logarithmic response to light. Specifically:

Pixel value

Maximum pixel value where y ^ 2.2.

Here y (gamma) is a measure of the nonlinearity of the response. Printers, in turn, mimic the response of the screen. Some printers and Macintosh displays are calibrated for y ^ 1.8 instead of 2.2.

Figure 13.5 shows how this works. A pixel that displays on the screen at 50% of full brightness will have a pixel value, not 50%, but about 73% of the

100%

Screen brightness

(black)

Pixel value

100%

(white)

Figure 13.5. Gamma (y) measures the nonlinear relation between pixel values and brightness. Upper curves show the correction applied to compensate for screen response.

maximum value because 0.51/2'2 = 0.73. For example, if the pixel values are 0 to 255, a half-brightness pixel will have a value of 186. Monitor calibration test patterns test the gamma of your display by having you compare a patch of pixels at level 186 to a patch of alternating rows of 0 and 255 which blend together as you view the screen from far away.

That's why images taken straight from DSLR raw files generally have the midtones too dark. The upper curves in Figure 13.5 show how this is corrected. The simplest correction is a gamma stretch, defined as follows:

For example, if the input and output pixel values both range from 0 to 255, and y = 2.2, then a pixel whose value was originally 127 (midway up the scale) will become

255 x (127/255)1/Z2 = 255 x (127/255)0 45 = 255 x 0.73 = 186.

If y = 1, this becomes the equation for a linear stretch.

The official correction curve for the sRGB color space is slightly different from a pure gamma stretch. As Figure 13.5 shows, it has slightly less contrast in the shadows (to keep from amplifying noise) and makes up for it in the midtones. Since astronomical images do not strive for portrait-like realism in the first place, there is no need to follow a specific method of gamma correction; just raise the midtones until the image looks right.

Output pixel value = Max. output pixel value x

Was this article helpful?

0 0
Digital Camera and Digital Photography

Digital Camera and Digital Photography

Compared to film cameras, digital cameras are easy to use, fun and extremely versatile. Every day there’s more features being designed. Whether you have the cheapest model or a high end model, digital cameras can do an endless number of things. Let’s look at how to get the most out of your digital camera.

Get My Free Ebook


Post a comment