Scikit-Image
- class byotrack.implementation.optical_flow.skimage.SkimageOpticalFlow(method: Callable[[...], ndarray], downscale: float | ndarray = 2, blur: None | float | ndarray = None, parameters: Dict[str, Any] | None = None)
Bases:
OpticalFlowWraps Scikit-Image optical flow implementations
Usage:
import skimage.registration # Requires to install scikit image from byotrack.implementation.optical_flow.skimage import SkimageOpticalFlow # See the documentation of Scikit-Image for each algorithm to correctly set the parameters parameters = {} # ILK optflow = SkimageOpticalFlow(skimage.registration.optical_flow_ilk, parameters=parameters) # TVL1 optflow = SkimageOpticalFlow(skimage.registration.optical_flow_tvl1, parameters=parameters)
- method
The optical flow function from skimage. In skimage, only two currently exists: skimage.registration.optical_flow_ilk or skimage.registration.optical_flow_tvl1.
- Type:
Callable[Any, np.ndarray]
- compute(reference: ndarray, moving: ndarray) ndarray
Compute the optical flow map from reference to the moving frame
It computes the displacement of each pixel from the reference frame to be in the moving one.
- Parameters:
reference (np.ndarray) – Reference frame Shape: (H’, W’, C), dtype: float
moving (np.ndarray) – Moving frame Shape: (H’, W’, C), dtype: float
- Returns:
- Optical flow map from reference to moving
The pixel coordinates are stored as (i, j) (and not (x, y)), so is their displacement. Shape: (2, H’, W’), dtype: float32
- Return type:
np.ndarray