refine op• 資料種類:voxel × voxel × position → table
• 呼叫: import fullseye as fs; fs.ledger.refine_lm(scene, template, init_pos, device='cpu', iters=50, scale=True, gain=False, lam0=0.001, tol=1e-08)(要直接呼叫實作,import match3d; match3d.refine_lm(scene, template, init_pos, device='cpu', iters=50, scale=True, gain=False, lam0=0.001, tol=1e-08);從台帳取用則 ops3d.get("refine_lm"))
• GPU:該運算子有 GPU 路徑(device="cuda")
用 Levenberg-Marquardt 做平移(+等向縮放/亮度增益)的次體素精化。
以粗匹配位置 init_pos(樣板中心在 scene 內的座標 [z,y,x])為起點, 以帶阻尼的 Gauss-Newton(LM)求解 forward-additive Lucas-Kanade,使 SSD
E(p) = Σ_x [ I(W(x;p)) - g·T(x) ]²
最小化。將整數 NCC / Fourier-Mellin / Hough 的粗估計收斂到連續座標的後段。
變形 W(x;p) = t + s·(x - c_T) (c_T=樣板中心, t=平移, s=等向縮放)
雅可比 ∂I(W)/∂p 透過讓 grid_sample 經過自動微分精確取得(三線性內插的解析梯度。
不動點與真正的 SSD 最小值一致 → 避免 sobel 常數倍的偏差,精度高)。
LM Δp = -(H + λ·diag(H))⁻¹ b,成功(成本下降)時 λ×0.4 衰減、失敗時 λ×5 增大。
引數:
scene : 場景 volume (D,H,W)。
template : 樣板 volume (Td,Th,Tw)。比 scene 小。
init_pos : 粗略的樣板中心位置 [z,y,x] (voxel。NCC locate 的 [d,h,w] 等)。
device : "cpu" / "cuda"。與 device 無關。
iters : 最大迭代次數(通常 4-6 次收斂)。
scale : True 時同時最佳化等向縮放 s(4 個參數)。False 則僅平移。
gain : True 時追加最佳化輝度增益 g(殘差 I(W)-g·T)。對亮度差/雜訊穩健。
lam0, tol : 初始阻尼係數 / 收斂閾值(步長範數、相對成本下降)。
回傳值(dict):
pos : 精細化後的樣板中心 [z,y,x] (連續座標)
scale : 等向縮放(scale=False 時為 1.0)
gain : 輝度增益(gain=False 時為 1.0)
cost : 最終 SSD,rms:每 1 voxel 的殘差 RMS,iters:實際迭代次數
• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。
• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。
• refinement — py -3.11 examples_3d/refinement.py
table 作為輸入)fuse_to_voxel · mesh_select_lod
refine)refine_peak_newton · refine_translation_lk · refine_rotation_z · icp_point2point_3d · icp_point2plane
*Provenance: match3d.py — 3D 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*
© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.