1 Introduction

Cross-correlation is by far the most common statistical operator to evaluate tracer displacements in particle image velocimetry (PIV) because of its robustness and computational efficiency when implemented as a sequence of Fourier transforms. By relating the single velocity vector for each interrogation window to the dominant correlation peak, cross-correlation is know to return only a low-pass filtered representation of the underlying flow field in that flow scales smaller than the interrogation windows cannot be retrieved. This in turn affects the spatial resolution (e.g. Spencer and Hollis 2005; Lavoie et al. 2007; Kähler et al. 2012), for which reason many studies have been devoted in overcoming this drawback by improving the involved image analysis processes through, among others, windowing functions (e.g. Nogueira et al. 2005; Astarita 2007; Schrijer and Scarano 2008), alteration of the interrogation area (e.g. Scarano 2003; Di Florio et al. 2002), accounting of multiple correlation peaks (e.g. Masullo and Theunissen 2018) or even adaptive window placement and sizing (e.g. Theunissen et al. 2007).

Although the response of cross-correlation is pivotal in the estimation of PIV uncertainty (Sciacchitano et al. 2015) and the extraction of flow statistics (Liberzon et al. 2012), the inherent cross-correlation response has been the focus of relatively few studies. Many uncertainty analyses consider the variation in obtained displacement estimates, for example, but do not reflect how well the velocity vector represents the underlying flow field. While analytical descriptors of the correlation’s transfer function have been documented, these were limited to simplistic cases such as uniform flow (Keane and Adrian 1992), shear and strain flow (Westerweel 2008) and sinusoidal displacements (Theunissen 2012). For more general synthetic flows, such analyses are typically limited to Monte-Carlo simulations, whereby numerous PIV images are generated either on the basis of numerical simulations or available mathematical definitions (e.g Lecordier et al. 2001; Lecordier and Westerweel 2004), or through dedicated experiments mimicking the flow condition of interest (e.g. Rahgozar et al. 2013).

Monte-Carlo simulations offer the benefit of yielding systematic errors and quantifying random errors. However, these random errors are, besides the underlying displacement distribution, dependent on seeding density, particle image diameter, etc. In particle image velocimetry flow fields are sampled at tracer locations. The distribution of particles captured in each instantaneous PIV recording will thus constitute only one of many possible realisations. An example is the appearance of so-called peak splitting (Jimenez et al. 2016). This causes the retrieved (instantaneous) cross-correlation map, and consequently also the resulting displacement vector, at each interrogation location to vary even when the flow field remains unchanged. To obtain a statistically meaningful displacement estimate, a large number of PIV recordings are, therefore, required to allow the averaging process to converge and minimise the associated uncertainty. This makes it less straightforward in Monte-Carlo simulations to decouple the effect of altering tracer patterns or image noise from purely the inherent cross-correlation response.

In this work, a methodology is described to obtain an invariant ensemble cross-correlation map for a given constant flow field, linked solely to the underlying displacement field. The approach involves solving the mathematical representation of PIV image cross-correlation without the need of Monte-Carlo simulations, bypassing the associated ambiguities. To this extent, the paper starts by recapitulating the correlation theory set out in Adrian (1988) and Westerweel (2008). The concept of Kernel density estimation (KDE) to retrieve the probability density of captured displacements is elaborated in Sect. 3 and implemented in Sect. 4. Digitization is addressed in Sect. 5 where incorporation of iterative image deformation is discussed. Finally, a numerical assessment corroborates the applicability of the method to replicate ensemble correlation maps.

It should be noted that the objective will not be to discourage the use of Monte-Carlo simulations, but to present a more efficient process for the general evaluation of the displacement modulation characterising cross-correlation. Besides providing a better understanding of cross-correlation responses, the methodology will be extremely suited to obtain the resulting (ensemble-averaged) velocity field if PIV were to be used to measure the flow field predicted with steady CFD simulations (e.g. RANS); assuming the CFD result is an accurate representation of the real flow, even in the absence of experimental errors, the non-linear behaviour of cross-correlation will yield a filtered analogue causing the numerical and PIV velocity fields to differ. A-priori filtering of the CFD data enables discrepancies between numerical and empirical PIV data to be attributed to misconceptions in the actual simulations or due to the mere correlation-inherent filtering, allowing an improved validation of CFD codes.

2 Spatial cross-correlation statistics

The point of departure is the equation of the ensemble mean of the continuous spatial correlation reported in Adrian (1988) and Westerweel (2008), where it is assumed that (1) the camera’s optical axis and light sheet are orthogonal, (2) the light sheet intensity varies only along the out-of-plane direction, (3) laser sheets belonging to different laser pulses remain in the same plane and (4) the laser sheet thickness \(d_z\) is smaller than the depth-of-focus such that all illuminated tracers are in focus. These assumptions do not restrict the generality of the equation, but are reflective of good experimental practice. Contrary to the original works, the current authors will allow particle image diameters to vary in the following:

