match_chamfer_3d — 3D match_localize op

• 資料種類:voxel × voxel → position

• 呼叫: import fullseye as fs; fs.ledger.match_chamfer_3d(scene, template, device='cpu', thr=0.3, edt='scipy')(要直接呼叫實作,import match3d; match3d.match_chamfer_3d(scene, template, device='cpu', thr=0.3, edt='scipy');從台帳取用則 ops3d.get("match_chamfer_3d"))

• 經台帳呼叫的回傳值: fullseye.ledger.match_chamfer_3d(...) 只回傳宣告的 out 型別 position 的值(底層函式還會回傳輔助資訊)。需要被捨棄的部分時,請用 fullseye.ledger.match_chamfer_3d.raw(...),或直接呼叫 match3d.match_chamfer_3d。

• GPU:該運算子有 GPU 路徑(device="cuda")

用法

chamfer / 距離場匹配(對部分可見與遮蔽穩健)。voxel × chamfer 列。

在場景邊緣的 EDT(每個 voxel 到最近邊緣的距離)上放置模板的邊緣點, 最小化距離和。score(pos)=Σ_{template edge} DT_scene(pos+edge)/n。越低匹配越好。即使部分邊緣點缺失也有效(比 NCC 更耐遮蔽)。相關(conv3d)始終在 GPU 上。距離場為 edt="scipy"(CPU,預設)或 edt="jfa"(edt_jfa,全 GPU、無 CPU 往返;與 scipy 嚴格一致)。回傳值 [chamfer 距離, d, h, w]。

步驟:在兩個 volume 中把 |∇| > thr·max|∇| 的 voxel 作為邊緣(thr 是相對各 volume 最大梯度的 相對比,梯度用 sobel3d)。產生 scene 邊緣的距離轉換 DT,以模板的邊緣 2 值 volume 為核做 conv3d,再除以邊緣數 n。回傳值 [dist, z, y, x] 中的 dist 是「模板每 1 個邊緣 voxel 到最近 scene 邊緣的平均距離(voxel 單位)」,0 為完全匹配。位置是 模板中心 (T//2) 的 scene 座標,為 整數(沒有 subvoxel 細化;需要時交給 refine_translation_lk。corner 慣例,因此減去 T//2)。模板不能完全容納的位置用最大值+1 填充並排除。模板沒有邊緣(thr 過高等)時 score 全為 0,回傳 index (0,0,0)。scene 沒有邊緣時距離場沒有意義(降低 thr)。edt="jfa" 使用 edt_jfa,在 device 上完成,否則用 scipy(CPU)。

參考(範例資料、文獻)

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

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

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

• matching_localize — py -3.11 examples_3d/matching_localize.py

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

refine_peak_newton · refine_translation_lk · refine_lm · fuse_to_voxel

同類別(match_localize)

match_shape_3d · match_curvature_3d · match_hough_3d · match_mip_2d · match_points_ncc


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

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