histogram_match — COLORTRANSPORT matching op

Data kinds: image2d × image2dimage2d

Call: import colortransport; colortransport.histogram_match(src, ref, bins=None, ties='average') (or opscolortransport.get("histogram_match"))

Usage

Match the value distribution of `src to ref` (exact 1-D optimal transport).

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

順位を保ったまま参照の分位点に置き換える。`bins` を指定すると、その段数の

累積分布で近似する ―― 速いが厳密ではなくなるので、既定は `None`

(厳密)にしてある。

同じ値の画素をどう扱うかで、絵の意味が変わる。 単調写像なら「等しい入力

は等しい出力に写る」はずだが、素朴に順位で置き換えると同値が引き裂かれる

実測(値 2 が 4 画素ある整数画像):出力は ``0.2222 / 0.3333 / 0.4444 /

0.5556`` の 4 つに分かれた。つまり**平坦だった領域に、元の絵に無い濃淡が

生える**。整数画像は同値だらけなので、これは例外ではなく常態。

• `ties="average"`(既定)—— 同値の画素には、そこに割り当たった参照値の

平均を与える。等しい入力は等しい出力に写り、単調性が保たれる。

その代わり出力の分布は参照と厳密には一致しなくなる(同値の塊のぶん、

分布が階段状に丸まる)。連続な入力(同値が無い)なら厳密一致のまま。

• `ties="break"` —— 順位そのままで引き裂く。**出力の分布は参照と厳密に

一致する**が、平坦部に偽の濃淡が出る。分布を厳密に合わせることが目的で、

絵として見ないと分かっているときだけ。

どちらを選んでも失うものがある(分布の厳密さ か 平坦部の平坦さ)ので、

黙って片方に決めず引数にした

多チャネルの絵にそのまま掛けるとチャネル間の相関を壊す

各軸の周辺分布は合うのに、色の組合せが元に無かったものになりうる。

相関ごと運びたいときは :func:color_transfer の `method="gaussian"`。

Background guides (the physics and conventions behind this op)

colorimetry — 測色と分光の知識 — 色は「分光 × 光源 × 観測者」でしか決まらない

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)

color_transportpy -3.11 examples/color_transport.py

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

poisson_blend

Same category (matching)

color_transfer · gaussian_transport_map


*Provenance: colortransport.py — COLORTRANSPORT 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.