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.
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.
Connected-component labeling assigns an identifying number to each separate connected region of an image after choosing which pixels belong to the foreground and which neighboring pixels count as connected. In a binary image, interpret each foreground pixel as a vertex of a graph, with an edge for each allowed neighboring pair. Each component receives one label; background pixels receive a separate background value. The choice of pixel connectivity is part of the problem definition, not an incidental display setting.
For example, consider the binary image
If a foreground pixel connects only to foreground pixels immediately above, below, left or right, the two ones form two regions. One valid label image is . If diagonal neighbors also connect, the same input has one region, with label image . SciPy's ndimage.label treats zero as background and nonzero entries as foreground; its default two-dimensional neighborhood uses the four axial neighbors. Its neighborhood mask must be symmetric about its centre so that a connection works in both directions.[ref]
One direct algorithm scans for an unlabelled foreground pixel, starts a flood fill there and assigns a fresh label to every reachable foreground pixel. It then resumes scanning for another unlabelled region. For a fixed-size neighborhood, every pixel and a bounded number of neighbors need be inspected, giving time complexity for image pixels, with storage for labels and the pending search. Another approach records provisional labels and merges equivalent ones using a disjoint-set data structure.
The numerical labels are identifiers: swapping labels and does not change the segmentation. A single printed character can have several disconnected regions, while touching characters can share one region. Connected-component labeling therefore supplies geometric grouping for image segmentation and optical character recognition; it does not itself determine what an object means.
Foreground-background polarity specifies which of two image classes is treated as the selected structure and which as its background. It involves a numerical convention as well as the intended interpretation: high-valued pixels can represent foreground in one encoding, while a dark feature may require the opposite threshold direction. A binary image's appearance alone does not establish its polarity.
For a chosen intensity threshold , define complementary normalized masks
The second is the complement of a set within the declared pixel grid. For the stipulated row and , the two binary selection masks are and . Equality belongs to the second selection. OpenCV's THRESH_BINARY and THRESH_BINARY_INV use these respective comparison directions, with the chosen output maximum replacing 1.[ref]
An image lookup table is a separate mapping from stored values to displayed colors. ImageJ's Create Mask command writes 255 inside a selection and 0 outside, but its default inverting lookup table can display the selected 255-valued pixels as black.[ref] Reversing that display mapping does not exchange the stored pixel values.
The distinction has a direct computational consequence. In its binary-image input, the documented Sholl analysis implementation treats zero intensities as background regardless of the lookup table or Black Background option.[ref] A visually inverted display can therefore leave the selected numerical structure unchanged, whereas replacing an 8-bit mask by exchanges its zero and 255 classes.
A reproducible geometric measurement records the threshold comparison, the values assigned to selected and excluded pixels, and any display-only inversion. A region of interest can further restrict the grid over which a complement is intended; reversing a mask over the whole image is different from selecting its complement only inside that region.
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.
Pixel connectivity 2026-11-05
Pixel connectivity specifies which neighboring pixels may be joined directly when forming paths through an image. A region is connected when its pixels can be reached through such allowed steps while remaining in the region. This makes the region a component of an implicitly defined graph.
For a two-dimensional square grid and pixel position , four-neighbor connectivity uses
restricted to positions inside the image. Eight-neighbor connectivity adds the four diagonals:
Thus four-neighbor steps cross an edge between pixel cells, while eight-neighbor steps can also pass through a corner.
The diagonal binary image
has three foreground regions under four-neighbor connectivity and one under eight-neighbor connectivity. SciPy's default two-dimensional connected-component labeling uses the four axial neighbors; a full three-by-three neighborhood also connects diagonals. Its neighborhood must encode connections in both directions.[ref]
Connectivity also affects how a boundary separates foreground from background. In a two-by-two checkerboard, allowing diagonal links for both values makes each value connected across its own diagonal. A convention that treats foreground and background differently can avoid interpreting both diagonal paths as uninterrupted planar crossings. The chosen convention should therefore accompany any claim about separate objects or enclosed regions.
A flood fill and connected-component labeling can give different answers on the same stored array solely because their pixel connectivity differs. Check the neighborhood before interpreting that disagreement as a bug or a physical change in the imaged object.
Sholl analysis 2026-11-05
Sholl analysis summarizes the radial arrangement of a traced structure by counting its intersections with concentric Euclidean circles around a chosen center. The resulting Sholl profile reports how the count changes with radius. A computational workflow must specify the center, spatial calibration, sampled radii and the convention used to identify distinct intersections. The software documentation distinguishes analysis of segmented images from analysis of reconstructed tracings.[ref]
For an original center-choice example, take the straight segment . With center , a circle of radius meets the segment once for . With center , it meets the same segment twice for and not at all for . At , therefore, the two center choices give counts 1 and 2, although the traced object has not changed. The center is part of the measurement definition.
For binary images, the foreground also needs an explicit meaning. The SNT documentation treats zero-valued pixels as background independently of the displayed lookup table and illustrates how an inverted segmentation can make the program sample background instead of structure.[ref] Record the foreground-background polarity and radial sampling interval with the result.
The radial summary is useful for comparing where intersections occur, but a Sholl profile does not determine rooted tree topology. A fitted curve, sampled count sequence and complete ideal Sholl profile are different data objects; none should be silently substituted for another.
Sholl profile 2026-11-05
A Sholl profile records intersection counts as a function of distance from a chosen center. For a thin geometric tracing it is an exact counting function; a profile obtained from sampled images also depends on the software's sampling and segmentation conventions.
In an ideal planar model, let be a finite embedded rooted tree of line segments in the Euclidean plane with chosen root . Its Sholl profile counts distinct intersections:
This is a geometric model for thin tracings; the software documentation separately addresses sampling binary images and handling image segmentation.[ref]
For an original simple example, take three straight radial segments from the origin, pointing in different directions, with lengths 1, 2 and 4. For radii , the counts are respectively . The segment of length 1 contributes at but not beyond it; record the boundary convention when defining the count. No branch points are needed for this decreasing profile: different lengths of terminal segments already produce it.
The profile retains radial occupancy but discards the angles and the identities of the intersected paths. In particular, a Sholl profile does not determine rooted tree topology. Sampling only a finite list of radii loses still more information; it should not be silently equated with knowledge of the complete continuous-radius counting function.
Tiago A. Ferreira 2026-11-05
Tiago Ferreira is identified as Tiago A. Ferreira by his ImageJ project profile, which connects him to the ImageJ User Guide by Tiago Ferreira and Wayne Rasband, SNT and Sholl analysis. The guide's 2012 title page names Ferreira and Wayne Rasband as coauthors. His work combines scientific-software documentation with tools for analyzing spatial structure.[ref][ref]
Sholl analysis turns a calibrated tracing or segmented binary image into a Sholl profile. The fact that a Sholl profile does not determine rooted tree topology explains why that summary cannot reconstruct connectivity. Input selection remains a separate issue: the documentation's foreground/background comparison shows that inversion can make the analysis sample the background. Record image segmentation, calibration and sampled radii with the result.[ref]
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.