## Direct Specification of the Transfer Function

The most obvious approach to transfer functions is to specify mathematical operations that should be applied to the input values to produce the desired output values. For example, the transfer function f(p) could be specified as:

In this case, the transfer function replaces each pixel with a new pixel having two times the original pixel value. To carry out this operation, the software creates a look-up table using the function to compute f(p):

253 506

254 508

### 255 510

To use the look-up table, the program looks at each pixel in the image and reads its value, p. The program then finds the pth element in the table, and places that new pixel value from the table into the image. Except with very small images, it is faster to look up a precomputed value in a table than it is to compute new pixel values each time.

Identity transfer function. As the name implies, the identity function returns the value identical to the value entered; i.e.,/(/?) = p. Although it is a "trivial" case, the identify function is a legitimate member of the class of "image math" transfer functions.

Add transfer function. This simple function returns the value entered plus a constant; i.e.,/(p) = p + c. It can be used to add a constant (negative or positive) to the pixel values in an image. However, to implement even this simple function, the look-up table must be constructed so that all possible new pixel values lie within the range of acceptable values, according to the rule:

P + C<Pmin-*f(P) =Pmin Pm\n<P + c<pmax^f(p)=p + C ■ (Equ. 13.15)

Thus, an operation as simple as adding a constant requires range checking. An advantage of using the look-up table is that range checking need be carried out only once during its construction, rather than for every pixel in the image if the additions were done directly.

The minimum pixel value is normally zero, and the maximum pixel value is normally 255,4095, or 65535, depending on whether the images contain 8-bit, 12bit, or 16-bit data.

Multiply transfer function. Multiplication by a constant is another elementary transfer function, f(p) = kp, that must be range-checked so that the output values in the look-up table lie between the minimum and maximum allowable ones. The constant k can have any value, and may be used to perform division by making k the reciprocal of the divisor.

Plus-times-plus transfer function. A sequence of adding a constant, multi plying, and adding another constant is a very handy transfer function because it enables the user to remove a known offset from an image, scale the corrected pixel values, and then restore the offset. The function is:f(p) = k(p + Cj) + c2.

This sequence is particularly useful for tasks such as scaling a dark frame to match an image made with a different integration time. Dark frames from CCD cameras often have a fixed bias value, such as 100. To match a 300-second dark frame to a 60-second image frame, the bias would be subtracted (cx = -100), the pixel values in the dark frame divided by 5 (k = 0.200), and the bias added back (c2 =100). This scaled dark frame could then be subtracted from the image.

This function and others like it could obviously be carried out as three sequential operations, but the need for the add-times-add sequence arises so often that it is convenient to have it available as a single operation.

Brightness-contrast function. Most general-purpose image-processing programs provide slider bars for adjusting image brightness and contrast. Brightness-contrast inputs are usually implemented as a linear transfer function in the form:

where k is the value of the contrast and c is the brightness. When these inputs are made by a slider bar, the initial value for k is 1 and the initial value for c is 0; but the numbers on the slider bar usually range from 0 to 100 and have no clear relation to the values of k and c that the slider generates.

Other transfer functions. Direct specification of transfer functions such as square, square root, exponential, logarithm, sine, cosine, and so forth are sometimes found in image processing software written for chemistry or physics applications, where input pixel values can be converted into meaningful physical quantities. However, in astronomy it is generally more efficient to specify a transfer function in terms of a particular image. These techniques are covered in the sections that follow. 