refine_translation_lk — 3D refine op

• Data kinds: voxel × voxel × position → position

• Call: import fullseye as fs; fs.ledger.refine_translation_lk(scene, template, init_pos, device='cpu', iters=30, tol=0.0001) (implementation को सीधे call करना हो तो import match3d; match3d.refine_translation_lk(scene, template, init_pos, device='cpu', iters=30, tol=0.0001), registry से लेना हो तो ops3d.get("refine_translation_lk"))

• GPU: इस op का GPU path है (device="cuda")

उपयोग

Gauss-Newton inverse-compositional Lucas-Kanade से 3D translation का sub-voxel refinement।

coarse match (integer NCC / Fourier-Mellin / Hough) से मिली integer initial position init_pos को शुरुआती बिंदु मानकर, SSD Σ|I(x+p) − T(x)|² को minimise करता है और sub-voxel translation p तक converge करता है।

inverse-compositional (Baker–Matthews) तरीका होने से steepest-descent image SD = ∇T और Hessian H = Σ SDᵀSD iteration से पहले केवल एक बार precompute होते हैं, और हर iteration में केवल "scene का trilinear warp + residual + 3×3 linear solve Δp = H⁻¹ Σ SDᵀ(I(x+p)−T)" होता है। translation का composition p ← p − Δp है। शुद्ध translation warp में ∂W/∂p=I है, इसलिए SD=∇T सीधे उपयोग हो सकता है।

Coordinate system: init_pos और return value दोनों बताते हैं कि template origin (corner, index 0,0,0) scene के किस (dz,dy,dx) पर आता है। sobel3d / grid_sample के corner convention से मेल खाता है (ध्यान दें कि NCC (ncc_locate_3d) के center convention से T//2 का अंतर है)।

Parameters

scene : (D,H,W) array_like

खोजा जाने वाला volume।

template : (Td,Th,Tw) array_like

register किया जाने वाला template (scene से छोटा)।

init_pos : (3,) sequence

integer initial position (dz,dy,dx) = template origin का scene coordinate।

device : str

"cpu" / "cuda" आदि। device से स्वतंत्र।

iters : int

अधिकतम iteration।

tol : float

‖Δp‖ इस मान से नीचे जाने पर converge मानकर रुकता है।

Returns

pos : (3,) np.ndarray (float64)

refine की गई sub-voxel position (dz,dy,dx)।

Notes

• smooth (band-limited) density field मानता है। integer initial value ground truth के ±0.5 से 1 voxel के भीतर हो तो आमतौर पर 5 से 8 iteration में ‖err‖ < 0.05 voxel (कम noise पर)। मापा गया (स्वतंत्र cubic-spline GT):

बिना noise mean 0.008 / max 0.013 voxel (≈6 iteration, ≈1.2ms प्रति call), NCC sub-voxel

baseline (mean 0.56 voxel) से लगभग 60× सुधार।

• grad_scale=32 separable sobel3d (derivative [-1,0,1] × smoothing [1,2,1]²) का fixed scale है (linear ramp पर मापा गया 32.0)। इसे सही gradient पर normalise करके Δp का scale ठीक किया जाता है।

• H में छोटा Levenberg regularisation जोड़ा जाता है, ताकि कम gradient वाले flat template पर numerical breakdown न हो।

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• refinement — py -3.11 examples_3d/refinement.py

वे अगले ops जिनसे type जुड़ता है (position को input के रूप में लेते हैं)

refine_peak_newton · refine_lm · fuse_to_voxel

इसी category के (refine)

refine_peak_newton · refine_lm · refine_rotation_z · icp_point2point_3d · icp_point2plane


*Provenance: match3d.py — 3D operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

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