PPolySim OS

Image Thresholding

Turn a grayscale image into a clean binary mask. Compare a manual global cut, Otsu's automatic optimal threshold, and adaptive local thresholding — live.

Image ThresholdingLive

Controls

Presets

Segment bright objects from the background. Otsu finds the optimal cut automatically; adaptive thresholding tracks local lighting where a single global cut fails.

Otsu computes the threshold automatically — no slider needed. The green curve on the histogram is the between-class variance; its peak is the chosen T.
▶ Run in Python

Data Inspector

PresetUneven lighting
MethodOtsu (auto)
Threshold T106
Otsu optimal T106
Foreground34.1%

Governing equation

Reading this result: Otsu scans every candidate threshold and picks T=106, the value that maximizes the between-class variance σ_b² (green curve) — equivalently, the split that best separates the two histogram peaks. It needs no manual tuning, but as one global cut it still struggles when lighting is uneven.

Runs locally in your browser — free forever. Scale to the cloud when reality gets heavy.

or unlock everything with Pro →
★ Sign in to save this setup
Save your tuned setup, or drop this simulation into your own site, docs, or course page.

How it works

Thresholding is the simplest image segmentation: label each pixel foreground or background by comparing its intensity to a threshold. A single global threshold works only when the histogram is cleanly bimodal. Otsu's method computes the optimal global threshold automatically by choosing the value T that maximizes the between-class variance σ_b²(T)=w₀w₁(µ₀−µ₁)² — the split that best separates the two intensity populations. But under uneven illumination no single T is correct everywhere, so adaptive (local) thresholding compares each pixel to the mean of its own neighborhood instead. Switch on the 'Uneven lighting' preset to watch global and Otsu break down while adaptive holds up.

Ask the AI about this model

The math, the assumptions, real-world uses, or a code translation — explained for this exact simulation.

More Image Processing simulations

Frequently asked questions

Is this Otsu adaptive thresholding segmentation tool really free?
Yes. Image Thresholding runs entirely in your browser using your device's own compute, so local use is free forever. You only pay Compute Tokens if you scale a job to the cloud.
Do I need to install anything?
No. Everything runs client-side in a modern browser — no downloads, no license, no account required to start.
Can I save or share my simulation?
Create a free account to save projects, and use a shareable embed or minted DOI to publish a live, interactive version anywhere.
How accurate are the results?
The solver uses established numerical methods, but results are for research and educational purposes and should be validated against experiment or professional review before you rely on them.