How to find good optical flow parameters?#

Asynchronous topologies are not very convenient to look for the best parameters for a computation. It is better to use the optical flow work directly as in this example:

"""To be run in IPython to find a good set of parameters"""

from fluidimage.optical_flow import Work

params = Work.create_default_params()

params.mask.strcrop = "30:250, 50:350"

# params.features._print_doc()
params.features.maxCorners = 100000
params.features.qualityLevel = 0.05
params.features.blockSize = 20

# params.optical_flow._print_doc()
params.optical_flow.maxLevel = 2
params.optical_flow.winSize = (48, 48)

path = "../../image_samples/Oseen/Images"
# path = '../../image_samples/Karman/Images'
params.series.path = path
params.series.str_subset = "i+1:i+3"

work = Work(params=params)

piv = work.process_1_serie()

piv.display(scale=0.3, show_error=False)

The parameters in params.series are used to define an object fluiddyn.util.serieofarrays.SeriesOfArrays and to select one serie (which represents here a couple of images). It is also what is done internally in the topology. Have a look at our tutorial to discover how to use this powerful tool!