Image processing transforms recorded image signal data to remove noise, recover detail or extract structure. Variational image processing describes desired reconstructions through energies, while diffusion image processing describes filtering through evolution equations.
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.
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.
The radial sampling interval is the separation between consecutive radii at which a radial measurement is made. For Sholl analysis, it determines the spacing of concentric Euclidean circles used to sample intersection counts about a fixed center. The documentation distinguishes this step from the starting and ending radii.[ref]
For constant positive spacing, the sampling grid is
where is the chosen upper radius. For , and , the sampled radii are 1, 2, 3 and 4. The upper bound 4.4 is not itself sampled. The software documentation explicitly notes this endpoint issue when the step does not divide the difference between ending and starting radii.[ref]
A purely geometric example shows what coarse spacing can miss. Begin with a straight line segment from to and use the origin as center. Add a short branch from to . Its distance from the center increases continuously from to , since . Counting shared endpoints only once, the added branch contributes one extra distinct intersection exactly for
At radii 1, 2, 3 and 4, the branched and unbranched traces both give . An additional sample at instead gives two intersections for the branched trace. The feature exists in the geometric input but falls between the coarse sample radii.
Figure 1.
A geometric branch missed by coarse radial sampling
. Own synthetic line segments: trunk from(0,0)to(4,0), branch from(2.1,0)to(2.4,0.7). A circle of radius2.25 has two intersections, while samples at radii1,2,3,4 each report one. Distances are chosen geometric units, not specimen measurements or a reconstruction. Details.
Smaller supplies a denser set of probes, while changing shifts their positions. Neither operation restores structure already lost through image segmentation or finite pixel pitch. In particular, closer numerical spacing is distinct from improved physical spatial resolution. Report the center, calibrated distance units, starting radius, interval and sampled endpoint list with a Sholl profile.
The program's zero step setting is a special request for finite image-derived sampling, rather than the literal choice in the grid above. For image input, the documentation describes voxel-scale increments and a calibration-dependent rule for unequal pixel dimensions.[ref]
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.
An original counterexample explains why a Sholl profile does not determine rooted tree topology. Construct two embedded rooted trees whose distance from the root increases along every edge. Both have one initial segment, three branch points of a tree at distances , and four rooted tree leaves at distance . In tree A the second and third branch points lie on different children of the first; in tree B all three branch points lie along one lineage. Their common profile is
At a branch-point radius the shared endpoint is counted once. This convention also gives equal profiles at all three branch-point radii, not just between them.
The multiset of numbers of branch points of a tree along the four root-to-leaf paths is for tree A and for tree B. A graph isomorphism preserving the root would preserve those path counts. The different multisets prove that the rooted trees are different despite identical profiles. The radial summary loses connectivity information.
Figure 1.
Different rooted trees with identical radial intersection profiles
. Original geometric counterexample with checked outward edges, noncrossing embeddings and distinct-intersection counts. Chosen coordinates, not measured anatomy. Details.
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.
A region of interest in image analysis is a specified subset of image coordinates on which an operation or measurement is restricted. It can be an area, a line or a set of points, so its geometry determines which measurements are meaningful. ImageJ provides rectangular, oval, polygonal, line and point selections; an image region of interest describes their concrete use in that program.[ref]
For an original example, let an image be
Choose the top row as the region of interest, so its binary selection mask is . The selected mean is
Selecting the bottom row instead gives 8, whereas the whole-image mean is 5. The stored image is unchanged; the question asked of it has changed.
A fixed geometric selection differs from selecting all pixels above an intensity threshold. Their intersection can be used when the intended measurement is a thresholded subset inside a prescribed area. Save the geometry, coordinate convention and image or frame association with the result. A line selection calls for a length or sampled profile, not the same complete-pixel area from a calibrated pixel count used for an area selection.
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.
NIH Image is Wayne Rasband's historical image-processing program for the Macintosh, preceding ImageJ. Its official documentation describes image acquisition, editing, filtering, calibrated measurements, stacks, a macro language and plug-in extensions.[ref][ref]
One concrete representation choice explains why software history matters for interpreting old results. The manual describes internal pixels as unsigned 8-bit values and import of 16-bit data by rescaling to 8 bits. It also documents the convention of displaying value 0 as white and 255 as black; screen appearance and stored numerical values are distinct.[ref]
For an original chosen conversion model, suppose a high-bit-depth image uses values from 0 to 4095 and is mapped to 8 bits by
Then . Two distinct recorded values become identical, so no subsequent measurement of the converted image can recover their difference. This is a stated quantization model, not an assertion about an undocumented rounding detail in NIH Image.
Keep the original data and the scaling rule when comparing legacy measurements. Spatial calibration is a separate operation: changing a length-per-pixel setting does not restore discarded gray-value information. The manual's analysis workflow selects a region of interest, computes measurements and records results, making those representation and selection choices part of a reproducible calculation.[ref]
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.
SNT is an ImageJ framework for tracing, displaying and quantitatively analyzing branching structures in multidimensional images. It provides editing and automated tracing tools as well as a scripting interface. Its computational components also support filamentous structures outside the package's original application domain.[ref]
A trace encodes connected sample points rather than merely an image of a bright line. For an original geometric example, take successive physical coordinates , and in micrometres. The trace's length is the sum of its two line segment lengths,
whereas the endpoint Euclidean distance is . The ratio distinguishes a bent trace from a straight one with the same endpoints. SNT's metrics documentation defines path/branch length through internode distances and branch contraction through this endpoint-distance-to-path-length ratio.[ref]
Those calculations require calibrated coordinates and the intended connectivity. Rescaling image axes changes lengths; connecting the wrong endpoints changes the traced object. The framework's Sholl analysis is a different summary: it produces a Sholl profile of radial intersections. The fact that a Sholl profile does not determine rooted tree topology explains why a profile cannot replace the connected trace when the question concerns its branching structure. This example concerns software data and geometry, not measured anatomy.
An image region of interest in ImageJ is an explicit image selection whose geometry and image or slice association are used by subsequent operations. This is the program-level realization of a region of interest; it is not necessarily an object identified automatically by image segmentation. The guide describes selecting, measuring, saving and restoring selections with the ROI Manager.[ref]
For an original two-frame example, let
A fixed selection of the left column has mean 20 in the first frame and 30 in the second. A rule selecting values at least 25 instead selects the lower row in and upper row in ; its mean is 35 in both frames. Thus a fixed geometric selection and a value-derived selection can produce different measurements on exactly the same frames.
A saved selection is not a copy of all underlying pixel data. Reusing it requires the corresponding images and a consistent coordinate interpretation. Record whether the same geometry is applied across an image stack or each frame receives a newly generated selection. The ROI Manager can retain slice associations, while its multi-measure operation can apply selections across slices; these are choices to specify, not evidence that an object has remained stationary.[ref]
An image stack is an ordered collection of related two-dimensional images treated as one dataset. Its index may denote cutting depth, time or another acquisition coordinate: stacking images does not by itself establish a spatial volume. The ImageJ guide distinguishes ordinary stacks from datasets with several independent axes and requires equal image dimensions and bit depth within an ordinary stack.[ref]
For an original spatial example, store 100 grayscale images as an array with shape , where indexes sections and index pixels. If each value occupies two bytes, the raw data require
This excludes metadata and compression. Define the image stack axis calibration explicitly: at lateral pixel pitch and section spacing , a zero-origin convention is
The first and last section centers are apart. Array shape alone does not contain that information.
An index permutation can preserve every stored intensity yet exchange depth and lateral coordinates, giving the wrong geometry if the spacing metadata are not permuted too. Image registration estimates alignment between slices; image segmentation assigns structural labels. Neither operation supplies a missing section's observations. For datasets exceeding memory, an image stack can also be read a slice at a time; the guide's virtual-stack representation keeps the image sequence on disk.[ref]
Image stack axis calibration assigns physical coordinates to the indices of an image stack. It states what each axis means, its spacing, origin and orientation. Pixel indices, section indices and frame indices are distinct from positions and times. In ImageJ, image properties include pixel width, pixel height, voxel depth and frame interval; its Origin fields are expressed in pixels.[ref]
For an original general spatial model, let the index vector be and define
where is a physical origin and is a rotation matrix. This is an affine map; the rotation represents a chosen acquisition-to-world orientation rather than a claim that ImageJ's Properties dialog implements an arbitrary rotation. Convert any pixel-unit origin into the chosen physical convention before using this equation.
Take spacings , origin and a 90° rotation about the positive third axis:
Index first maps to local displacement and then to world position . Its distance from the physical origin is , unchanged by the rotation.
Cropping and axis permutation require corresponding metadata changes. If a crop begins at old index , its new physical origin is . For irregular section positions, store those positions explicitly instead of inventing one uniform depth increment. Image resampling may alter the grid, but it does not create independently acquired depth information.
A depth map assigns a distance-related value to each accepted image location. The geometry must specify whether this means depth along the camera axis or Euclidean distance along the viewing ray. Units, missing values and the coordinate frame are also part of the representation. In calibrated stereoscopy, converting a disparity map through the camera geometry produces depth estimates.[ref]
For an ideal camera, suppose a point has coordinates metres. Its axial depth is two metres, but its Euclidean distance from the camera center is metres. The same scene can thus yield different valid numerical maps under different conventions. A missing stereo correspondence requires an invalid-location marker rather than a fabricated depth. Camera calibration and measurement uncertainty determine how confidently accepted values describe the scene.
Image resampling evaluates image data on a new sampling grid, often while resizing, rotating or rectifying an image. An output pixel is mapped to a source location, which may lie between stored source pixels. An interpolation rule estimates its value; a boundary rule handles locations outside the recorded image.[ref]
For example, bilinear interpolation at the center of four source samples with values gives their equally weighted mean, 25. Nearest-neighbor interpolation instead selects one sample and retains its value. These methods trade smoothness against preservation of discrete labels. Reducing image size also changes the sampling rate: a low-pass filter before subsampling can suppress aliasing, whereas interpolation alone cannot guarantee its removal. Stereo rectification uses image resampling to construct aligned virtual views without physically moving either camera.
Mathematical morphology studies shape-transforming operations defined through a chosen structuring element. For foreground pixels represented as a set and a finite footprint , morphological dilation is
while morphological erosion is . Dilation adds footprint translates around the foreground; erosion retains placements whose entire footprint fits.
For a one-dimensional example, and give dilation and erosion . Morphological opening, erosion followed by dilation with the same footprint, removes an isolated set for that footprint because neither placement contains two consecutive points. grayscale variants use local minima and maxima rather than binary membership. The footprint and boundary conventions determine the exact operation.[ref]
Morphological opening applies morphological erosion and then morphological dilation with the same structuring element. For a foreground set and structuring element ,
It keeps the union of all translated copies of contained in . Consequently the result is contained in , and repeating the operation changes nothing: morphological opening is idempotent.
For a one-dimensional example, take and . Morphological erosion gives and the following morphological dilation restores ; the isolated point at five disappears. The surviving run is restored rather than shifted. In image processing, selecting the structuring element controls which bright features survive. Scikit-image demonstrates removal of bright regions too thin to contain the chosen footprint.[ref]
A structuring element specifies the neighborhood shape and reference position used by an operation in mathematical morphology. In binary image processing, represent it as a finite set of offsets. Morphological erosion tests where a translated fits inside the foreground; morphological dilation adds its offsets to foreground positions.
A three-by-three square uses all nine offsets around its center, while a cross uses the center and its four horizontal or vertical neighbors. They treat diagonal features differently despite having the same width. Scikit-image's morphology demonstration uses a disk-shaped footprint whose radius controls the affected scale.[ref] The reference position matters for asymmetric shapes, and finite-image border rules must specify how neighborhoods outside the image are treated.
For foreground set and structuring element , morphological erosion is
Thus an output position is retained only when every offset in the translated structuring element lands inside the foreground. This can shrink regions and remove features narrower than the neighborhood.[ref]
For and , only starts zero and one have their successor in , giving . The point five disappears. For grayscale data with a flat footprint, the analogous operation takes a local minimum. An image implementation additionally chooses border rules; the set formula assumes the ambient space outside is background.
For foreground set and structuring element , morphological dilation is their Minkowski sum:
Equivalently, place a translated copy of at each foreground position and take their union. For and , the result is , connecting the separated input points.
In image processing, morphological dilation can enlarge bright regions or bridge small gaps. The grayscale version for a flat footprint takes a local maximum, with the footprint reflected according to the stated offset convention.[ref] Asymmetric footprints make reflection conventions visible; symmetric disks hide that distinction. Morphological dilation alone generally enlarges a region, whereas morphological opening combines it with morphological erosion.
Quantization maps numerical values to a specified discrete collection of representable values. In lossy block averaging, maps block arithmetic means in to eight-bit integers. Thus and . Different means can share a stored value, making this step irreversible.
Rounding a voltage to the nearest level in a uniform grid of spacing gives a quantization error of magnitude at most , provided the input is within the converter's range. This follows because each grid point represents the interval bounded by the midpoints to its two neighbors. Clipping invalidates the bound.
The bound concerns recorded samples, whereas the Nyquist–Shannon sampling theorem concerns reconstruction from exact samples of a bandlimited function. If a reconstruction is , its error is , so a general bound involves , not simply . Thus sampling bandwidth and per-sample rounding precision are distinct specifications. Under an additional uniform independent-error model, the quantization-noise standard deviation is , an rms statement rather than a worst-case reconstruction guarantee.
Nearest-neighbor interpolation assigns each requested location the value of its nearest available sample, with a specified convention for ties. In lossy block averaging, samples are placed at block centres and each is copied into its four original pixel positions. This enlarges the raster image without recovering discarded detail.
Image segmentation divides an image signal domain into regions according to a chosen criterion, such as approximately constant or smoothly varying intensity. The Mumford–Shah segmentation model balances fidelity, within-region smoothness and image edge length. An intensity segmentation need not coincide with semantic object identities.
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.
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.
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.
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.
Flood fill finds the region reachable from a seed pixel through allowed neighboring pixels that satisfy a membership rule, often replacing the values in that region. A paint program's fill operation is a familiar application. The seed, membership rule and pixel connectivity together specify what will be filled.
Consider the image
Start at the upper-left pixel, select values equal to one, and allow only horizontal or vertical steps. Exactly three pixels are reachable, giving replacement by nine as
With diagonal steps also allowed, all six ones are reachable and replaced. The fill is a connectivity computation, not a rule to replace every matching value everywhere.
An iterative implementation keeps pending positions in a stack, takes one position and adds eligible unvisited neighbors. Marking a position when it enters the pending collection prevents repeated insertion. This is a depth-first search of the implicit graph. For a fixed neighborhood, visiting a region of pixels takes time complexity, excluding initialization or copying of a whole image. Explicit pending and visited storage avoids relying on a deeply nested recursive call for a large region.
Membership need not require exact equality. The scikit-image flood_fill API can accept values within a specified tolerance of the original seed value, with connectivity or a supplied neighborhood footprint controlling adjacency. Comparing each candidate to the seed is different from allowing a chain of small local changes to drift arbitrarily far from the seed value.[ref]
Record visited positions independently when necessary: replacing a value by itself must not make the algorithm revisit it forever. Repeated flood fills with fresh region labels can implement connected-component labeling.
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.
Cell segmentation assigns image pixels or voxels to individual cells or their regions. It can distinguish foreground from background, separate touching cells, and label each object for later measurements. For example, a fluorescent nuclear image can support counting nuclei, but nuclear boundaries need not coincide with whole-cell boundaries. Thresholding, geometric models and learned methods make different assumptions about contrast and shape. Errors such as merging two cells or splitting one cell can bias counts and size distributions, so evaluation must match the biological quantity being measured.
A grey-value image signal is a scalar function on an image signal domain or an array of pixel values. Continuous image processing models use spaces such as , Sobolev spaces or the BV space, while discrete models use finite-dimensional arrays. The chosen representation distinguishes smooth transitions, noise and image edges.
Image noise is unwanted variation in an observed image signal. In an additive model , Gaussian noise motivates a squared data-fidelity penalty, while other statistics require different penalties. Image smoothing suppresses rapid fluctuations, but a filter must distinguish noise from genuine image edges.
For a smoothed image signal , average the gradient outer product as . The dominant eigenvector estimates the normal to a coherent image edge, and eigenvalue contrast measures local directional structure. Two distinct scales separate differentiation from orientation averaging.
An image edge is a rapid grey-value transition, modeled as a large gradient or a jump discontinuity. It differs from an edge of a graph. Variational models can penalize image edge length, while diffusion image processing estimates image edge directions to limit image smoothing across them.
image edge enhancement increases the apparent sharpness or contrast of an image edge. Unsharp masking gives bounded linear high-frequency amplification; backward normal diffusion in the Perona-Malik equation gives formal nonlinear sharpening with ill-posedness risks. Positive diffusion tensors chiefly preserve or connect structure rather than perform unbounded backward diffusion.
The formal shock-filter equation steepens transitions around inflection boundaries. It is a Hamilton–Jacobi-type transport mechanism rather than positive diffusion. Combining it with controlled forward image smoothing limits noise amplification.
Subtract a smoothed image signal and add a scaled residual: . The Fourier multiplier is bounded by . This enhances apparent contrast but also amplifies noise; it is not a stable exact inverse of heat image smoothing.
Diffusion filtering evolves an observed image signal using a diffusion equation. The heat equation gives Gaussian image smoothing, while gradient-dependent or tensor-dependent diffusion can reduce transport across image edges. A image smoothing scale, stopping rule and appropriate boundary conditions are part of the filter.
A diffusion tensor for image filtering selects directional transport in an image signal through
Here are estimated normal and tangent directions to an image edge. Taking promotes image smoothing along the image edge while reducing mixing across it. A structure tensor provides orientation estimates.
For a prescribed sufficiently regular , positive eigenvalues give a forward parabolic partial differential equation; fixed finite upper and strictly positive lower bounds on the eigenvalues give uniform ellipticity. This statement concerns the principal coefficient of the equation actually being solved.
If depends directly on the evolving gradient, its positivity alone is insufficient. In one dimension, gives flux , but
is negative when . Linearizing then gives backward diffusion in that range. Distinguishing a prescribed tensor from a gradient-dependent nonlinear flux prevents a false general parabolicity claim.
Image smoothing suppresses rapid fluctuations attributed to noise. Linear heat equation image smoothing attenuates Fourier frequencies by but also blurs image edges. Nonlinear filtering uses image signal geometry to distinguish fluctuations from meaningful transitions.
A median filter replaces an image signal value by the median of nearby values. Unlike a linear average, it can reject isolated extreme observations without averaging both sides of an image edge. The small-radius response depends on neighbourhood geometry and measure; a uniform disk-area median and a circle-boundary median have different time scales.
At a smooth point with nonzero gradient, rotate coordinates so . Write . A candidate median has level boundary in the disk. The area imbalance is ; equal half-areas force . Here is the tangential second derivative, giving the formula. The disk uses uniform area measure, not its boundary measure.
Gaussian blur applies convolution with to an image signal. It averages over a spatial scale , suppressing rapid variation while also blurring image edges. The heat-kernel convolution realizes this filter at time .
The Fourier transform of a Gaussian and the convolution theorem give this multiplier with the angular-frequency convention . In cycles-per-length frequencies , it is . Each coordinate has variance , and higher frequencies receive stronger attenuation.
A variational model balances agreement with observed data against a regularity or geometric penalty. Examples include total variation denoising, the relaxed graph-area functional, and the Mumford–Shah functional. Convex penalties support unique reconstruction, while segmentation energies can have multiple competing partitions.
The energy balances data fidelity, within-region smoothness and image edge length. In its relaxed SBV space formulation the image edge set is . Clipping to the bounded data range, the SBV compactness theorem and lower semicontinuity prove existence; the full segmentation problem is not strictly convex.
The Mumford–Shah functional can be approximated by an auxiliary edge field and energy
The field is near one inside regions and near zero across an image edge, weakening smoothing there. The profile has unit edge energy per unit length in this normalization. The 1990 construction is a Gamma-convergence approximation; its global-minimizer limit does not guarantee global optimality of an alternating numerical solve. Each fixed-field subproblem is quadratic, but the joint energy is nonconvex.
Removing the jump-length cost from the Mumford–Shah functional lets finer piecewise-constant partitions reduce squared fidelity without charging for their proliferating image edges. For continuous data on a compact image domain, fine-cell averages converge in squared error while the ordinary within-cell gradient is zero. A finite interface penalty makes that geometry costly.
On the unit square, let and take , . Both have one unit-length jump and zero ordinary gradient. Their mean has two unit-length jumps. For squared-error coefficient one, while , violating convexity when . The Mumford–Shah functional can therefore be nonconvex even though the fixed-edge reconstruction subproblem is strictly convex.
For a fixed sufficiently regular image edge set, the Mumford–Shah functional is a strictly convex quadratic energy on the Sobolev space of its complement. A first variation gives within each region and separate one-sided Neumann boundary conditions on free edges. A jump need not vanish across an edge. The weak solution is unique by the Lax-Milgram theorem; this does not prove uniqueness when the edge set is also optimized.
As the jump-length weight tends to infinity with the gradient weight fixed, the limiting problem minimizes on . It has a unique minimizer by the Lax-Milgram theorem and strict convexity. Without prescribed boundary values, its weak equation is with natural Neumann boundary conditions.
The infinite gradient-weight limit restricts to SBV space image signals with almost everywhere. Their energy is fidelity plus jump length, represented by constants on a Caccioppoli partition. Internal perimeter is counted once by ; adjacent equal-valued regions can be merged.
Suppose two constant data intensities differ by , have areas and , and share an internal boundary of length . Keeping the boundary costs with zero fidelity; merging the two regions costs after fitting their common mean. The displayed inequality makes splitting cheaper among these two candidate geometries. This comparison does not prove either geometry is globally optimal among all partitions.
When grey values are fixed but region labels vary, a smooth interface satisfies . The curvature uses the normal pointing out of region , positive on an outward-oriented circle. It balances the change in data cost against the first variation of interface length. Fixing a full spatial image signal instead fixes its jumps and leaves no such boundary-relocation freedom.
At a freely moving regular junction of three smooth image edges with equal isotropic length weights, the endpoint first variation requires the sum of their outward unit tangent vectors to vanish. Three unit vectors with zero sum have pairwise angles of degrees. Different interface weights instead give a weighted force balance, and constrained or singular junctions require separate hypotheses.
For a fixed positive-area region , its least-squares grey value is . The minimum fidelity equals . This eliminates the grey values before optimizing the partition geometry.
A minimizer of the Mumford–Shah functional with bounded image signal data has an essentially closed jump set: replacing by its relative closure adds no -dimensional measure. Its complement supports a Sobolev representative. This regularity theorem connects a relaxed SBV space minimizer to the classical closed-edge formulation; it is not a property of every special bounded-variation function.

Articles by others on the same topic (1)

Image processing is a method of performing operations on images to enhance them, extract useful information, or prepare them for analysis or interpretation. This field combines techniques from computer science, electrical engineering, and mathematics, and it has applications across various domains, including photography, medical imaging, machine vision, video processing, and remote sensing. Key aspects of image processing include: 1. **Image Enhancement**: Improving the visual quality of an image (e.g.