cad_surface_to_pixel — CADMAP project op

資料種類:mesh × pointstable

呼叫: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)(或 opscadmap.get("cad_surface_to_pixel"))

用法

3-D 點 (N,3) → 像素 + 可見性(遮蔽・背面・出畫分別回傳)。

> 以下的詳細說明為原文 —— 摘要與標題已翻譯。

`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)。

參考(範例資料・文獻)

• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。

• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。

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

可執行的範例(實際呼叫該運算子並已驗證的樣例)

defect_to_cadpy -3.11 examples/defect_to_cad.py

型別可銜接的下一個運算子(可接受 table 作為輸入)

同類別(project)


*Provenance: cadmap.py — CADMAP 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*

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