IP 10 · Where does one global threshold fail?
AdvancedIP 10 · Image Segmentation I: Edge Detection, Thresholding, and Region DetectionImage lab
Description
Dim one side of a page and watch Otsu’s single threshold lose the text, while a threshold that follows the local light keeps it.
Try this: Start with the lighting ramp at 0, then raise it slowly. At what ramp does the global mask start to lose text on the dim side? Then shrink the local window to 11: why does the local mask get worse?
Explanation
Answer the prediction first, or open the explanation when you are ready.
Show the explanation
Ink is darker than paper only when you compare pixels under the same light. On the dim side the paper reflects less light than the ink on the bright side, so no single number separates the two. The global mask turns the dim paper into ink while the local rule, which compares each pixel with its own surroundings, is unaffected.
Lab · IP 10 · Where does one global threshold fail?
Loading image…
Try this: Start with the lighting ramp at 0, then raise it slowly. At what ramp does the global mask start to lose text on the dim side? Then shrink the local window to 11: why does the local mask get worse?
The page is synthetic (scripts/figures/playground_images.py), so the true text mask is known exactly and IoU is a real score, not a proxy. Lighting multiplies the page by 1 − ramp · x/(w − 1). Global: Otsu’s threshold on the 256-bin histogram. Local: a pixel is ink if it is darker than (1 − c) times the Gaussian-weighted average of its window (σ = (window − 1)/6). IoU is the overlap of the ink mask with the true mask divided by their union.
Method and image sources
- Nobuyuki Otsu, A Threshold Selection Method from Gray-Level Histograms, IEEE Transactions on Systems, Man, and Cybernetics, 1979
- scikit-image documentation, Thresholding (global Otsu and local thresholds)
- scikit-image test images (skimage.data): camera is CC0 by Lav Varshney; coins is from the Brooklyn Museum collection, no known copyright restrictions; astronaut is a NASA photograph in the public domain