Adaptive thresholding 2026-11-05
Adaptive thresholding uses an image threshold that varies with position, often calculated from a neighborhood around each pixel. It can help separate marks from background when illumination changes across an image. A global image thresholding rule instead uses the same threshold everywhere.[ref]
For a simple real-arithmetic local-mean model, put
where is the neighborhood mean and a fixed offset. OpenCV documents local-mean and Gaussian-weighted alternatives, with a declared neighborhood size. Its binary comparison assigns the high output value only above the threshold.[ref]
Consider a three-by-three patch with eight values of and a central value of . For ,
so the centre receives binary value zero. Adding to every intensity gives eight values of and a centre of . Now , so the centre still receives zero. A fixed threshold of would classify the two centre values differently, despite their identical contrast with their local backgrounds.
The invariance follows algebraically. If every intensity in a neighborhood increases by the same , its mean and threshold also increase by . Hence exactly when . This proves an additive-shift property of the stated model, assuming no clipping or rounding; it is not a claim about arbitrary spatial gradients or multiplicative brightness changes.
Neighborhood size and offset affect the result. A very small neighborhood can follow noise or include too little background, while a large one can span changing illumination. Integer rounding and image-edge handling must also be specified for an exact implementation comparison. The resulting binary image remains an intensity-based selection; connected-component labeling and semantic interpretation are further steps.
Area from a calibrated pixel count assigns an area to a selected collection of complete image pixels. For selected pixels of calibrated widths and ,
This rectangular-cell model permits unequal horizontal and vertical spacing. In ImageJ, area is reported in square pixels or calibrated square units according to the spatial calibration and measurement settings.[ref]
For an original threshold example, let four stored gray values be 40, 90, 130, 200. A rule selecting values at least 128 retains two pixels. If ,
At and , the same pixel selection instead represents . Pixel count alone is not an area in physical units.
For a binary selection mask , the count is . A fractional-coverage model would instead use fractions and ; the two rules need not agree at boundaries. A region of interest and an image thresholding rule also select pixels for different reasons. State the selection and calibration before interpreting the result as an estimate of a specimen's geometric area. The numbers above are stipulated image data, not a physical specimen measurement.
Binary image 2026-11-05
A binary image assigns one of two values to every pixel, commonly and or false and true. It can represent a selected region, such as marks separated from a page background, without retaining all the original brightness values. The two values express a chosen classification of pixels, not necessarily two physical colors in the original scene.
For example, define image thresholding by selecting intensities at least :
The output preserves which side of the threshold each value occupied but loses the distinction between and . Changing the threshold changes the selected region, so interpreting the result requires the selection rule as well as the image.
A binary image is useful as input to connected-component labeling. There, pixel connectivity determines whether diagonally touching selected pixels belong to the same region. SciPy's labeling operation accepts zero as background and all nonzero values as foreground; an input with several nonzero intensities is consequently treated as a foreground mask by that particular API.[ref]
Two possibilities require one bit of information per pixel in a direct packed representation. An actual array or image file can use more storage, or compression can exploit repeated patterns. Also distinguish a binary image from a label image containing several region identifiers: a label value of three need not mean brighter foreground than a label value of one.
Binary selection mask 2026-11-05
A binary selection mask records which pixels belong to a chosen subset of an image. On a finite pixel grid , it is the indicator function
It can represent an area region of interest, the result of image thresholding or a combination of selection rules. The mask describes membership; its entries need not equal the underlying image intensities.
For a selected pixel count , the count and selected arithmetic mean are
Consider the original arrays
The selected values are 0, 20 and 40, so and . The selected zero-valued pixel still contributes to the denominator. Replacing excluded pixels by zeros and averaging all six entries would instead give : that asks a different question. An empty mask has , so this selected-mean formula is undefined.
For rectangular pixels with calibrated dimensions and , the complete-pixel area from a calibrated pixel count is . These are stipulated array values and cell dimensions, not a measurement of an object.
A stored mask can use another two-value encoding. ImageJ's Create Mask command stores 255 inside an area selection and 0 outside, corresponding to in this model.[ref] Summing gives 765 in the example, rather than the selected count 3. Convert the encoding or count selected entries before interpreting a sum as an area.
Two normalized masks and combine by set intersection through . Their complement within the specified grid is . Record the foreground-background polarity, coordinate alignment and grid extent when transferring a mask between images.
A gear pitting inspection mask specifies the tooth-flank region over which damage is counted. It separates eligibility for inspection from the classification of an eligible location as pitted. The denominator of a gear pitting area fraction depends on this mask, so a change in coverage can change the reported fraction even when the surface has not changed.
For a digital image, let indicate inclusion of pixel and let indicate its classification as pitted. With represented surface area per pixel,
The arrays and are different indicator functions. Uniform pixel areas cancel, but an oblique view or a curved-surface map can require nonuniform . A shadow, occlusion or unrecorded region should not automatically count as intact material.
An original example begins with 200 pitted pixels among 10000 eligible equal-area pixels, giving . Cropping to a 5000-pixel region that retains 150 pitted pixels gives . The counted damaged area fell while the fraction rose; this comparison alone cannot establish damage growth.
A gear inspection common-region comparison first uses image registration to put inspections into corresponding surface coordinates. On a common grid, the intersection mask is . Comparing the two pitting classifications within that same region holds the denominator convention fixed. Coverage outside the intersection should still be reported: excluding a newly obscured damaged edge can hide relevant change.
Useful inspection records retain the raw image, mask, geometric mapping, image thresholding or other image segmentation rule, and the reason for excluded regions. A primary NASA gear-endurance study combined inspection history with vibration and oil-debris observations, illustrating why damage labels must remain connected to actual inspected surfaces.[ref] The mask formalism above is an explicit measurement convention, not a claim that every historical inspection used this pixel algorithm.
ImageJ 2026-11-05
ImageJ is a Java program for viewing, processing and measuring image data. Its official feature description includes image stacks, selections, calibrated measurements, image thresholding, plugins and recorded macros.[ref] Wayne Rasband and Tiago Ferreira's user guide documents how acquisition metadata and analysis settings affect those measurements.[ref]
For an original numerical measurement example, suppose a selected image region of interest contains gray values 10, 20, 30, 40. Set square pixel pitch to . The selection has four pixels, so its calibrated area and mean image signal are
Changing only the spatial calibration to per pixel changes the reported area to while the mean remains 25. Spatial calibration changes the coordinate interpretation, not the stored gray values. An image thresholding rule retaining values at least 25 selects two pixels, whose total calibrated area under the original scale is .
A reproducible analysis records the original image, selection, spatial calibration, threshold rule and measurement settings. The guide separates spatial Set Scale from intensity Calibrate, and warns that global calibration can affect other open images.[ref] The arithmetic above is stipulated test data, not a screenshot measurement or a result from an unspecified plugin.
Image lookup table 2026-11-05
An image lookup table maps a stored pixel value or index to a displayed color. For an 8-bit grayscale image with stored values , a table can be written
using an RGB color model triple. Changing changes the appearance without necessarily changing . ImageJ explicitly distinguishes Invert LUT, which changes the display, from inversion of the pixel values.[ref]
For an original example, store the row
The identity grayscale table is ; an inverted table is . The same four stored values appear in opposite brightness order under these tables, but their arithmetic mean remains . An image thresholding rule selecting stored values above 100 still gives the binary selection mask .
Numerically replacing the pixels by instead produces . Its arithmetic mean is , and the same strict threshold gives . Thus an inverted-looking image does not by itself establish that its numerical values or selected subset were inverted.
The distinction is especially visible with binary selection masks: the documented Create Mask command stores 255 inside the selection and 0 outside, while an inverting lookup table can display the selected class as black.[ref] Record the foreground-background polarity from the stored encoding and algorithm, rather than inferring it from screen brightness.
A program can also apply a lookup mapping to the data. ImageJ's Apply LUT command changes gray values and restores the identity table so that the displayed appearance is retained.[ref] Distinguish that operation from assigning a display table. A table mapping several input values to the same color can conceal numerical distinctions in the display even while those distinctions remain in the original stored image.
Image thresholding 2026-11-05
Image thresholding classifies pixels by comparing their intensities with a threshold, often producing a binary image. A global threshold uses the same value throughout the image; adaptive thresholding permits the threshold to depend on position and nearby intensities.[ref]
For example, define
Intensities then become . The comparison at equality matters: a rule using would instead give . OpenCV's THRESH_BINARY uses the strict greater-than rule, assigning its chosen maximum output value only above the threshold.[ref]
Threshold choice affects which distinctions survive. Two different bright intensities can become the same foreground value, while a small change near the boundary can change a pixel's classification. The resulting mask can then feed connected-component labeling, where pixel connectivity separately decides which selected pixels form a region.
A useful motivating experiment keeps one image of dark marks fixed while adding or recording a gradual illumination variation across the background. Compare a global threshold with a declared local-neighborhood rule, inspecting lost strokes and falsely selected background. OpenCV documents local mean and Gaussian-weighted rules with an offset; this addresses varying illumination rather than proving that every resulting region is a meaningful object.[ref]
A histogram can guide global selection, but intensity statistics alone do not determine semantic identity. Noise and overlapping foreground/background intensities can make every threshold imperfect. Report the input representation, comparison convention and any filtering or local-window settings so that a thresholded result can be reproduced.
Wayne Rasband 2026-11-05
Wayne Rasband developed NIH Image and ImageJ, tools that make quantitative image processing available through an interactive program and extensible code. The ImageJ project's biography records forty years at the US National Institutes of Health and retirement in 2010. It dates the start of NIH Image to 1987 and ImageJ to 1997, when Rasband explored implementing the earlier program in Java.[ref]
This progression mattered because the same recorded digital image could become input to many explicit measurements. Selecting a region of interest, applying image thresholding and measuring an area are separate operations; each makes a choice that affects the result. ImageJ User Guide by Tiago Ferreira and Wayne Rasband records the program's image representations, selections, analysis commands and scripting facilities.[ref]
For a small original measurement example, take four stored grayscale values
Select values at least 128, obtaining the binary image . If each complete pixel represents a rectangle of calibrated width and height , the area from a calibrated pixel count is
The chosen threshold determines which pixels contribute; the pixel pitch determines the physical area assigned to each. An attractive display alone supplies neither of these measurement choices. The calculation assumes complete selected pixel cells and a uniform rectangular calibration; it is not a measured specimen area.
Rasband's contribution also includes maintaining a community around the software: the project profile describes improvements supplied through user feedback, bug reports, code and documentation. That process connects a general algorithm to the concrete representations and measurement conventions needed for a repeatable analysis.[ref]
Figure 1.
Wayne Rasband, from his labeled ImageJ project profile
. Source.