Realm

oa::image::optical_flow_pyr_lk

Sparse Lucas-Kanade optical flow with image pyramids, following calcOpticalFlowPyrLK. Each pyramid level runs one flow_lk_refine dispatch from the coarsest level to level 0 over 2 * window + 1 windows with the same point set applied to every image plane; the tracked estimate carries between levels in a [planes, N, 2] state buffer and the last level writes status and error maps. points is an F32 [N, 2] matrix of (x, y) source positions in level-0 pixel coordinates. window is the half-window radius. Returns (next_points, status, error): the tracked F32 [planes, N, 2] positions, an F32 [planes, N] found/lost mask, and an F32 [planes, N] RMS patch-residual error; status 0 rows carry the final unconverged estimate. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format, points is a nonempty F32 [N, 2] matrix, levels, window, and iterations are >= 1, min_eigen is finite and positive, and the coarsest level still fits the full window.

FnRust public API

Function Documentation

pub fn optical_flow_pyr_lk( previous: &Image, next: &Image, points: &Matrix, levels: u32, window: u32, iterations: u32, min_eigen: f32, ) -> Result<( Matrix, Matrix, Matrix )>
Sparse Lucas-Kanade optical flow with image pyramids, following calcOpticalFlowPyrLK. Each pyramid level runs one flow_lk_refine dispatch from the coarsest level to level 0 over 2 * window + 1 windows with the same point set applied to every image plane; the tracked estimate carries between levels in a [planes, N, 2] state buffer and the last level writes status and error maps. points is an F32 [N, 2] matrix of (x, y) source positions in level-0 pixel coordinates. window is the half-window radius. Returns (next_points, status, error): the tracked F32 [planes, N, 2] positions, an F32 [planes, N] found/lost mask, and an F32 [planes, N] RMS patch-residual error; status 0 rows carry the final unconverged estimate. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format, points is a nonempty F32 [N, 2] matrix, levels, window, and iterations are >= 1, min_eigen is finite and positive, and the coarsest level still fits the full window.