$$\begin{aligned} \begin{aligned} \left\langle R_{\text{ D }}(\mathbf {s}) | \mathbf {u} \right\rangle = \,& K \int _\mathbf {x} W_1(\mathbf {x})W_2(\mathbf {x}+\mathbf {s}) \\&\times \int _\mathbf {x'} \int _\mathbf {x''} \left\langle I_{z1}I_{z2} \tau _o(\mathbf {x}-\mathbf {x'})\tau _o(\mathbf {x}+\mathbf {s}-\mathbf {x''}) \right\rangle \\&\times \int _{Z'}\int _{Z''} I_{o1}(Z')I_{o2}(Z'') \\&\times \left\langle C_1'(x',y',Z') C_2'(x'',y'',Z'') | \mathbf {u} \right\rangle \\&\times \mathrm{{d}}Z'' \mathrm{{d}}Z' \mathrm{{d}}\mathbf {x''} \mathrm{{d}}\mathbf {x'} \mathrm{{d}}\mathbf {x}. \end{aligned} \end{aligned}$$
(1)

\(\left\langle R_\mathrm{{D}}(\mathbf {s}) |\mathbf {u} \right\rangle\) is the displacement correlation and represents the conditional ensemble average of the correlation of fluctuating image intensities subject to the flow field \(\mathbf {u}(\mathbf {X},t)=(u,v,w)(\mathbf {X},t)\).Footnote 1 This velocity field is expressed in terms of the spatial coordinates in the flow domain \(\mathbf {X}=(X,Y,Z)\) and is known from, e.g., CFD simulations. In the ensemble averaging process, the flow field remains fixed while considering variations in tracer patterns \(C_1'\) and \(C_2'\). The tracer patterns are projected onto the image domain, which is defined by the spatial coordinates \(\mathbf {x}=(x,y)\). In line with good experimental practice, light sheets have been assumed to be sufficiently thin such that imaging can be considered to be paraxial and the projection of the tracer pattern only involves an integration along the out-of-plane direction Z. The magnification M will then be a constant (\(x=MX\) and \(y=MY\)) and the displacement field (defined in the planar image domain) \({\varvec{\Delta }}(\mathbf {x})=(\varDelta _x,\varDelta _y)(\mathbf {x})\) is a scaled projection of the flow field onto the image plane.

The displacement component along, e.g., the x-direction is defined by each tracer’s location along its respective path \(\varDelta _x(\mathbf {x})=M\int _{t'}^{t'+\delta t} u(\mathbf {X},t) \mathrm{{d}}t\) . For ideal tracers the particle velocities will be identical to the fluid velocity. Because tracer diameters are typically in the order of \(1\,\upmu \mathrm{{m}}\), the solid volume fraction (ratio between volume of particles and gas) in PIV is much lower than \(10^{-5}\) permitting the effect of the tracers on the flow turbulence to be neglected (Elghobashi 1994). The effect of inertial tracers can then be appropriately simulated in the majority of CFD packages through one-way coupled particle dispersion (Greifzu et al. 2016). As per Adrian (1988) \(\varDelta _x(\mathbf {x})\simeq Mu(\mathbf {X},t)\delta t\) provided u can be considered to remain constant over the laser pulse separation \(\delta t\), which is satisfied by proper choice of \(\delta t\). In a similar manner, \(\varDelta _y(\mathbf {x})\simeq Mv(\mathbf {X})\delta t\) and the tracers’ displacement normal to the laser sheet (out-of-plane) \(\varDelta _Z(\mathbf {x})\simeq \varDelta _Z(M\mathbf {X})=w(\mathbf {X})\delta t\).

In Eq. 1, K is a proportionality constant dependent on M, and \(W_k\) defines the extents of the interrogation window centred on \(\mathbf {x}_k\). \(I_{ok}(Z)\) refers to illumination intensity profile, which is commonly Gaussian shaped and, based on the second assumption, only a function of Z; \(I_{ok}(Z)=\exp (-8Z^2/d_z^2)\). The thickness of the light sheet \(d_z\) corresponds to the \(e^{-2}\) width of the profile.

The peak intensity \(I_{zk}\) refers to the light intensity scattered by the particles and is for common PIV applications independent of the particle size. Physical particle sizes in PIV applications are typically larger than the laser wavelength (\(d_p/\lambda>1\)), making the scattered light intensity \(I_T\) proportional to \(d_p^2\). The total intensity captured by the camera sensor for a single particle image is given by \(\iint I_{zk}\tau _o(\mathbf {x})\mathrm{{d}}\mathbf {x}=2\pi I_{zk}\int _{r=0}^{\infty }\tau _o(r)r \mathrm{{d}}r=I_{zk}(\alpha d_{\tau })^2=I_T \propto d_p^2.\) With \(d_{\tau }^2=M^2d_p^2+d_s^2\) and the diffraction-limited spot diameter \(d_s=2.44(1+M)f_{\#}\lambda\), it follows that the image intensity \(I_{zk}\) is nearly independent of the particle diameter (Raffel et al. 2018). When applying fluorescent particles \(I_T \propto d_p^3\) and, therefore, \(I_{zk}\propto d_p\), in which case the particle diameter can be considered (Appendix 1). Observe that because of the proper camera alignment (cf. assumption 1) the lens’ transfer function, and accordingly \(d_s\), remains constant across the spatial image coordinate and also along the out-of-plane coordinate (cf. assumption 4).

The normalised particle image intensity distribution is defined by \(\tau _o\), which can also be appropriately modelled by a Gaussian (Olsen and Adrian 2001); \(\tau _o(\mathbf {x})=exp(-\mathbf {x}^2(\alpha d_\tau )^{-2})\) with \(\alpha ^{-1}=2\,\root \of {3.67}\) and corresponding \(e^{-1/2}\) and \(e^{-2}\) widths of approximately \(0.36 d_\tau\) and \(0.74 d_\tau\), respectively. The conditional space–time correlation of the fluctuating tracer patterns is given as (Adrian 1988; Westerweel 1997)

$$\begin{aligned} \begin{aligned} \left\langle C_1'(\mathbf {x'},Z')C_2'(\mathbf {x''},Z'') | \mathbf {u} \right\rangle&= \delta \left( \mathbf {x''}-\mathbf {x'}-{\varvec{\Delta }}(\mathbf {x'},Z')\right) \\&\quad \times \delta \left( Z''-Z'-\varDelta _Z(\mathbf {x'},Z')\right) . \end{aligned} \end{aligned}$$
(2)

After introducing the intensity-weighted particle image self-correlation \(F_{\tau }(\mathbf {s})=\int I_{z1}I_{z2}\tau _o(\mathbf {x})\tau _o(\mathbf {x}+\mathbf {s}) \mathrm{{d}}\mathbf {x}\) and performing the integrations, Eq. 1 becomesFootnote 2

$$\begin{aligned} \begin{aligned} \left\langle R_\mathrm{{D}}(\mathbf {s}) | {\varvec{\Delta }}(\mathbf {x}) \right\rangle = \,& K \int _{\mathbf {s'}} \left\langle F_{\tau }(\mathbf {s}-\mathbf {s'}) \right\rangle \int _\mathbf {x} W_1(\mathbf {x})W_2(\mathbf {x}+\mathbf {s'}) \\&\times \int _{Z'} \exp \left( -8\frac{(Z')^2 + (Z'+\varDelta _Z(\mathbf {x},Z'))^2}{2d_z^2}\right) \\&\times \delta \left( \mathbf {s'}-{\varvec{\Delta }}(\mathbf {x},Z')\right) \mathrm{{d}}Z' \mathrm{{d}}\mathbf {x} \mathrm{{d}}\mathbf {s'}. \\ \end{aligned} \end{aligned}$$
(3)

Because of the thinness of the light sheets the dependency of displacements on the Z-coordinate can be neglected (see also Sect. 5.4). The last \(\delta\) term in Eq. 3 can then be excluded from the integration over \(Z'\) yielding

$$\begin{aligned} \begin{aligned} \left\langle R_\mathrm{{D}}(\mathbf {s}) | {\varvec{\Delta }}(\mathbf {x}) \right\rangle & = K' \int _{\mathbf {s'}} \left\langle F_{\tau }(\mathbf {s}-\mathbf {s'}) \right\rangle \\ & \quad \times \int _\mathbf {x} W_1(\mathbf {x})W_2(\mathbf {x}+\mathbf {s'}) \exp (-4\varDelta _Z(\mathbf {x})^2/d_z^2) \delta \left( \mathbf {s'}-{\varvec{\Delta }}(\mathbf {x})\right) \mathrm{{d}}\mathbf {x} \mathrm{{d}}\mathbf {s'}. \end{aligned} \end{aligned}$$
(4)

The contribution of the integration along \(Z'\) has been incorporated in \(K'\). A similar form of this equation was presented in Westerweel (2008) albeit currently it is not assumed that all particles have the same image diameter. Instead an ensemble average of the particle image self-correlation has been introduced. The first remaining integration involves a convolution between the ensemble average particle image self-correlation \(\left\langle F_\tau \right\rangle\), which is approximated by \(\exp (-0.5\mathbf {s}^2(\alpha d_\tau ^*)^{-2})\), and the displacement distribution. Variable \(d_\tau ^*\) is a representative particle image diameter dictated by the point-spread function of the imaging lens, and remains invariant with \(\mathbf {x}\). Particle image diameters can still vary across each instantaneous snapshot. From a statistical perspective, it is only assumed that each particle image diameter is drawn from the same unique probability density distribution with a mean equal to \(d_\tau\) (not \(d_\tau ^*\)). Details regarding the derivation of \(d_\tau ^*\) for different particle image diameter probability distributions are provided in Appendix 1.

The integral over \(\mathbf {x}\) in Eq. 4 represents a weighted form of the displacement distribution \(F_{\varDelta ,w}\) defined by all possible realisations of the displacement field. In Soria and Willert (2012), this is referred to as the joint probability density function of the three-dimensional velocity field. While each realisation of the displacement field normally has equal importance, an exponential weighting is introduced depending on the local out-of-plane motion \(\varDelta _z\). This considers the change in the particle images’ intensity between snapshots as brighter particles will yield a higher contribution to the correlation map (Nobach and Bodenschatz 2009).

The weighting functions \(W_i\) can be written as a multiplication between a top-hat \(T_i\) and intensity weighting \(P_i\). Independent of the adopted weighting, both are merely functions of the image coordinates \(\mathbf {x}\). Accordingly, \(T_1(\mathbf {x})\) will define the interrogation area extents, whereas \(T_2({\mathbf {x}+\mathbf {s'}})\) factors in the in-plane loss of particle images. Interrogation areas (read \(T_i\)) are typically rectangular in shape with respective sizes \(\mathbf {W}_{\mathbf {S}}=(W_{S,x},W_{S,y})\). Recalling that \(\mathbf {x}_{\mathbf {k}}\) denotes the centre of the correlation window, the integrand thus provides a contribution only when

$$\begin{aligned} |\mathbf {x}+\varvec{\Delta }(\mathbf {x})-\mathbf {x}_{\mathbf {k}}|\le \frac{\mathbf {W}_{\mathbf {S}}}{2}\equiv {\left\{ \begin{array}{ll} |x+\varDelta _x(\mathbf {x})-x_k|\le \frac{W_{S,x}}{2} \\ |y+\varDelta _y(\mathbf {x})-y_k|\le \frac{W_{S,y}}{2}. \end{array}\right. } \end{aligned}$$
(5)

3 Displacement density estimation

The displacement distribution function \(F_{\varDelta ,w}\) is generally unknown. However, when dealing with analytical velocity fields or CFD data, velocity data (and, therefore, displacement vectors) can be obtained at any spatial location. The second integral in Eq. 4 can at first be approximated by constructing a weighted histogram from N samples of the displacement components \(((\varDelta _x)_i,(\varDelta _y)_i,(\varDelta _z)_i)\) taken at locations \((x,y)_i\), with \(i=1,\ldots ,N\). Weighted histograms are constructed by adding to each bin, the sample’s weight, which currently is defined by the out-of-plane motion \(\varDelta _Z\) and the intensity weighting defined by the sample’s initial (\(P_1(\mathbf {x})\)) and final location (\(P_2(\mathbf {x}+{\varvec{\Delta }}(\mathbf {x})\)). This can be improved to a weighted, continuous, kernel density estimate (Wang and Wang 2007) using continuous kernels G; selecting only the n (with \(n\le N\)) measurable displacement combinations as per Eq. 5, \(F_{\varDelta ,w}\) can be approximated by

$$\begin{aligned} \begin{aligned}&F_{\varDelta ,w}\approx f(\mathbf {s})=K_F\sum _{i=1}^{n} \frac{w_i^2}{h_x(n)h_y(n)} G\left( \frac{s-(\varDelta _x)_i}{h_x(n)}\right) G\left( \frac{r-(\varDelta _y)_i}{h_y(n)}\right) \\&\quad \text{ with } \quad w_i=\frac{\tilde{w_i}}{\sum _{j}^{n}\tilde{w_j}} \quad \text{ and } \quad \tilde{w_i}=P_1(\mathbf {x}_{\mathbf {i}})P_2(\mathbf {x}_{\mathbf {i}}+{{\varvec{\Delta }}(\mathbf {x}_\mathbf {i})})\exp (-2(\varDelta _Z)_i^2/d_z^2). \end{aligned} \end{aligned}$$
(6)

The scaling constant \(K_F\) is introduced to ensure \(\int _{\mathbf {s}}f(\mathbf {s})\mathrm{{d}}\mathbf {s}\equiv 1\), i.e. \(K_F=\left( \sum w_i^2\right) ^{-1}\). The kernel G is commonly chosen to have a unimodal shape centred on zero. While the Epanechnikov kernel yields the lowest mean-square error (Epanechnikov 1968), the popular Gaussian kernel will be shown to be more convenient;

$$\begin{aligned} G(s)=\frac{1}{\root \of {2\pi }} \exp \left( -\frac{s^2}{2}\right) . \end{aligned}$$
(7)

The bandwidths \(h_x(n)\) and \(h_y(n)\) are smoothing parameters which are more influential than the choice of kernel and must be chosen appropriately. Each bandwidth is solely dependent on the displacement samples \({\varvec{\Delta }}_i\) and is defined as \(h(n)=0.9\min (\sigma _w,\mathrm{{IQR}}_w/1.34)n^{-1/5}\) (Sheather 2004) where \(\sigma _w\) and \(\mathrm{{IQR}}_w\) are the standard deviation and inter-quartile range of the weighted (viz. Eq. 6) displacement samples;

$$\begin{aligned} \sigma _w^2= & {} \sum _i^n w_i\xi _i^2 - \left( \sum _i^n w_i\xi _i\right) ^2, \end{aligned}$$
(8)
$$\begin{aligned} \mathrm{{IQR}}_w&= {} (\xi ^s_{q_2} - \xi ^s_{q_1}) + (0.75-t_2)(\xi ^s_{q_2+1}-\xi ^s_{q_2}) - (0.25-t_1)(\xi ^s_{q_1+1}-\xi ^s_{q_1}) \nonumber \\&\text{ with } \quad t_1 =\sum _{i=1}^{q_1} w_i \quad \text{ and } \quad t_2=\sum _{i=1}^{q_2} w_i, \end{aligned}$$
(9)

where \(\xi _i=(\varDelta _x)_i\) or \((\varDelta _y)_i\), \(\xi _i^s\) signifies the \(i{\text{th}}\) element in the collection of sorted samples and (integer) indices \(q_1\) and \(q_2\) are selected such that \(t_1 \le 0.25\), \(\sum _{i=1}^{1+q_1} w_i> 0.25\), \(t_2\le 0.75\) and \(\sum _{i=1}^{1+q_2} w_i> 0.75\).

4 Correlation approximation

4.1 Continuous image cross-correlation

Having obtained an analytical approximant for the inner integral and combined with the expression for the particle image self-correlation, Eq. 4 can be simplified to involve a mere summation of convolutions between Gaussian functions;

$$\begin{aligned} \begin{aligned} \left\langle R_\mathrm{{D}}(\mathbf {s}) | {\varvec{\Delta }} \right\rangle \approx \tilde{R}_\mathrm{{D}}(\mathbf {s}) = \frac{K''}{2\pi h_x h_y} \sum _{i=1}^n w_i^2 \exp \left( -\frac{1}{2}\frac{(\mathbf {s}-({\varvec{\Delta }})_i)^2}{h^2(n)+(\alpha d_{\tau }^*)^2}\right) . \end{aligned} \end{aligned}$$
(10)

This expression, in which all constants originating from the convolution are integrated in \(K''\), allows a simplistic numerical evaluation to obtain the correlation function and is only feasible because the Gaussian kernel (Eq. 7) was selected.

The bias error in the approximated correlation map \(\tilde{R}_\mathrm{{D}}(\mathbf {s})\) is given as (the derivation is included in Appendix 2)

$$\begin{aligned} \begin{aligned} \mathbf {E}(\tilde{R}_\mathrm{{D}}(\mathbf {s}) - \left\langle R_\mathrm{{D}}(\mathbf {s}) | {\varvec{\Delta }} \right\rangle )&= \mathbf {E}(\left\langle F_\tau (\mathbf {s}) \right\rangle * f(\mathbf {s}) - \left\langle F_\tau (\mathbf {s}) \right\rangle * F_{\varDelta ,w}(\mathbf {s})) \\&= \left\langle F_\tau (\mathbf {s}) \right\rangle * \mathbf {E}(f(\mathbf {s})-F_{\varDelta ,w}(\mathbf {s})) \\&\simeq \left\langle F_\tau (\mathbf {s}) \right\rangle * \frac{1}{2} \left( h_x^2 \frac{\partial ^2 F_{\varDelta ,w}}{\partial s^2} + h_y^2 \frac{\partial ^2 F_{\varDelta ,w}}{\partial r^2}\right) \\&\simeq \frac{1}{2} \left( h_x^2 \frac{\partial ^2 \left\langle R_D(\mathbf {s}) | {\varvec{\Delta }} \right\rangle }{\partial s^2} + h_y^2 \frac{\partial ^2 \left\langle R_D(\mathbf {s}) | {\varvec{\Delta }} \right\rangle }{\partial r^2} \right) , \end{aligned} \end{aligned}$$
(11)

where \(*\) signifies the convolution operation and in the final step use has been made of the identity \(\partial (f*g)/\partial s=f*\partial g/\partial s\). According Eq. 11, the systematic error will be proportional to the local second-order gradients in the correlation map whereby strongly curved density functions are over-smoothed by the kernel density estimate and, therefore, underestimated (at a correlation peak, for example, \(\partial ^2\left\langle R_\mathrm{{D}} \right\rangle /\partial s^2=\left\langle R_\mathrm{{D}} \right\rangle ''<0\)). However, as asserted by a one-dimensional simulation of which the outcome is depicted in Fig. 1, relative errors are only of importance for highly skewed distributions. With the correlation map having a variance \(\sigma\) of at least the particle image diameter, sufficiently small bandwidths \(h\sim \mathcal {O}(10^{-2})\) will render the general error term \(\frac{h^2}{2}\left\langle R_\mathrm{{D}} \right\rangle ''\) negligible. To this extent, the bandwidths calculated in paragraph 3 are further scaled down by a factor 10, which is permitted since the number of samples collected will be sufficiently large [\(N\sim \mathcal {O}(10^4-10^5)\)] to render a representative displacement distribution.

Fig. 1
figure 1

Evolution in the relative correlation peak curvature (\(\left\langle R_\mathrm{{D}} \right\rangle ''=\frac{\mathrm{{d}}^2 \left\langle R_\mathrm{{D}}(s) \right\rangle }{\mathrm{{d}}s^2}\)) at the peak location (\(x_{\mathrm{{pk}}}\)) with varying skewness \(\gamma\) and correlation width \(\sigma\), assuming a 1D skew normal distribution for the correlation map; \(\left\langle R_\mathrm{{D}}(s) \right\rangle =\frac{1}{\sigma } \exp \left( \frac{(s-x_{\mathrm{{pk}}})^2}{2\sigma ^2}\right) \left( 1+{{\mathrm{erf}}}\left( \frac{\kappa (s-x_{\mathrm{{pk}}})}{\root \of {2}\sigma }\right) \right)\) with skewness \(\gamma =(4-\pi )\root \of {2}\kappa ^3 (\pi +(\pi -2)\kappa ^2)^{-3/2}\)

4.2 Spectral filtering

With the aim of improving correlation robustness to image noise, spectral filters can be applied of which the symmetric phase-only filter [SPOF; Wernet (2005)] and phase transform [PHAT; Eckstein et al. (2008)] are the most common. Denoting the mean subtracted image intensities of successive snapshots as \(I_1'\) and \(I_2'\), respectively, the filtered correlation is defined as \(\left\langle R_\mathrm{{D}}^*(\mathbf {s}) | {\varvec{\Delta }} \right\rangle = \mathcal {F}^{-1}\left( \frac{\mathcal {F}(I_1')\mathcal {F}(I_2'^c)}{|\mathcal {F}(I_1')\mathcal {F}(I_2'^c)|^{\epsilon }}\right)\), where \(\mathcal {F}\) symbolises the Fourier transform, the notation \((\cdot )^c\) refers to the complex conjugate and \(\epsilon =1\) in case of PHAT and \(\epsilon =\frac{1}{2}\) for SPOF. In a similar manner, \(\mathcal {F}(\tilde{R}_\mathrm{{D}}^*(\mathbf {s}))(\mathbf {k}) = \frac{\mathcal {F}(\tilde{R}_\mathrm{{D}}(\mathbf {s}))}{|\mathcal {F}(\tilde{R}_\mathrm{{D}}(\mathbf {s}))|^{\epsilon }}\). With \(\tilde{R}_\mathrm{{D}}\) being a sum of weighted Gaussian functions, the normalisation complicates the transform (Appendix 3) and does not lend itself to obtaining a simplified expression for \(\left\langle R_\mathrm{{D}}^*(\mathbf {s}) | {\varvec{\Delta }} \right\rangle\). Instead, the inverse Fourier transform will need to be numerically evaluated and for this reason spectral filtering is left out of consideration hereafter.

5 Digital image cross-correlation

5.1 Analytical expression for digital correlation

The expression for the ensemble-averaged displacement correlation derived thus far considers continuous images. Digital camera sensors are, however, discrete, necessitating the introduction of two additional operators related to pixelisation and discretization. This translates into an additional convolution with the transfer function \(\phi (\mathbf {x})=\varLambda (x/\root \of {p_f})\varLambda (y/\root \of {p_f})\) of a pixel and sampling at integer pixel shifts \(\mathbf {s_p}\) (Theunissen 2012). With \(p_f\) symbolising the pixel fill factor, the triangular function \(\varLambda (x/\root \of {p_f})\) is defined as \(1-|x/\root \of {p_f}|\) for \(|x|\le \root \of {p_f}\) and zero elsewhere.

$$\begin{aligned} \begin{aligned} \left\langle R_\mathrm{{D}}(\mathbf {s_p}) | {\varvec{\Delta }} \right\rangle&= \int _{{\varvec{\xi }}} \delta ({\varvec{\xi }}-\mathbf {s_p}) \int _{\mathbf {s}} \left\langle R_\mathrm{{D}}(\mathbf {s}) | {\varvec{\Delta }} \right\rangle \phi ({\varvec{\xi }}-\mathbf {s}) \mathrm{{d}}\mathbf {s}\mathrm{{d}}{\varvec{\xi }} \\&= \int _{\mathbf {s}} \left\langle R_\mathrm{{D}}(\mathbf {s}) | {\varvec{\Delta }} \right\rangle \phi (\mathbf {s_p}-\mathbf {s}) \mathrm{{d}}\mathbf {s}. \end{aligned} \end{aligned}$$
(12)

Substitution of Eqs. 4, 6 and 7 in Eq. 12 together with the definition of the pixel transfer function \(\phi\) and particle image self-correlation \(\left\langle F_{\tau } \right\rangle\), the discrete correlation map can be written out as

$$\begin{aligned} \begin{aligned} \left\langle R_\mathrm{{D}}(\mathbf {s_p}) | {\varvec{\Delta }} \right\rangle \approx \tilde{R}_\mathrm{{D}}(\mathbf {s_p}) & = K' \sum _{i=1}^n \frac{w_i^2}{2nh_x(n)h_y(n)\pi } \\ & \quad \times \int _{s} \varLambda \left( \frac{s_p-s}{\root \of {p_f}}\right) \exp \left( -\frac{1}{2}\frac{(s-(\varDelta _x)_i)^2}{h_x^2(n)+(\alpha d_{\tau }^*)^2}\right) \mathrm{{d}}s \\ & \quad \times \int _{r} \varLambda \left( \frac{r_p-r}{\root \of {p_f}}\right) \exp \left( -\frac{1}{2}\frac{(r-(\varDelta _y)_i)^2}{h_y^2(n)+(\alpha d_{\tau }^*)^2}\right) \mathrm{{d}}r. \end{aligned} \end{aligned}$$
(13)

Because it is the relative peak amplitudes in \(\left\langle R_\mathrm{{D}}(\mathbf {s_p}) | {\varvec{\Delta }} \right\rangle\) that are of importance, all integration constants have been combined into \(K'\).

After several algebraic operations utilsing the expressions for \(\varLambda (\cdot )\), the correlation map amplitude for the shift \((s_p,r_p)\) related to digital images is given by

$$\begin{aligned} \tilde{R}_\mathrm{{D}}(\mathbf {s_p}) = K'' \sum _{i=1}^{n} w_i^2 \varOmega \left( s_p,(\varDelta _x)_i,h_x(n)\right) \varOmega \left( r_p,(\varDelta _y)_i,h_y(n)\right) , \end{aligned}$$
(14)

where

$$\begin{aligned} \begin{aligned} \varOmega (\xi ,\varDelta ,h) = \, &\root \of {\frac{\pi }{2}} \Big [ \Big ( {{\mathrm{erf}}}(\xi _3)-{{\mathrm{erf}}}(\xi _1) \Big ) + \frac{\xi -\varDelta }{\root \of {p_f}} \Big ( 2{{\mathrm{erf}}}(\xi _2)-{{\mathrm{erf}}}(\xi _1)-{{\mathrm{erf}}}(\xi _3) \Big ) \Big ] \\&+ \frac{\root \of {h^2+(\alpha d_{\tau }^*)^2}}{\root \of {p_f}} \Big [ 2\exp (-\xi _2^2)-\exp (-\xi _1^2)-\exp (-\xi _3^2) \Big ], \end{aligned} \end{aligned}$$
(15)

and

$$\begin{aligned} \xi _1 =\frac{\xi +\root \of {p_f}-\varDelta }{\root \of {2} \, \root \of {h^2+(\alpha d_{\tau }^*)^2}}, \, \xi _2 =\frac{\xi -\varDelta }{\root \of {2} \, \root \of {h^2+(\alpha d_{\tau }^*)^2}}, \, \xi _3 =\frac{\xi -\root \of {p_f}-\varDelta }{\root \of {2} \, \root \of {h^2+(\alpha d_{\tau }^*)^2}}. \end{aligned}$$
(16)

To recapitulate, Eqs. 1416 provide a semi-analytical equation of the ensemble-averaged correlation map for a time-invariant displacement field \({\varvec{\Delta }}\). Out-of-focus effects are neglected and particle images are considered to be Gaussian shaped as per typical PIV conditions. Laser light sheets are assumed to be spatially coincident and oriented orthogonally to the camera’s optical axis with normal varying intensity only along this axis. Sheet thicknesses are presumed sufficiently small to warrant a constant magnification and to ensure that the out-of-plane motion varies only normal to the camera’s optical axis. These conditions are all in line with good experimental practice. Generality is ensured by accounting for varying particle image diameters and correlation window intensity weighting through the representative particle image diameter \(d_{\tau }^*\) and kernel weighting \(w_i\), cf. Appendix 1 and Eq. 6, respectively.

5.2 Systematic error

Akin to conventional correlation maps, the resulting ensemble correlation \(\tilde{R}_\mathrm{{D}}(\mathbf {s_p})\) will be discrete and sub-pixel accuracy is conventionally achieved by Gaussian interpolation. Systematic errors are thus introduced by interpolation (i.e. fitting) inaccuracies, which are dependent on asymmetry in the correlation map. Simultaneously, the bias error in the correlation map was shown to be proportional to the local second-order gradients (Eq. 11) and this is again expected to influence the displacement estimates.

To estimate the bias effect on the retrieved displacement, a similar procedure as per Westerweel (1993) has been adopted. Hereafter, only the s-component will be dealt with as the procedure is identical for the r-component. The asymmetry in the correlation values at the integer displacement locations centred on the correlation peak [assumed to be located at \((s_p,r_p)=(0,0)\)] for imposed fractional displacements \(\mu\) is incorporated by modelling the discrete correlation peak as \(\left\langle R_\mathrm{{D}}(s_p=-1) \right\rangle =a_I^{1+\mu }\), \(\left\langle R_\mathrm{{D}}(s_p=0) \right\rangle =a_I^{|\mu |}\) and \(\left\langle R_\mathrm{{D}}(s_p=+1) \right\rangle =a_I^{1-\mu }\) with \(a_I=\exp (-0.5a^{-2})\). To obtain derivatives, in the vicinity of the fractional displacement \(\mu\) this discrete correlation map \(\left\langle R_\mathrm{{D}}(s_p) \right\rangle\) is presumed to be Gaussian shaped,Footnote 3 \(K\exp (-(s_p-\mu )^2/2a^2)\), enabling an explicit expression for the second derivatives; \(\frac{d^2 \left\langle R_\mathrm{{D}}(s_p)\right\rangle }{d s_p^2}=\left\langle R_\mathrm{{D}}(s_p) \right\rangle ''=\left\langle R_\mathrm{{D}}(s_p) \right\rangle G(s_p)\) with \(G(s_p)=-a^{-2}(1-a^{-2}(s_p-\mu )^2)\). With Eq. 11, the approximated correlation peak amplitude becomesFootnote 4 \(\tilde{R}_\mathrm{{D}}(s_p)=\left\langle R_\mathrm{{D}}(s_p)\right\rangle (1+\kappa G(s_p))\) where \(\kappa =\frac{h_x^2}{2}\). The sub-pixel displacement estimate retrieved, based on \(\tilde{R}_\mathrm{{D}}(s_p)\) is subsequently given by

$$\begin{aligned} \begin{aligned} \tilde{\mu }&= \frac{1}{2}\frac{\log (\tilde{R}_\mathrm{{D}}(-1))-\log (\tilde{R}_\mathrm{{D}}(+1))}{\log (\tilde{R}_\mathrm{{D}}(-1))+\log (\tilde{R}_\mathrm{{D}}(+1))-2\log (\tilde{R}_\mathrm{{D}}(0))} \\&=\frac{1}{2}\frac{2\mu \log (a_I) + \log \left( \frac{1+\kappa G(-1)}{1+\kappa G(+1)}\right) }{(2-2|\mu |)\log (a_I) + \log \left( \frac{(1+\kappa G(-1))(1+\kappa G(+1))}{2(1+\kappa G(0))}\right) }. \end{aligned} \end{aligned}$$
(17)
Fig. 2
figure 2

a Evolution in sub-pixel displacement estimate \(\epsilon _\mu\) from \(\tilde{R}_\mathrm{{D}}\) for particle images of \(4.5\,\) px diameter, a pixel fill factor \(p_f=0.7\) and varying bandwidths in the estimation of the displacement distribution (\(\kappa =\frac{1}{2}h_x^2\)). b Evolution in sub-pixel displacement estimate from \(\left\langle R_\mathrm{{D}} \right\rangle\) (\(\kappa =0\) in Eq. 17) when adding random noise n to the correlation map

The variation in the sub-pixel error \(\epsilon _\mu =\tilde{\mu }-\mu\) is depicted in Fig. 2a for the case of \(d_\tau ^*=4.5\,\)px. Note that \(\kappa =0\) refers to the ideal case where \(\tilde{R}_\mathrm{{D}}\equiv \left\langle R_\mathrm{{D}} \right\rangle\) and sub-pixel inaccuracy is inherent to the three-point Gaussian fitting, independent of \(a_I\). With increasing \(\kappa\) (and subsequently high values for the bandwidth \(h_x\)), the effect of curvature in the correlation map gains importance in its estimate and sub-pixel error increases in magnitude. The derivative \(\left\langle R_\mathrm{{D}}(s_p) \right\rangle ''\) increases with particle image diameter and the effect of curvature can thus be expected to gain importance for smaller particle image widths. For typical bandwidths \(\kappa \sim \mathcal {O}(10^{-4})\) and the sub-pixel error will be dominated by the bias error inherent to the Gaussian peak fit estimator, which is conventionally estimated at \(10^{-1} \,\)px in average.

In Fig. 2b the variation in \(\epsilon _\mu\) due to slight deviations in the correlation map \(\left\langle R_\mathrm{{D}} \right\rangle\) is presented. Here random noise, drawn from a normal distribution with a variance of 0.3% of the correlation peak amplitude (\(a_I\)), is superimposed onto the correlation map. This fluctuating component can originate from the correlation between non-corresponding particle images and correlation with the background. Figure 2b indicates that although from a statistical perspective the average sub-pixel error does not change from the ideal case, instantaneous differences between displacements obtained from \(\tilde{R}_\mathrm{{D}}\) and \(\left\langle R_\mathrm{{D}} \right\rangle\) can still occur, with magnitudes (corresponding to a 95% confidence level) ranging from one to ten times the order of the noise component (i.e. 0.006–0.02). This will show to be useful in the discussion of the numerical assessment. An in-depth analysis of sub-pixel measurement precision can be found in Westerweel (2008).

5.3 Implementation

In view of the common process of iterative image deformation to enhance spatial resolution (Scarano and Riethmuller 2000), the described approach remains valid but requires certain modifications to incorporate the equivalent correlation window deformation (Fig. 3). To this extent, the forward difference scheme is considered first, allocating a particle image at \(\mathbf {x'}\) with an associated displacement vector \(\varvec{\varDelta }(\mathbf {x'})\). Accordingly, the particle’s location in the second image snapshot will be given by \(\mathbf {x''}=\mathbf {x'}+\varvec{\varDelta }(\mathbf {x'})\) and copied to location \(\mathbf {x'''}=\mathbf {x''}-\mathbf {u_{p}}^{-1}(\mathbf {x''})\) in a pseudo-image (viz. the deformed second snapshot). Here, \(\mathbf {u_{p}}\) represents the displacement field obtained from a previous iteration, i.e. the predictor. The inverse mapping \(\mathbf {u_{p}}^{-1}(\mathbf {x''})\) is defined such that \(\mathbf {x'''}+\mathbf {u_{p}}(\mathbf {x'''})=\mathbf {x''}\) i.e. \(-\mathbf {u_{p}}^{-1}(\mathbf {x''})\) is the vector, located at \(\mathbf {x''}\), based on the predicted displacement field, pointing to the location from where it came. The corrected displacement field thus becomes \(\varvec{\varDelta }^{{{\varvec{c}}}}(\mathbf {x'})=\mathbf {x'''}-\mathbf {x'}=\varvec{\varDelta }(\mathbf {x'})-\mathbf {u_{p}}^{-1}(\mathbf {x'}+\varvec{\varDelta }(\mathbf {x'}))\). It should be noted, however, that \(\varvec{\varDelta }^{{{\varvec{c}}}}(\mathbf {x'})\) can only be accounted for provided \(\mathbf {x'''}\) falls within the original correlation window, i.e. \(|\mathbf {x'''}-\mathbf {x}_{\mathbf {k}}|\le \frac{\mathbf {W}_{\mathbf {s}}}{2}\) (cf. Eq. 5).

Fig. 3
figure 3

Illustration of image deformation. Original images (black grids top row) are distorted considering a forward or b central difference, yielding the red and blue grids. The lower grids represent the reconstructed pseudo-images with relocated particle images and corrected displacement vectors

Most common, however, is to deform both image snapshot by equal partitions of the predicted displacement (Wereley and Meinhart 2001); \(I_1^c(\mathbf {x})=I_1\left( \mathbf {x}-\frac{\mathbf {u_p}(\mathbf {x})}{2}\right)\), \(I_2^c(\mathbf {x})=I_2\left( \mathbf {x}+\frac{\mathbf {u_p}(\mathbf {x})}{2}\right)\). In the construction of \(I_1^c(\mathbf {x})\), rather than the original locations \(\mathbf {x}\), the first snapshots are thus sampled at \(\mathbf {x'}=\mathbf {x}-\frac{1}{2}\mathbf {u_p}(\mathbf {x})\), with corresponding displacement vectors pointing to \(\mathbf {x''}=\mathbf {x'}+\varvec{\varDelta }(\mathbf {x'})\) (Fig. 3b). Also these \(\mathbf {x''}\) locations in the second snapshot will be translated according the predictor field; \(\mathbf {x'''}=\mathbf {x''}-\frac{1}{2}\mathbf {u_p}^{-1}(\mathbf {x''})\). The corrected displacement to be measured thus becomes more intricate: \(\varvec{\varDelta }^{{{\varvec{c}}}}(\mathbf {x'})=\mathbf {x'''}-\mathbf {x}=\varvec{\varDelta }(\mathbf {x'})-\frac{1}{2}\mathbf {u_p}(\mathbf {x})-\frac{1}{2}\mathbf {u_p}^{-1}(\mathbf {x'}+\varvec{\varDelta }(\mathbf {x'}))\) and can only be measured provided \(|\mathbf {x'''}-\mathbf {x}_{\mathbf {k}}|\le \frac{\mathbf {W}_{\mathbf {s}}}{2}.\)

Despite the additional transformations, the corrected displacement data, \(\varvec{\varDelta }^{{{\varvec{c}}}}(\mathbf {x'})\), serve as input for Eq. 14, making the proposed methodology conducive in the study of general PIV algorithm response. Equations 14, 15 and 16 enable the calculation of the correlation map based on solely the underlying flow field. The algorithmic implementation is clarified in Algorithm 1.

figure b

5.4 Additional observations

Equation 14 can be extended to incorporate spectral filtering. However, similar to the continuous form (Sect. 4.2), it will be more appropriate to evaluate the normalisation and ensuing inverse Fourier transform numerically. This is especially true since, in case of SPOF, the rescaled Fourier transform pertaining the triangular function will equate to \(\left| \frac{\sin (k)}{k}\right|\). If based on Fourier transforms, Eq. 12 would thus involve a convolution with the related inverse Fourier transform, \(\left| \frac{\tan (x)}{x}\right|\), which still necessitates a numerical calculation.

When thicknesses \(d_z\) are such that variations of \({\varvec{\Delta }}\) are measurable across the illumination sheet, Eq. 3 must be used retaining the integration over \(Z'\). The kernel density estimator \(F_{\varDelta ,w}\) is then constructed by considering individual samples within the illuminated volume and attributing particular weights depending on the samples’ positions and shifts. The subsequent operations remain unchanged.

6 Numerical assessment

6.1 Synthetic image generation and analysis

To assess the validity of the derived approximations, 6000 synthetic 8bit PIV images, \(L_x\times L_y=525\times 525 \,\mathrm{{px}}^2\) in size, were generated with different underlying velocity fields. For each image, \(6\times 10^3\) particles were distributed randomly across the image and along the laser sheet thickness \(Z/dz\in U\left( \frac{-1}{2},\frac{1}{2}\right)\). Particle image diameters were drawn from a normal distribution \(\mathcal {N}(4.5\,\mathrm{{px}},0.5\,\mathrm{{px}})\) and integrated over pixels with a pixel fill ratio \(p_f=0.7\). An exemplary PIV image is depicted in Fig. 4a.

Within correlation windows, the mean intensity was subtracted and intensities were normalised with the standard deviation in captured intensity. The unbiased cross-correlation was performed by means of fast Fourier transforms (Raffel et al. 2018, p. 137–138); \(R_\mathrm{{D}}=\mathcal {F}^{-1}(\mathcal {F}(I_1') \mathcal {F}(I_2'^{c})) / \mathcal {F}^{-1}(\mathcal {F}(W) \mathcal {F}(W^{c}))\) where \(I_{1,2}'\) are the rescaled intensities within the correlation windows of size \(W_S\times W_S\). W is a unit matrix of equal size. Following the procedure described in Appendix 1, the representative particle image diameter, \(d_{\tau }^*\), was evaluated to be \(4.6332\,\mathrm{{px}}\). This value was subsequently used in Eq. 14 to yield the theoretical correlation map \(\tilde{R}_\mathrm{{D}}(\mathbf {s_p})\). Intensity weightings \(P_1\) and \(P_2\) were taken as unity for simplicity.

In the image analyses \(2\times 2\) different approaches were considered. The first consisted in calculating the displacement based on instantaneous correlation functions and subsequently averaging the obtained results. These results will be denoted hereafter by \(\overline{(\cdot )}\). The alternative ensemble correlation involved first averaging the correlation maps and retrieve one single displacement estimate, symbolised as \(\left\langle (\cdot )\right\rangle\) in each direction (Meinhart et al. 2000). In both approaches, sub-pixel accuracy in the displacement estimates was then obtained either by means of the more common three-point Gaussian interpolation of the identified correlation peak (Willert and Gharib 1991) or two-dimensional Gaussian regression (Nobach and Honkanen 2005).

Fig. 4
figure 4

a Illustration of a synthetic PIV images (contrast enhanced for clarity). b Underlying displacement field of the lid-driven cavity (Re = 100), under-sampled by a factor 15 for clarity. The red squares indicate the \(99\times 99 \,\mathrm{{px}}^2\) interrogation windows analysed

Flowcharts of the two image analyses approaches are provided in Fig. 5 for clarity. It becomes clear that the proposed semi-analytical correlation response simplifies the Monte-Carlo analysis adopting ensemble correlation. Although ensemble correlation is not standard practice in the analysis of instantaneous PIV images, the authors argue that it is the only manner to evaluate the filtering of the velocity field captured within a correlation window inherent to the statistical operator. Moreover, in view of validating time-averaged CFD solutions, ensemble correlation provides more reliable and robust (time-average) displacement estimates compared to the average of instantaneous displacement fields as it reduces random noise. In addition, mean displacement fields can be obtained considerably faster by ensemble correlation (Willert 2008).

At this point, the authors would also like to underline that the objective of the following assessment is not to scrutinise the performance of traditional Monte-Carlo simulations. Increasing the noise in the synthetic PIV images would only deteriorate the convergence in the average of the instantaneous data. It is for this reason that the authors have intentionally neglected image noise as an additional degree of freedom since it would not affect the outcome of the theoretical response. The authors neither claim the theoretical response to be more accurate compared to Monte-Carlo analyses. Instead, the assessment focuses on the validity, accuracy and robustness of Eq. 14 to replicate ensemble correlation maps such that the user can evaluate the filtering of the observed velocity field in a more efficient manner. This can be subsequently used to develop appropriate intensity weighting schemes \(P_1\) and \(P_2\) (viz. Eq. 6) or to filter the time-averaged CFD solutions such that the resulting field mimics the mean statistics of the experimental PIV data.

Fig. 5
figure 5

Flowchart of the implemented image processing routine in the Monte-Carlo analyses adopting ensemble correlation and its theoretical counterpart

6.2 Lid-driven cavity

The first velocity field considered consisted of the numerically simulated flow field underlying a 2D lid-driven cavity at a cavity-height-based Reynolds number of 100 with a grid spacing of \(525/1000\,\mathrm{{px}}\).Footnote 5 Discrete displacements were re-interpolated using linear interpolation to particle positions and rescaled to yield maximum displacements of 4 px. The corresponding (sub-sampled) velocity field is depicted in Fig. 4b. The lid is placed on the right-hand side and moves upwards by 4 px. Three correlation windows, each \(99\times 99 \,\mathrm{{px}}^2\) in size, were selected within the flow field (see Fig. 4b). The first overlapped a secondary recirculation area located in the upper left corner and presented a region of strong velocity gradients. The second correlation window captured a region of nearly uniform displacement, whereas the third contained part of the larger recirculating structure.

The evolution in displacement estimates with number of images is illustrated in Fig. 6a for the first correlation window and is representative for all analyses. Initially, both the arithmetic average (blue) and ensemble results (red), for either of the sub-pixel fitting schemes (hollow vs. filled symbols), show large fluctuations but converge to near-identical values as the number of images increases (Table 1). The data scatter in the \(\overline{(\cdot )}\) estimates is reflective of the random error and levels will change with seeding density (Westerweel 2000). Equation 14 on the other hand yields a single value with no data scatter. Changing the sub-pixel displacement estimator (three-point interpolation or nine-point regression) has a noticeable effect though, yielding variations in displacement estimates up to \(0.15\,\mathrm{{px}}\) (CW3, \(\left\langle v \right\rangle\), Table 1), even in case of isolated correlation peaks (CW2, \(\left\langle u \right\rangle\), Fig. 7b).

The evolution in the displacements based on \(\tilde{R}_\mathrm{{D}}\) with number of sampling locations N per correlation window is depicted in Fig. 6b for the three correlation windows considering the horizontal displacement. For insufficient samples, \(\tilde{R}_\mathrm{{D}}\) will fail to be representative of \(\left\langle R_\mathrm{{D}}\right\rangle\) resulting in larger discrepancies. With increasing N, the kernel density estimate becomes more accurate and for \(N>10^4\) estimated displacements have converged. Choosing too large N, however, considerably augments computational effort with no gain in accuracy. For this reason, \(N=10^5\) is suggested as a generally appropriate value.

Fig. 6
figure 6

a Evolution of the displacement estimate obtained through cross-correlation of the first \(99\times 99\,\mathrm{{px}}^2\) correlation window depicted in Fig. 4b with number of image pairs considered. b Convergence in displacement estimate obtained from the correlation map estimated using Eq. 14 for the three \(99\times 99\,\mathrm{{px}}^2\) correlation windows shown in Fig. 4b with number of samples N

Correlation maps taking into account 6000 instantaneous correlation functions and \(N=10^5\) are juxtaposed in Fig. 7. Note that correlation maps have been normalised to a maximum of one to facilitate comparison and negate scaling factors. Correlation maps obtained through ensemble correlation and Eq. 14 are indistinguishable, irrespective of the underlying distribution. Though not visible in the displayed correlation maps, \(\left\langle R_\mathrm{{D}}(\mathbf {s_p}) \right\rangle\) did not reach zero values for \(|\mathbf {s_p}|>\mathbf {10}\) but showed random fluctuations as a result of random particle correlations. These fluctuations were in the order of 3% of the peak amplitude. Random noise in the correlation map with this amplitude could lead to variations in displacement estimates with the three-point Gaussian fit as high as 0.025 px according Fig. 2b. The tabulated values in Table 1 suggest differences between the displacements obtained from \(\left\langle R_\mathrm{{D}} \right\rangle\) and \(\tilde{R}_D\), the latter denoted by \(\tilde{(\cdot )}\), are in the order of 0.005 px with a maximum of 0.016 px. These differences accordingly reduce when invoking Gaussian regression as the sub-pixel estimate becomes less sensitive to noise. However, also the displacement estimates alter by as much as 0.1 px (CW3) merely by changing the sub-pixel interpolation scheme. This example first demonstrates the displacements retrieved by cross-correlation do not correspond necessarily with the exact values at the window centroids, showing differences up to 1.5 px (CW3). These discrepancies concern how well a vector represents the underlying velocity field and are caused by correlation filtering. Second, the figure corroborates Eq. 14 to yield correlation maps which show negligible differences with those obtained through ensemble correlation, yielding displacement estimates which differ from ensemble correlation by amounts of the same order of magnitude as the correlation uncertainty. Table 1 also incorporates the displacements following a weighted averaging: \((\tilde{u})_{\mathrm{{MA}}}=\sum _i^n w_i(\varDelta _x)_i\) (cf. Eq. 6), evincing the averaging filter not to be a generally representative model of the correlation response. The correlation response is intrinsically non-linear, yet, under very particular conditions the (linear) averaging filter can provide a reasonable estimate of the true peak location of the correlation map. Considering the simplified problem of the sum of two Gaussians of equal variance \(\sigma\) separated by a distance \(\nu\) (cf. Eq. 6), the resulting peak location will be located halfway (viz. the average) provided both normal distributions have equal amplitude and \(\nu /\sigma \le \root \of {2}\). In terms of PIV applications, this translates into the very stringent conditions that the out-of-plane motion of the particles is (nearly) equal or properly rescaled by means of intensity weighting (viz. \(w_i\) Eq. 6) and displacement variations do not exceed \(\root \of {2}\) times the particle image diameter. The proposed semi-analytical model instead provides a conducive alternative without imposing any restrictions.

Table 1 Displacement estimates for the \(99\times 99\,\mathrm{{px}}^2\) correlation windows (CW) placed in the lid-driven cavity flow (Fig. 4) incorporating 6000 image pairs
Fig. 7
figure 7

Juxtaposition of ensemble correlation maps based on 6000 image pairs (top row) and estimated maps using Eq. 14 (bottom row) for the lid-driven cavity for correlation window 1 (a, d), 2 (b, e) and 3 (c, f) in Fig. 4b

6.3 Oseen vortex with window refinement

The ability to replicate the correlation response in case of iterative window refinement was assessed on the basis of an Oseen vortex adopting initial interrogation areas of \(99\times 99\,\mathrm{{px}}^2\). These areas were reduced to \(25\times 25\,\mathrm{{px}}^2\) in three refinement steps maintaining 50% mutual overlap. Displacement vectors obtained within an iteration were linearly interpolated onto a pixel-wise grid, which was subsequently used to deform the images adopting a top-hat predictor filter kernel (Schrijer and Scarano 2008). Sub-pixel displacement estimates were retrieved based on Gaussian regression and intensities were interpolated using a quintic B-spline (Astarita and Cardone 2005). To negate influences related to accumulated inaccuracies in the inverse mapping (see Sect. 5.3) forward differencing in the image deformation step was considered, i.e. only the second snapshot was deformed (Fig. 3a).

With the origin placed at the image centre, the vortex radius was set to \(\sigma =60\,\mathrm{{px}}\) and the maximum displacement \((u_{\theta })_{\max }\) to \(6\,\mathrm{{px}}\) (\(\lambda =1.25643\)). This can be considered a strong vortex. An additional 20% out-of-plane displacement component w was imposed (\(W_{\max }/dz=0.2\));

$$\begin{aligned} \left\{ \begin{array}{ll} u_{\theta }(x,y)=(u_{\theta })_{\max }\left( 1+(2\lambda )^{-1}\right) \root \of {\lambda }\frac{\sigma }{r}\left( 1-\exp (-r^2/\sigma ^2)\right) \\ w(x,y) = W_{\max }\sin \left( 2\pi x/L_x\right) \cos \left( 2\pi y/L_y\right) \\ \end{array}. \right. \end{aligned}$$
(18)

Bandwidths in the kernel density estimation were adapted locally as per Abramson (1982), reducing the bandwidth (and, therefore, smoothing) in regions of correlation peaks. Values of the estimated (pixelised) correlation map \(\tilde{R}_\mathrm{{D}}(\mathbf {s_p})\) were re-interpolated linearly at the sampled displacements \(\left( (\varDelta _x)_i,(\varDelta _y)_i \right)\) yielding \(\tilde{R}_\mathrm{{D}}({\varvec{\Delta }}_i)\). The original bandwidths \(h_x\) and \(h_y\) were subsequently rescaled locally following \(h_{x,y}^*({\varvec{\Delta }}_i)=h_{x,y}/ [\tilde{R}_\mathrm{{D}}({\varvec{\Delta }}_i)^{0.5}\theta ]\) with the geometric mean, \(\theta =\exp (\frac{1}{n}\sum _i^n\log (\tilde{R}_\mathrm{{D}}({\varvec{\Delta }}_i)))\). The KDE process was next repeated with the updated bandwidths \(h_{x,y}^*\).

The differences in the final velocity field obtained with ensemble correlation and Eq. 14 for the two velocity components are depicted in Fig. 8. Discrepancies attain magnitudes of at most 0.067 px and are concentrated near the vortex core, adopting a pattern dependent on the peculiarities of the underlying displacement field. The latter is highlighted in Fig. 8c, where the magnitude \(|\tilde{u}-\left\langle u \right\rangle |\) and product between the kurtosis and variance of the displacement distribution captured within a \(25\times 25 \,\mathrm{{px}}^2\) window are displayed side by side, evincing the origin of the lobes observed in the displacement discrepancies to be related to the underlying displacement distribution and ensuing correlation map (cf. Eq. 11) . The correlation maps pertaining the vector with the highest difference in the vertical displacement, located at \((x,y)=(260\,\mathrm{{px}},312\,\mathrm{{px}})\), are presented in Fig. 9. Correlation maps show minimal discrepancies, corroborating the multi-iterative process, including the inherent image deformation, to be correctly modelled. Observing the difference between the correlation maps in Fig. 9c, it can be noted that a bias is present. With maximum displacements in the order of \(6\,\mathrm{{px}}\) and a representative particle image diameter in the order of 4.6 px, the correlation map should attain zero values beyond radii of 10 px. While \(\tilde{R}_\mathrm{{D}}(\mathbf {s_p})\) correctly predicts this to be the case, the ensemble correlation map contains contributions from random particle image pairs, yielding slightly negative and fluctuating correlation values.Footnote 6 Plotting the largest eigenvalue of the Hessian of the ensemble correlation map, areas of largest differences between \(\tilde{R}_\mathrm{{D}}(\mathbf {s_p})\) and \(\left\langle R_\mathrm{{D}}(\mathbf {s_p}) \right\rangle\) can be seen to correspond to the region of higher curvature (i.e. larger eigenvalue) in line with Eq. 11. Even though the differences in correlation coefficient are in the order of 6%, this is sufficient to influence the sub-pixel peak fitting and yield variations in estimated displacement of the same order of magnitude (cf. Fig. 2b). Nevertheless, the systematic error in the ensemble correlation estimates (Fig. 10a) caused by the correlation to yield the most probable displacement which is, therefore, dependent on local curvature in the displacement field, is also observed in the theoretical map (Fig. 10b). The noticeable absence of axial symmetry is due to the fact that correlation windows are not located radially equidistant with respect to the vortex core. This example thus demonstrates the derived KDE-based analytical expressions for correlation to be applicable in iterative PIV image analyses and to be useful in simulating general correlation responses.

Fig. 8
figure 8

Discrepancies in a horizontal and b vertical displacement components for the Oseen vortex (Eq. 18) between Eq. 14 \(\tilde{(\cdot )}\) and ensemble correlation \(\left\langle (\cdot )\right\rangle\). The red vectors represent the under-sampled (factor 3) and scaled (factor 5) underlying velocity field. The correlation map corresponding to the vector positioned at the white cross (\(x=260\,\mathrm{{px}}\), \(y=312\,\mathrm{{px}}\)) is presented in Fig. 9. c Magnitude \(\tilde{u}-\left\langle u \right\rangle\) (left hand side) placed side by side the product between displacement variance \(\sigma _u^2\) and kurtosis \(\kappa _u\) of the underlying displacement field within a \(25 \times 25 \,\mathrm{{px}}^2\) correlation window (right-hand side). The white vertical line indicates the plane of symmetry of the velocity field

Fig. 9
figure 9

Correlation maps for the vector located at the white marker in Fig. 8 as per a ensemble correlation \(\left\langle R_\mathrm{{D}}(\mathbf {s_p}) \right\rangle\), b \(\tilde{R}_\mathrm{{D}}(\mathbf {s_p})\) following Eq.14 and c the difference \(\tilde{R}_\mathrm{{D}}(\mathbf {s_p}) - \left\langle R_\mathrm{{D}}(\mathbf {s_p}) \right\rangle\). The bottom contour in c is related to the depicted difference. The top contours are indicative of the maximum eigenvalue of the Hessian of \(\left\langle R_\mathrm{{D}}(\mathbf {s_p}) \right\rangle\)

Fig. 10
figure 10

Bias error in horizontal displacement component with respect to the imposed Oseen vortex, based on (a) ensemble correlation (b) Eq. 14

7 Conclusions

Cross-correlation is the standard operator in PIV image analyses and intrinsically behaves as a non-linear operator, introducing a filtering in the measurement of underlying displacement fields. The response of the cross-correlation can be appropriately modelled as a (linear) moving averaging, provided the correlation map exhibits a single peak and particle images within the correlation windows have nearly equal intensity and out-of-plane displacement. These restrictions are typically not satisfied and for this reason in this paper a generally conducive methodology is presented in which an integral equation, describing the cross-correlation response for 2D/2C PIV, is solved by estimating the density function pertaining the observed velocity field using Gaussian kernel density estimation (KDE). Implementation of the resulting semi-analytical equations is shown to be simplistic and to replicate ensemble correlation, also when incorporated in iterative multi-grid routines. This approach enables the inherent cross-correlation filtering/response for any known steady velocity field to be characterised. Variability in Monte-Carlo results due to alterations in seeding density and/or image noise is thereby negated. The proposed routine thus replicates the ensemble-averaged PIV result if an experiment were performed whereby the underlying steady velocity field can be mathematically defined or is as predicted by a steady CFD simulation. Given its efficiency, the methodology is, therefore, ideally suited to investigate the modulation introduced by cross-correlation in PIV and CFD uncertainty evaluation.