Module: registration
¶
skimage.registration.optical_flow_tvl1 (…) |
Coarse to fine optical flow estimator. |
optical_flow_tvl1¶
-
skimage.registration.
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'>)[source]¶ Coarse to fine optical flow estimator.
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. [R487], improved in [R488] and detailed in [R489].
Parameters: reference_image : ndarray, shape (M, N[, P[, …]])
The first gray scale image of the sequence.
moving_image : ndarray, shape (M, N[, P[, …]])
The second gray scale image of the sequence.
attachment : float
Attachment parameter (\(\lambda\) in [R487]). The smaller this parameter is, the smoother the returned result will be.
tightness : float
Tightness parameter (\(\tau\) in [R487]). It should have a small value in order to maintain attachement and regularization parts in correspondence.
num_warp : int
Number of times image1 is warped.
num_iter : int
Number of fixed point iteration.
tol : float
Tolerance used as stopping criterion based on the L² distance between two consecutive values of (u, v).
prefilter : bool
Whether to prefilter the estimated optical flow before each image warp. This helps to remove the potential outliers.
dtype : dtype
Output 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.
References
[R487] (1, 2, 3, 4) Zach, C., Pock, T., & Bischof, H. (2007, September). A duality based approach for realtime TV-L 1 optical flow. In Joint pattern recognition symposium (pp. 214-223). Springer, Berlin, Heidelberg. [R488] (1, 2) Wedel, A., Pock, T., Zach, C., Bischof, H., & Cremers, D. (2009). An improved algorithm for TV-L 1 optical flow. In Statistical and geometrical approaches to visual motion analysis (pp. 23-45). Springer, Berlin, Heidelberg. [R489] (1, 2) Pérez, J. S., Meinhardt-Llopis, E., & Facciolo, G. (2013). TV-L1 optical flow estimation. Image Processing On Line, 2013, 137-150. Examples
>>> from skimage.color import rgb2gray >>> from skimage.data import stereo_motorcycle >>> from skimage.registration import optical_flow_tvl1 >>> image0, image1, disp = stereo_motorcycle() >>> # --- Convert the images to gray level: color is not supported. >>> image0 = rgb2gray(image0) >>> image1 = rgb2gray(image1) >>> flow = optical_flow_tvl1(image1, image0)