match_shape_3d — 3D match_localize op

• 資料種類:voxel × voxel → position

• 呼叫: import fullseye as fs; fs.ledger.match_shape_3d(vol, template, device='cpu', mc=0.05, subvoxel=True)(要直接呼叫實作,import match3d; match3d.match_shape_3d(vol, template, device='cpu', mc=0.05, subvoxel=True);從台帳取用則 ops3d.get("match_shape_3d"))

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

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

用法

3D 形狀(梯度方向)匹配 = 2D shapematch_gpu 的 voxel 版(「輪廓匹配」)。

模板與場景的 單位梯度向量內積之和(Steger 式)。對強度/對比度不變, 以邊緣/形狀衡量匹配。score(pos)=Σ<û_scene(pos+dt), û_model(dt)>/n,用 3 個分量的 conv3d 計算。

步驟:對兩個 volume 做 sobel3d → 只把大小超過 mc 的 voxel 單位向量化(其餘為 0)。以模板單位梯度的 3 個分量為核,與場景單位梯度逐分量做 conv3d 並求和, 再除以模板的有效 voxel 數 n。score 在 [−1, 1] 內,1 為完全匹配(梯度方向全部一致),對比度反轉時為 −1。

• mc:針對 sobel3d 的 原始輸出(真實梯度的 32 倍) 的閾值。越小,平坦區域的

雜訊梯度越多地參與投票。

• 位置:回傳值 [score, z, y, x](float64 陣列)的座標是 模板中心 voxel(index T//2)

落在 scene 的何處。模板不能完全容納的位置都設為 0,因此模板比 scene 大時全部保持為 0,回傳 index (0,0,0)(不拋出例外)。

• subvoxel=True 時細化到 argmax 的 ±2 鄰域內正分數的質心(accel_match._subvoxel_com)。

後續:refine_translation_lk(corner 慣例,因此減去 T//2)/ refine_lm。對旋轉不具不變性(先用 match_logpolar_z 對齊旋轉)。

參考(範例資料、文獻)

• 範例資料目錄(下載 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_chamfer_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.