How to find good PIV parameters?#
Fluidimage is designed to process several images in parallel with asynchronous “topologies”. However, the asynchronous PIV topology is not very convenient to look for the best parameters for a PIV computation. It is better to use the PIV “work” directly as in these examples:
"""To be run in IPython to find a good set of parameters"""
from fluidimage.piv import Work
params = Work.create_default_params()
params.series.path = "../../image_samples/Oseen/Images"
params.mask.strcrop = "30:250, 40:"
params.piv0.shape_crop_im0 = 32
params.piv0.displacement_max = 7
params.fix.correl_min = 0.2
params.fix.threshold_diff_neighbour = 8
params.multipass.number = 2
params.multipass.use_tps = "last"
work = Work(params=params)
piv = work.process_1_serie()
# piv.display(show_interp=True, scale=0.3, show_error=True)
piv.display(show_interp=False, scale=1, show_error=True)
# piv.save()
The parameters in params.series
are used to define a
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 PIV topology. Have a look at
our tutorial
to discover how to use this powerful tool!
This other example includes a simple image-to-image preprocessing.
from fluidimage.image2image import apply_im2im_filter
from fluidimage.piv import Work
params = Work.create_default_params()
params.multipass.number = 2
params.multipass.use_tps = True
params.piv0.shape_crop_im0 = 32
params.piv0.displacement_max = 5
params.fix.correl_min = 0.2
params.fix.threshold_diff_neighbour = 8
params.mask.strcrop = "30:250, 100:"
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)
serie = work.get_serie()
# "image to image" filter
serie = apply_im2im_filter(serie, im2im="my_example_im2im.im2im")
piv = work.calcul(serie)
# piv.display(show_interp=True, scale=0.3, show_error=True)
piv.display(show_interp=False, scale=1, show_error=True)
# piv.save()