OpenPIV / openpiv-python

OpenPIV is an open source Particle Image Velocimetry analysis software written in Python and Cython
http://www.openpiv.net
GNU General Public License v3.0
233 stars 141 forks source link

Number of matched pairs per interrogation window #237

Closed BrouwersBart closed 2 years ago

BrouwersBart commented 2 years ago

Hi,

Ref: Raffel, M., Willert, C., Wereley, S., and Kompenhans, J. (2007). Particle Image Velocimetry: A Practical 546 Guide (2nd edition) (New York: Springer)

I use this book as a reference to study the principles of PIV. On the choice of interrogation window size it states:
QUOTE The choice for the final interrogation window size depends on the particle image density. Below a certain number of matched pairs in the interrogation area (typically NI < 4) the detection rate will decrease rapidly (see section 5.5.4). UNQUOTE

Is it possible in the OpenPIV script to get this amount of matched pairs per window as output?

Thanks in advance

alexlib commented 2 years ago

Hi @BrouwersBart it's possible if you define what are the matched pairs, i.e. you'll have to define a) image processing routine that defines what is an object and what is not b) matching routine that defines which are still inside the interrogation window and which are not

In PIV however, this is not done by careful check of each window, but rather by some statistics and a trial-and-error approach. When you take your images, you zoom into the size of the interrogation window, e.g. 32 x 32 pixels and try manually, by observation to see if there are enough pairs - playing with the image back and forth between frame A and frame B. Obviously, if the seeding is non-uniform - you'll get some places with a larger than needed number of particles and regions with less than needed. For that reason some suggest using multi-scale approaches, starting from large windows and after the first pass refining the size and repeating the analysis.

If you want to develop a branch that also adjusts the window size locally to the number of particles per window - it's possible, but I'm skeptical about its efficiency versus the brute-force multi-scale approach. In the homogeneous seeding cases, we play with the camera resolution, amount of seeding, size of the seeding material, laser intensity, etc.

alexlib commented 2 years ago

The uncertainty analysis is doing something related to this test - it deforms the image according to the vector field and compares the deformed frame A with frame B. The image disparity gives some measure of the number of matched pairs. Openpiv has now the uncertainty estimate, thanks to @lento234 but does not provide this as an output of the number of matched pairs.

lento234 commented 2 years ago

Hi @alexlib @BrouwersBart

Actually, the number of matched pairs $N$ is indeed calculated using the UQ :slightly_smiling_face:. See the tutorial openpiv/tutorials/openpiv_pivuq.ipynb. The output variable N is the number of peaks (i.e., the number of matched image pairs). If you make sure to use the same window size as for the PIV interrogation window, then there should be one-to-one correspondence. Note, for UQ a Gaussian windowing is used as default around a given pixel for ensembling the disparity. You can also choose a tophat window if you don't want Gaussian profile.

Hope this can help.