fluidimage.topologies.optical_flow#

Topology for optical flow (fluidimage.topologies.optical_flow)#

class fluidimage.topologies.optical_flow.TopologyOpticalFlow(params, logging_level='info', nb_max_workers=None)[source]#

Bases: TopologyPIV

Optical flow topology (Lukas Kanade method)

WorkVelocimetry#

alias of WorkOpticalFlow

classmethod create_default_params()[source]#

Class method returning the default parameters.

Typical usage:

params = TopologyOpticalFlow.create_default_params()
# modify parameters here
...

topo = TopologyOpticalFlow(params)

Documentation for params#

Documentation for params.saving#

Saving of the results.

  • path : None or str

    Path of the directory where the data will be saved. If None, the path is obtained from the input path and the parameter postfix.

  • how : str {‘ask’}

    ‘ask’, ‘new_dir’, ‘complete’ or ‘recompute’.

  • postfix : str

    Postfix from which the output file is computed.

Documentation for params.series#

Parameters indicating the input series of images.

  • path : str, {‘’}

    String indicating the input images (can be a full path towards an image file or a string given to glob).

  • str_subset : ‘pairs’

    String indicating as a Python slicing how couples of images are formed. There is one couple per value of i. The values of i are set with the other parameters ind_start, ind_step and ind_stop approximately with the function range (range(ind_start, ind_stop, ind_step)).

    Python slicing is a very powerful notation to define subset from a (possibly multidimensional) set of images. For a user, an alternative is to understand how Python slicing works. See for example this page: http://stackoverflow.com/questions/509211/explain-pythons-slice-notation.

    Another possibility is to follow simple examples:

    For single-frame images (im0, im1, im2, im3, …), we keep the default value ‘i:i+2’ to form the couples (im0, im1), (im1, im2), …

    To see what it gives, one can use IPython and range:

    >>> i = 0
    >>> list(range(10))[i:i+2]
    [0, 1]
    
    >>> list(range(10))[i:i+4:2]
    [0, 2]
    

    We see that we can also use the value ‘i:i+4:2’ to form the couples (im0, im2), (im1, im3), …

    For double-frame images (im1a, im1b, im2a, im2b, …) you can write

    >>> params.series.str_subset = 'i, 0:2'
    

    In this case, the first couple will be (im1a, im1b).

    To get the first couple (im1a, im1a), we would have to write

    >>> params.series.str_subset = 'i:i+2, 0'
    
  • ind_start : int, {‘first’}

  • ind_step : int, {1}

  • int_stop : None

Documentation for params.optical_flow#

Parameters for the flow calculation using Lukas Kanade method

See https://docs.opencv.org/3.0-beta/modules/video/doc/motion_analysis_and_object_tracking.html

The algorithm is “pyramidal” (multiple passes).

  • winSize :

    Size of the search window at each pyramid level.

  • maxLevel :

    0-based maximal pyramid level number; if set to 0, pyramids are not used (single level), if set to 1, two levels are used, and so on; if pyramids are passed to input then algorithm will use as many levels as pyramids have but no more than maxLevel.

  • criteria :

    Termination criteria of the iterative search algorithm (after the specified maximum number of iterations criteria.maxCount or when the search window moves by less than criteria.epsilon.

Documentation for params.features#

Parameters for the Good Feature to Track algorithm (Shi-Tomasi Corner Detector)

See https://docs.opencv.org/3.0-beta/modules/imgproc/doc/feature_detection.html#goodfeaturestotrack

  • maxCorners :

    Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned.

  • qualityLevel :

    Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue or the Harris function response. The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than 15 are rejected.

  • minDistance :

    Minimum possible Euclidean distance between the returned corners.

  • blockSize :

    Size of an average block for computing a derivative covariation matrix over each pixel neighborhood.

Documentation for params.mask#

Parameters describing how images are masked.

  • strcrop : None, str

    Two-dimensional slice (for example ‘100:600, :’). If None, the whole image is used.

Documentation for params.filters#

Parameters indicating how are detected and processed false vectors.

  • threshold_diff_ab_ba : 1.

    ???

  • displacement_min : None

    Vectors smaller than displacement_min are considered as false vectors.

  • displacement_max : None

    Vectors larger than displacement_max are considered as false vectors.

Documentation for params.preproc#

  • im2im : str {None}

    Function or class to be used to process the images.

  • args_init : object {None}

    An argument given to the init function of the class used to process the images.

Classes

Topology

alias of TopologyOpticalFlow

TopologyOpticalFlow(params[, logging_level, ...])

Optical flow topology (Lukas Kanade method)