Image Segmentation Lab

Interactive Demo — Otsu · Region Growing · Live-Wire

Otsu's method (1979) finds the threshold t* maximizing between-class variance σ²B(t) = ω₀ω₁(μ₀−μ₁)². Drag the slider or press Auto Otsu.

Noise σ 0

Original & Histogram

Binary Result THRESHOLD

t*
σ²B
ω₀
ω₁
Yellow curve = σ²B(t). Green line = optimal t*. Red line = your slider.

Click to place a seed. The region grows by adding neighbors where |I(q) − μR| < τ. Watch it expand in real-time. Try different tolerances to see leakage vs tight segmentation.

Noise σ 0

Click to seed

Seed I
μR
Pixels
0
σR

Mask View

Region
Frontier
Seed
Low τ → tight, homogeneous region. High τ → leakage through weak boundaries. The mean μR updates adaptively as the region grows.

Live-wire finds the minimum-cost path via Dijkstra. The local cost between pixels p→q is:
l(p,q) = ωG·fG(q) + ωZ·fZ(q) + ωD·fD(p,q)
fG = inverse gradient magnitude   fZ = Laplacian zero-crossing   fD = gradient direction cost. Click to place anchors. Green dashed line follows your cursor.

Noise σ 0

Live-Wire Contour

Click on the image to place the first anchor point.
Anchors
0
Path len
Total cost

Combined Cost Map WEIGHTED

Bright = high cost (path avoids). Dark = low cost (path prefers).
fG = 1 − G/max(G) — low at strong edges
fZ = 0 at Laplacian zero-crossings, 1 elsewhere
fD penalizes turning away from the gradient normal direction
Adjust ω sliders to see how each component shapes the cost map and path.
fG gradient
fZ Laplacian
fD direction

Draw two regions to compare. Region A = ground truth, Region B = prediction. Click Compute to see Dice, Jaccard, sensitivity, specificity and the overlap map.

Region A TRUTH

Region B PREDICTION

Overlap

Dice
Jaccard
Sens
Spec
TP
FN
FP