bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / registration / _optical_flow / optical_flow_ilk
function
skimage.registration._optical_flow:optical_flow_ilk
source: /dev/scikit-image/src/skimage/registration/_optical_flow.py :347
Signature
def optical_flow_ilk ( reference_image , moving_image , * , radius = 7 , num_warp = 10 , gaussian = False , prefilter = False , dtype = <class 'numpy.float32'> ) Summary
Coarse to fine optical flow estimator.
Extended Summary
The iterative Lucas-Kanade (iLK) solver is applied at each level of the image pyramid. iLK [1] is a fast and robust alternative to TVL1 algorithm although less accurate for rendering flat surfaces and object boundaries (see [2]).
Parameters
reference_image: ndarray, shape (M, N[, P[, ...]])The first grayscale image of the sequence.
moving_image: ndarray, shape (M, N[, P[, ...]])The second grayscale image of the sequence.
radius: int, optionalRadius of the window considered around each pixel.
num_warp: int, optionalNumber of times moving_image is warped.
gaussian: bool, optionalIf True, a Gaussian kernel is used for the local integration. Otherwise, a uniform kernel is used.
prefilter: bool, optionalWhether to prefilter the estimated optical flow before each image warp. When True, a median filter with window size 3 along each axis is applied. This helps to remove potential outliers.
dtype: dtype, optionalOutput data type: must be floating point. Single precision provides good results and saves memory usage and computation time compared to double precision.
Returns
flow: ndarray, shape (reference_image.ndim, M, N[, P[, ...]])The estimated optical flow components for each axis.
Notes
The implemented algorithm is described in Table2 of [1].
Color images are not supported.
Examples
from skimage.color import rgb2gray from skimage.data import stereo_motorcycle from skimage.registration import optical_flow_ilk reference_image, moving_image, disp = stereo_motorcycle() reference_image = rgb2gray(reference_image) moving_image = rgb2gray(moving_image) flow = optical_flow_ilk(moving_image, reference_image)✓
Aliases
-
skimage.registration.optical_flow_ilk