clahe — 2D gray op

Data kinds: imageimage

Call: fullseye.apply(img, "clahe", a=0.5, b=0.5) (the 2-D model is one image plus two scalar knobs a,b∈[0,1])

Usage

Contrast-Limited Adaptive Histogram Equalization (tiled, bilinearly blended).

> The detailed description below is the original text — the summary and the headings are translated.

• `a — タイル数 nb = 2 + int(3a)` (画像を nb×nb に分割)

• `b — **clip limit**。ビン平均カウントに対する倍率 256**b` で与える

(`b=0` → 1 倍 = 完全に平坦化されたヒストグラム = トーンマップ直線 =

強調ゼロ、`b=1` → 256 倍 = 1 ビンが取り得る最大値なので切り取りが

効かない = 素の AHE、`b=0.5 → 16 倍。OpenCV の既定 clipLimit=40` は

おおよそ `b=0.665`)。

★2026-09-02(この修正): それまで `b` は 完全に死んでいた(実測:

`max|clahe(x,0.5,0.0) - clahe(x,0.5,1.0)| == 0.0` きっかり)。CLAHE の

"C" は contrast limited の C であり、clip limit こそが AHE と CLAHE を

分ける当のものなので、実装は AHE であって CLAHE ではなかった ——

名前が嘘をついていた。ここで clip limit を実装して `b` に割り当て、

`b=1` が旧実装とビット一致する端になるよう倍率を選んである

(切り取りが起きない上限 = ビン数 256 倍)。

Tiles PARTITION the image (linspace boundaries, so the last tile absorbs the

H % nb / W % nb remainder), each tile's clip-limited CDF is its local tone map,

and every pixel blends the maps of its (up to) 4 nearest tile centres with

bilinear weights — the standard CLAHE interpolation (Zuiderveld 1994).

2026-08-30: 補間を追加(KNOWN_ISSUES #4 — 旧実装はタイルごとに独立に平坦化

しており、タイル境界に不連続(肉眼で見える格子)が出ていた)。タイル中心の

近傍領域ではそのタイルの CDF がそのまま支配的なので、旧実装と同じ写像族の

連続版になっている。

Detailed usage guide

gallery2d_gray_arith family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

gallery2d_gray_arithpy -3.11 examples/gallery2d_gray_arith.py

Ops the type connects to (they accept image as input)

identity · gaussian · mean_box · bilateral · unsharp · median · min_filter · max_filter

Same category (gray)

gamma · invert · scale_clip · equalize · sigmoid · sk_adapthist · sk_enhance_contrast · sk_autolevel


*Provenance: ops.py — 2D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.