illuminant_from_dichromatic_planes — SPECULAR dichromatic op

数据种类:rgbimage × labelsvector

调用:import specularity; specularity.illuminant_from_dichromatic_planes(image_rgb, labels, min_pixels=16, min_plane_ratio=1e-06, min_intersection_ratio=1e-06)(或 opsspecular.get("illuminant_from_dichromatic_planes"))

用法

由两种以上材质恢复光源颜色。→ 单位 3 向量。

> 以下的详细说明为原文 —— 摘要与标题已翻译。

Lee's construction (1986). Under the dichromatic model every pixel of one

material lies in the plane spanned by that material's body colour and the

illuminant colour, so each material contributes a plane through the origin

of RGB, and all of those planes contain the illuminant direction. Two

materials with different body colours therefore intersect in exactly one

line, and that line is the answer — a null-space computation, closed form.

*labels* is an `(H, W)` integer map naming the material at each pixel;

negative labels are ignored (background). Each material needs *min_pixels*

pixels and genuine highlight variation: a material seen with no specular

reflection at all has colours along a single ray, which defines no plane.

That is measured by the second-to-first singular ratio of its colour matrix

and rejected below *min_plane_ratio* rather than contributing an arbitrary

normal.

The returned direction is unit length with a positive component sum

(illuminant colours are positive; the null space fixes the line, not the

sign). On synthetic data with three known materials it reproduces the true

illuminant with a maximum component error of 4.4e-14 and an angular error

that rounds to 0.0 degrees (measured in `tests/test_specularity.py`).

*min_intersection_ratio* guards the answer itself: if the plane normals are

nearly parallel — two materials whose body colours differ only in

brightness, which is the same material twice — the intersection is

ill-conditioned and the call raises instead of returning a direction picked

by rounding error.

Raises `ValueError`: shape or dtype problems as in

:func:specular_diffuse_split; *labels* is not an `(H, W)` integer map

matching the image; more than :data:MAX_MATERIALS distinct labels; fewer

than two materials survive the *min_pixels* and *min_plane_ratio* tests; the

surviving planes do not intersect in a well-determined line.

详细使用指南

specular_photometric 族使用指南

参考(示例数据・文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

• 算法的正典(作者・年份)与用途见上面的族使用指南

可运行的示例(实际调用该算子并已验证的样例)

specular_photometricpy -3.11 examples/specular_photometric.py

类型可衔接的下一个算子(可接受 vector 作为输入)

同类别(dichromatic)

specular_diffuse_split · specular_coefficient_map · specular_free_transform


*Provenance: specularity.py — SPECULAR 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

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