bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / registration / _optical_flow / optical_flow_tvl1
function
skimage.registration._optical_flow:optical_flow_tvl1
source: /dev/scikit-image/src/skimage/registration/_optical_flow.py :166
Signature
def optical_flow_tvl1 ( reference_image , moving_image , * , attachment = 15 , tightness = 0.3 , num_warp = 5 , num_iter = 10 , tol = 0.0001 , prefilter = False , dtype = <class 'numpy.float32'> ) Summary
Coarse to fine optical flow estimator.
Extended Summary
The TV-L1 solver is applied at each level of the image pyramid. TV-L1 is a popular algorithm for optical flow estimation introduced by Zack et al. [1], improved in [2] and detailed in [3].
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.
attachment: float, optionalAttachment parameter ( in [1]). The smaller this parameter is, the smoother the returned result will be.
tightness: float, optionalTightness parameter ( in [1]). It should have a small value in order to maintain attachment and regularization parts in correspondence.
num_warp: int, optionalNumber of times moving_image is warped.
num_iter: int, optionalNumber of fixed point iteration.
tol: float, optionalTolerance used as stopping criterion based on the L² distance between two consecutive values of (u, v).
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 (image0.ndim, M, N[, P[, ...]])The estimated optical flow components for each axis.
Notes
Color images are not supported.
Examples
from skimage.color import rgb2gray from skimage.data import stereo_motorcycle from skimage.registration import optical_flow_tvl1 image0, image1, disp = stereo_motorcycle() image0 = rgb2gray(image0) image1 = rgb2gray(image1) flow = optical_flow_tvl1(image1, image0)✓
Aliases
-
skimage.registration.optical_flow_tvl1