cad_surface_to_pixel — CADMAP project op

Data kinds: mesh × pointstable

Call: import cadmap; cadmap.cad_surface_to_pixel(mesh, points, K=None, R=None, t=None, image_size=None, cull_backfaces=True, depth_tol=1e-06, strict=False) (or opscadmap.get("cad_surface_to_pixel"))

Usage

3-D points (N,3) → pixels plus visibility (occluded, back-facing and out-of-frame are told apart).

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

`camera.project_points` で投影したうえで、同じ画素へ光線を撃ち直して

手前に別の面が無いかを確かめる。これをやらないと、隠れている点の画素座標を

「そこに見えている」かのように返してしまう。返りは dict:

• `uv (N,2) — 画素 (u=列, v=行)depth <= 0` の点でも

投影値は返るが `in_front = False` が立つ。

• `depth` (N,) — カメラ座標 Z。

• `in_front (N,) bool — depth > 0`。

• `in_image (N,) bool — 画枠内(0 <= u <= width-1` かつ

`0 <= v <= height-1`)。

• `occluded` (N,) bool — 同じ視線上で、その点より手前に面がある。

• `occluder_face (N,) int64 — 遮っている面。無ければ -1`。

• `visible (N,) bool — in_front & in_image & ~occluded`。

• `camera` 実際に使われたカメラ。

• `winding_fixed` bool — 内向きに巻かれた閉メッシュを検出して直したか。

`depth_tol` は「自分自身の面に遮られた」と誤判定しないための相対許容で、

遮蔽と判定するのは `z_hit < depth * (1 - depth_tol) - depth_tol` のとき。

閉じた mesh の裏側にある点は、手前の壁に遮られて `occluded = True` に

なる — これは仕様であって取りこぼしではない。

遮蔽判定は巻き方向に依存する(手前の壁が裏面としてカリングされると、

裏側の点まで `visible になる)。そのため cull_backfaces=True` では

内向きに巻かれた閉メッシュを検出し、既定では巻きを直して

`winding_fixed=True を返す。strict=TrueValueError`、

`cull_backfaces=False` では検査そのものをしない

(詳細は :func:_orient_for_culling)。

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)

defect_to_cadpy -3.11 examples/defect_to_cad.py

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

Same category (project)


*Provenance: cadmap.py — CADMAP 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.