Overview of Masks and Image Statistics

Mathematical operations used with images include logic (conditional) operations and statistics. Logic operations are used to make masks to apply threshold levels to clip the pixel values of an image, and to locate pixel values. These operations help to segment features in an image, after which statistics can be derived to provide a means of comparison.

Masks are used to isolate specific features. A mask is a binary image, made by using relational operators. A binary mask is multiplied by the original image to omit specific areas. For more information, see Masking Images.

Threshold levels can be applied to an image to clip the pixel values to a floor or a ceiling. Clipping enhances specific features, and is applied through minimum and maximum operators. After the resulting images are byte-scaled, the specific features remain while the other areas become part of the background. For more information, see Clipping Images.

Locating pixel values is another way to segment specific features. Mathematical expressions are used to determine the location of pixels with particular values within the two-dimensional array representing the image. For more information, see Locating Pixel Values in an Image.

When specific features have been segmented, image statistics (such as total, mean, standard deviation, and variance) can be derived to quantify and compare them. For more information, see Calculating Image Statistics.

Note
In this book, Direct Graphics examples are provided by default. Object Graphics examples are provided in cases where significantly different methods are required.

The following list introduces image math operations and associated IDL math operators and routines covered in this chapter.

Table 4-1: Image Math Tasks and Related Image Math Operators and Routines 

Task
Operator(s) and Routine(s)
Description

Masking Images.

Relational Operators

Mathematical Operators

Make masks and apply them to images.

Clipping Images.

Minimum and Maximum Operators

Mathematical Operators

Clip the pixel values of an image to highlight specific features.

Locating Pixel Values in an Image.

WHERE

Mathematical Operators

Locate specific pixel values within an image.

Calculating Image Statistics

Mathematical Operators

IMAGE_STATISTICS

Calculate the sum, mean, standard deviation, and variance of the pixel values within an image.

Note
This chapter uses data files from the IDL examples/data and examples/demo/demodata directories. Two files, data.txt and index.txt, contain descriptions of the files, including array sizes.