AI Glossary / Computer vision and multimodal AI / Intermediate
Median-threshold bitmap (MTB)
Definition
A median-threshold bitmap (MTB) is a binary image that marks whether each pixel is brighter than the image's median intensity. It is useful for aligning photographs taken at different exposures because relative brightness ordering can remain similar even when the original pixel values differ substantially.
What it means
Two exposure-bracketed photographs of the same scene may be geometrically similar but numerically very different. Directly comparing their intensities can mistake exposure differences for poor alignment.
An MTB replaces those intensities with a simpler question: is this location above the image's median? A pixel receives one if it is brighter and zero otherwise. Repeating the process separately for each image gives comparable patterns under suitable exposure changes.
This discards much of the original information intentionally. The bitmap supports alignment; it is not an HDR image, a radiance estimate, or a replacement for the full-color photographs used in the later merge.
How it works
Convert each image to an appropriate grayscale representation and find its median. Threshold at that median to construct the bitmap. Create an exclusion mask around values near the median, where small noise changes can easily flip the binary classification.
Compare candidate spatial shifts using bitmap disagreement, commonly through exclusive-OR operations while ignoring excluded or invalid locations. A pyramid permits a coarse-to-fine search: estimate the shift at low resolution, scale it to the next level, and refine locally.
Ward's original method targets translational alignment. Rotation, perspective changes, parallax, moving objects, and severe clipping can require other handling. Exposure robustness relies on sufficient consistency of the scene and brightness ordering; it should not be interpreted as guaranteed success for every pair of differently exposed images.
Three practical examples
1. HDR preparation: A photographer aligns an exposure bracket before combining it into a high-dynamic-range representation. MTB alignment addresses small image shifts while separate processing handles radiometric reconstruction and moving objects.
2. Exposure fusion: A software tool aligns dark and bright photographs before blending well-exposed regions. The binary comparison helps avoid treating brightness differences alone as geometric errors.
3. Pipeline testing: An engineer applies known shifts and exposure changes to test images, then checks whether the alignment recovers the shifts. Difficult cases include large saturated regions and little useful spatial structure.
Think of it this way
Think of comparing two maps that label areas only as “above the local map's halfway brightness rank” or “not above.” The maps can still share a recognizable layout even when one original photograph is much brighter.
The analogy is limited because a median is calculated across the image, not separately for every local area. Scene changes and lost brightness distinctions can alter the binary layout and undermine the comparison.
Worked example
Take a five-pixel grayscale example [10, 20, 30, 40, 50]. Its median is 30. Using one for values strictly greater than the median produces [0, 0, 0, 1, 1].
Double all values without clipping: [20, 40, 60, 80, 100]. The median becomes 60, but the bitmap remains [0, 0, 0, 1, 1]. Absolute intensities changed while their positions relative to the median did not.
Now suppose a brightness limit clips the first sequence after multiplication by ten, giving [100, 200, 255, 255, 255]. Its median is 255, so the same strict threshold produces [0, 0, 0, 0, 0]. The useful pattern has disappeared because saturation collapsed distinct values into ties.
Finally, a pixel near a median of thirty might measure twenty-nine in one noisy capture and thirty-one in another. Its bit flips even without motion. Excluding a small intensity band around the median reduces the influence of such unstable comparisons, at the cost of using fewer pixels.
Illustrative case study
Fictional case: A property photographer combines an interior exposure bracket. MTB alignment corrects a small horizontal camera shift, but a nearby chair and the distant window frame still do not align perfectly after a slight viewpoint change.
The editor recognizes the depth-dependent discrepancy as parallax rather than an exposure issue. The team chooses a more suitable alignment strategy or capture setup and handles a moving curtain separately before producing the final composite.
The case illustrates the boundary of a translation model. It does not claim that all handheld brackets can be repaired by bitmap alignment or that exposure fusion automatically removes motion artifacts.
Common misconceptions and mistakes
Do not confuse median thresholding with median filtering. Thresholding creates a binary representation; filtering replaces neighborhood values with a median.
Do not assume the binary images should be used as the final photographs. They guide alignment, after which the estimated transformation is applied to the original images as appropriate.
Avoid equating exposure invariance with immunity to saturation, noise, scene movement, or changed viewpoint. Also check overlap handling: newly exposed border pixels are not valid scene evidence. Comparing padded borders without appropriate masking or cropping can distort an alignment score.
Business use
MTB alignment is a useful component in multi-exposure imaging workflows when brightness differences complicate ordinary intensity matching. Its appeal is a simple representation that supports efficient comparisons.
Evaluate it on actual capture conditions rather than only ideal translated copies. Check residual misalignment on both near and distant objects, document cropping, and separate alignment failures from merge artifacts. Retain the original bracket and estimated shifts so unexpected results can be diagnosed. For automated processing, include a way to flag weak or inconsistent matches instead of always accepting a nominal shift.
People also ask
Does MTB alignment need the exposure times?
The bitmap comparison can operate without them, although a later HDR reconstruction step may require exposure information.
Why exclude pixels near the median?
Small noise changes can move them across the threshold and create unstable bits unrelated to image motion.
Does the method correct every kind of camera movement?
No. The classic approach estimates translations; other geometric changes can exceed that model.
Check your understanding
Doubling unclipped intensities leaves their MTB unchanged. Will severe clipping necessarily preserve it too?
Answer: No. Clipping can collapse different intensities into ties and change the threshold pattern.
Related terms
- Image registration
- Exposure bracketing
- Exposure fusion
- Binary image
- Median
- HDR imaging
- image pyramid
- parallax
Learn next
Create MTBs from the same image under unclipped and clipped exposure changes. Then compare shifted bitmaps with and without an exclusion band, examining why a low disagreement score needs sufficient valid overlap.
More in Computer vision and multimodal AI
- Mean field approximation - Mean field approximation simplifies a system of interacting variables by representing their combined behavior through separate factors and average effects.
- Medial axis transform - The medial axis transform represents a shape through its central skeletal structure together with distances to its boundary.
- Median filter - A median filter replaces each value with the median of values in a nearby window.
- Membrane - In Poisson image editing, a membrane is a smooth correction surface that carries the difference between source and destination boundary values into the...
- Merit function - A merit function is a numerical objective used to score candidate solutions during optimization.
- Mesh subdivision - Mesh subdivision divides a polygon mesh into smaller faces.
Sources
Greg Ward, Fast, Robust Image Registration for Compositing High Dynamic Range Photographs from Handheld Exposures: https://pages.cs.wisc.edu/~lizhang/courses/cs766-2008f/projects/hdr/jgtpap2.pdf
OpenCV, AlignMTB documentation: https://docs.opencv.org/4.13.0/d7/db6/classcv_1_1AlignMTB.html
The full original paper, hosted by the University of Wisconsin, and official implementation documentation were opened. The pixel examples and property-photography case are original illustrations.
Previous: Median test Next: Mediation (statistics)