## Image Feature Analysis

The human eye and brain perceive "objects" and "features" in images—stars, nebulae, and galaxies—but the computer sees nothing but numbers. Nonetheless, the computer is a valuable aide and ally in the analysis of those clusters of pixels that make up what we humans see. To enlist the computer's help, however, we must define an area—a region of interest—that is large enough to contain the feature or object, yet small enough that the statistical differences that it causes make the region distinctively different.

### 7.4.1 Pixel Statistics

The pixel statistics of small regions of interest are the raw material of feature analysis, from the analysis of the noise in the CCD to the measurement of stellar magnitudes. The first step in analyzing a group of pixels is to define the location of the region of interest; the second is to perform the mathematical procedures; and the third is to interpret the statistical results.

Of these steps, interpretation is the most difficult. You can use pixel statistics

• to explore the performance of the CCD itself,

• to derive positions of image features or their brightness, or

• to color-balance a set of color separation images.

The following section, however, deals only with the first two: fundamental pixel-level selection of a region, and the computation of its statistical properties.

### 7.4.1.1 Defining a Region of Interest

"Region of interest" is a fancy term for a collection of pixels with properties that you want to measure. Membership in the collection must be determined by some kind of rule, such as nearness to a feature that you want to know more about. Regions of interest are usually defined as including pixels in a circle or square that includes the feature, or a ring that surrounds the feature of interest. Once the pixels in the region of interest have been selected, the program can determine useful things like the average value of the pixels that comprise it.

By definition, a circular region of interest includes all pixels at a distance less than or equal to the specified radius, R, from a central point, (x0, y0). Any pixel (x, y) that satisfies the condition belongs to the region of interest; any that lies outside it is ignored.

When the radius is small, this definition generates blocky circles. A circular region of interest with a radius of 1 contains 5 pixels; with a radius of 2, it contains

13; and with a radius of 3, 29 pixels—assuming that (x0, y0) are integer values. As the radius becomes larger, the region better approximates a circle.

An annular, or ring-shaped region of interest, includes all pixels that satisfy a double criterion of lying inside an outer radius R and outside an inner radius r.

When the radii are small or close in value, the ring they define is quite blocky; but as the radii grow, the borders of annular regions become fairly smooth. Such regions are especially valuable for estimating the statistical properties of the background sky pixels near an interesting object or feature, by sampling those that surround it.

A square region of interest includes all pixels that lie within a specified distance (called the "radius" even for non-circular regions) in the x and y axes:

A square region of interest with a radius of R pixels is a box 2R + 1 pixels on a side containing 4R2 + 4R + 1 pixels. A region of interest with a radius of 1 pixel is 3 by 3 pixels and contains 9 total; a region with a radius of 10 pixels is 21 on a side and contains a total of 441 pixels.

Like the annulus, a hollow square region of interest contains pixels inside an outer radius, R, and outside an inner radius, r.

Because pixel space is quantized, for square regions of interest, R and r can only hold integer values.

• Tip: AIP4Win includes a Pixel Tool for measuring the statistical properties of square, circular; and annular regions of interest. You can select the shape, and set both inside and outside radii. When the inside radius is zero, all pixels inside the outer radius are included in the statistics.

### 7.4.1.2 Minimum Pixel Value

The minimum pixel value serves as a diagnostic for abnormal noise or unusual conditions that might be present in a region of interest, interpreted within the context of the other pixel statistics. For example, if it is far below a value that you might reasonably expect, the situation warrants checking.

Consider this example: you select a region containing a few moderately bright stars. The median pixel value is 1000, which probably represents the pixel value of the background sky, and the maximum pixel value is 3144, presumably the brightest pixel in one of the star images—but the minimum pixel value is zero!

A reasonable minimum would be somewhat less than the median, such as 850. The zero suggests there is a problem. Check for rare events—such as a cosmic ray in the dark frame—that might have caused the abnormally low minimum value.

### 7.4.1.3 Maximum Pixel Value

