Full search page →

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?

Predict first

The lamp is much stronger on the left than on the right (ramp 0.5). Can one global threshold still separate ink from paper across the whole page?

Hints

The chapter section that uses this lab:

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?

Predict first

The lamp is much stronger on the left than on the right (ramp 0.5). Can one global threshold still separate ink from paper across the whole page?

Loading image…

The page under uneven light
True text mask (known exactly)
One global Otsu threshold
Local threshold
Histogram of the lit page and the Otsu threshold

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

Open in the Playground →