This parameter is another useful diagnostic. It can tell you the highest pixel value found in a star image, check for pixels with abnormally high thermal noise (i.e., "hot" ones), and verify that all of the pixels in a star image are within the linear range of the CCD.

The range of the maximum and minimum pixel values is an indicator of the dispersion of pixel value from the norm—but it's a poor indicator because it takes only one abnormally low or high pixel value to substantially expand the range.

7.4.1.4 Mean Pixel Value

This measure is the sum of the pixel values divided by the number of pixels in the region of interest:

nL-j i = l where P is the arithmetic mean of n pixels in the given region.

Because the mean value includes every pixel in the region of interest and can therefore be skewed by a small number of abnormally low- or high-value pixels, the mean is a risky way to determine the pixel value of a sky background.

7.4.1.5 Variance

The variance, a , is a measure of the dispersion of a set of measurements from the mean value of the measurements:

n— 1 ¿-j i = i where P is the mean value and Pi is the ith pixel in a region of interest containing n pixels. The square root of the variance is the standard deviation. The most immediate application for the variance in CCD imaging is to characterize the CCD's readout noise and conversion factor (i.e., electrons per ADU) from test images.

### 7.4.1.6 Standard Deviation

The standard deviation, a , is the square root of the variance. Given a collection of pixel values, P]9 P2, ..., Pn, in a region of interest, the standard deviation is computed from: Figure 7.3 Regions of interest can be square, rectangular, circular, elliptical, or as shown above, annular. Pixels in the region of interest lie at or inside the outer radius, R, but outside the inner radius, r. The annular region of interest is useful for determining the sky brightness in CCD stellar photometry.

where P is the mean value and Pt is the ith pixel in a region of interest containing n pixels.

In a set of random numbers, 68% of them should lie between P-c and P + 0. The standard deviation is the characteristic width of a Poisson or Gaussian distribution; thus in a random sample, the standard deviation is a direct measure of what we loosely call "noise."

### 7.4.1.7 Signal-to-Noise Ratio

To estimate the signal-to-noise ratio (SNR) for a small, uniform part of an image, measure the mean and the standard deviation for that region. If the mean pixel value is 600 and the measured standard deviation is 20, the SNR is 600/20 = 30. Because the SNR depends on the amount of light striking a CCD, you cannot define a meaningful SNR for an image, but only for a specific pixel value, such as the brightness of the sky background, found in the image.

Consider an example in which the sky background is 600 ADU and the SNR is 30. The sky brightness varies randomly with a a of 20 ADU. In this image, it would be difficult to detect a star less than 20 ADU brighter than the mean sky value.

The strength of a signal such as a star image is sometimes rated in terms of how many "sigmas" it departs from the background. Continuing the example above, if a weak star image has a pixel value of 660 ADU—60 more than the mean sky—then it is said to be a "three-sigma" object. The greater the departure from the mean, the higher the probability that the object is real—and not just a random cluster of high pixels. The more pixels the star image contains, the more certain the detection becomes; because the probability that multiple three-sigma events would occur side by side is very low.

### 7.4.1.8 Median Pixel Value

The median is the middle value in a sorted set of values. In a region of interest, an equal number of pixels has values greater than the median and less than the median. In the sequence: 5, 5, 5, 5, 7, 8, 11, 13, 99, the median value is 7—as there are four lower values and four higher values. The mean value is 17.5. The median rejects extreme values that the mean does include. In astronomical images, the median is a powerful tool for estimating the value of the sky background without including light from faint stars that raise the mean value.

### 7.4.1.9 Mean of Median Half

The "mean of the median half' is a hybrid statistic designed to use information from as many pixels in the region of interest as possible while still excluding the most extreme values. The mean of the median half is the mean of the middle half of a set of sorted pixel values. In the sequence: 5, 5, 5,5,7,8,11, 13, 99, the mean of the median half is 7.2. The bottom quartile and top quartile were rejected in forming this value.

The mean of the median half is useful in astronomy for measuring the sky background pixel value that rejects faint background stars, and at the same time generates a background sky value that avoids being pigeon-holed to the nearest integer value of a pixel in the region of interest. 