1 Introduction

The employment of PIV (particle image velocimetry) has played a central role in experimental fluid mechanics since its introduction back in the late 70’s (Archbold and Ennos 1972) as an extension of speckle metrology (Barker and Fourney 1977). The basic idea underlying the PIV technique is to reconstruct the flow field by measuring the velocity of particles seeded into the fluid, whose size and density are chosen to ensure and they follow the flow satisfactorily. The flow is illuminated by means of a laser/led source and the light scattered by the particles allows for their tracking. The reader is referred to the review works Grant (1997), Westerweel et al. (2013) for an in-depth description of the method. The basic 2D technique has evolved into peculiar setups, the most advanced ones being the single/multiplane stereoscopic PIV (Prasad 2000) and the volumetric/tomographic PIV (Scarano 2013). It has been broadly emploied in industrial and research applications requiring non-invasive measurement of a wide range of flow fields.

When the investigated flow field is influenced by solid standing boundaries, care must be taken in order to subtract the areas occupied by both the solid objects and their shadows from the region undergoing PIV analysis, by means of a static masking (SM) approach. Indeed, no seeding particle can be identified in such areas, therefore flow velocity reconstruction cannot be accomplished. If not properly handled, this masking phase can lead to erroneous predictions which, unfortunately, are not confined to the proximity of the boundaries of the shadowed areas.

The PIV technique can be applied to either steady state or time varying flows by tuning the acquisition frame rate to the time scales of interest. When the variability in time involves the position/shape of the solid objects, extra effort is needed in order to dynamically mask the images. It should be noted that not only solid objects need to be masked, but also different fluid phases (Foeth et al. 2006). This process is relatively easy if the motion of the solid objects is known a priori, and thus minimal modifications to the SM algorithms can serve the purpose. However, when the position and/or shape of the solid objects varies in time in an unknown way, a masking technique able to dynamically track the object is needed. The dynamic masking (DM) approach for PIV analysis is currently receiving a considerable amount of attention (Sanchis and Jensen 2011; Masullo and Theunissen 2017; Anders et al. 2019), thanks to the diffusion of time resolved PIV systems which, in turn, benefit from the increased availability of high speed cameras. The major advancements in DM techniques come from the field of micro-PIV (Lindken et al. 2009) applied to microfluidics, where the investigation of both the flow fields around micro- and nanoswimmers (Ergin et al. 2015) and multiphase flows (Brücker 2000; Khalitov and Longmire 2002) requires accurate and flexible algorithms. DM techniques are included in few commercially available PIV analysis software packages (TSI Instruments 2014; DantecDynamics 2018). Recent developments (Vennemann and Rösgen 2020) envisage the application of neural-network automatic masking techniques, which however require synthetic datasets to be generated in order to train the network.

Many algorithms employ image processing techniques to track the object, most of them requiring the user to develop ad-hoc experimental setups able to highlight the object to be tracked in the acquired images. The design of the experimental setup thus affects the final accuracy of the algorithm.

Several solutions can be envisaged. In the following, we will refer to a simple 2D PIV setup, but most considerations can be extended to more complex ones. The most straightforward way to render an object easily and accurately trackable in PIV setup is to illuminate it by means of a further source of light pointing to the direction which maximizes reflection towards the camera, usually roughly perpendicular to the PIV laser sheet. The main problem associated with this naive solution is that it is virtually impossible to aim the light source to the moving object alone without illuminating the ROI (region of interest) of the PIV, thus attenuating the contrast ratio between the laser light scattered by the seeding particles and the dark background.

The situation is harshened by the fact that the higher the frame rate of the camera, the lower the amount of light hitting the sensor. Provided both the solid object movement and the flow particles are slow enough compared to the rate of acquisition of the employed setup, a possible solution would be to interpose (not necessarily a symmetric interposition) a single diffuse light shot between the couples of laser pulses, and synchronize the camera shots to both of them: the position of the object at each laser couple can then be determined by interpolating the two positions in the previous and following shots, yielded by the diffuse light. This approach would require a synchronizer able to control the laser, the camera and the light, and a camera capable of a frame rate at least twice as high as the one strictly needed to capture the time scales characterizing the investigated flow field.

A solution to this problem has been proposed and consists of exploiting the bright reflections of the fluid interfaces (Foeth et al. 2006; Dussol et al. 2016) allowing to acquire a high amount of scattered laser light in the images. Solid surfaces can be provided with a reflective coating to enhance the effect. The object can be then identified as an abnormally large particle and its boundary easily tracked. The drawback of this solution is that the light scattered by the object surface also illuminates many seeding particles that do not lie in the laser sheet, thus progressively lowering the accuracy of the PIV analysis.

A refinement of the above approach employs a second co-planar laser sheet (Driscoll et al. 2003) of different wavelength: the light scattered by the surface of the object is very poorly reflected by the seeding particles, provided the latter are chosen with a narrow reflecting band centered around the first laser wavelength. The overall setup can become extremely expensive. The difference in wavelength emission could be exploited to make the setup inexpensive: the application of two cameras equipped with different filters would allow to identify fluorescent seeding particles independently of reflections from interfaces (Pedocchi et al. 2008).

When the displacements of the objects are small, a basic solution may be to extract one single static mask which best approximates the true time-varying shaded areas. A general rule of thumb would be to draw the mask slightly larger than the expected shaded areas, seeking the best trade-off between simplicity and minimization of the amount of illuminated areas subtracted to the analysis.

In this paper, we propose a new experimental approach to the problem of DM for PIV analysis. Our method encompasses a technique to make the object easily trackable using a fluorescent painting and a specific open source algorithm able to generate the time varying masks. The approach is proven to be effective by allowing for large displacements of objects opaque to the laser light. A comparison is made between our method, the no-masking (NM) and the static masking (SM) approaches. Besides demonstrating the validity of our approach, this paper further confirms that the masking phase is of paramount importance for obtaining accurate results. Indeed, when objects’ displacements are non-negligible, the resort to DM is compulsory, with the SM approach inducing inaccuracies not limited to the surroundings of the shaded areas. The structure of the paper follows: we first introduce the rationale of the proposed approach describing the fluorescent coating technique and the masking software; then, after a description of the PIV setup, we assess the reliability of the whole PIV chain analysis by means of two benchmark cases; then, we compare the results of the proposed DM method against NM and SM solutions; finally, some conclusions are drawn.

2 Methods

The proposed DM technique envisages a fluorescent coating of the surface of the moving object in order to allow for its easy and accurate trackability in the same images captured for the PIV analysis. Once the object is made visible, a specific algorithm performs the object tracking and, provided the laser position is known (see Fig. 1), the masking of the shaded area.

2.1 Fluorescent coating

The coating consists of a dispersion of commercially available fluorescent powder (fluorescein (Taniguchi and Lindsey 2018; Taniguchi et al. 2018)) in a structural matrix. In case of rigid objects, the matrix can be a polyester/epoxy (based on the chemical compatibility with the object material) transparent resin. In case of deformable objects, the matrix can be made of transparent silicone rubber. The fluorescent-coated object needs to be illuminated for a sufficiently long time prior to the experiment in order for it to constantly emit light during the run. We found that a 20 s long exposure to a 4W LED source (visible in Fig. 2) is largely sufficient to provide consistent fluorescence emission for the short duration of our experimental run (few seconds).

Given the substantial difference between the object and the particles size in our experiment, identification of the former is straightforward. Figure 3 shows a superimposition of both the seeding particles and the object shapes at three different times (coloring refers to different instants).

Instead, when such size-based classification is not feasible, separation of wavelengths of particles and object needs to be sought: such separation can be achieved either by choosing a fluorescent coating emitting at a markedly different wavelength from the light scattered by the seeding particles, or exploiting fluorescent particles emitting in a band far from the one of the laser (Pedocchi et al. 2008). In both cases, either channel isolation of a color image acquisition or ad-hoc filtering of a multicamera setup, can greatly facilitate object identification. In our case, there is no need to achieve such wavelength separation: indeed, the peak of the emission spectrum of the fluorescent coating is at 540 nm (Taniguchi and Lindsey 2018; Taniguchi et al. 2018), very close to the 532 nm one of the employed laser.

2.2 Masking software

The developed algorithm for DM is an open-source freeware GUI-based tool (Prestininzi and Lombardi 2021) conceived to work in conjunction with the free PIV analysis package PIVlab (Thielicke 2020; Thielicke and Stamhuis 2014). It consists of the sequential run of three phases (referred to as a–b–c in Fig. 1): the first one (a) is aimed at locating the laser position in the scene (i.e., calculates the coordinates of the source of light hitting the obstacles); the second one (b) tracks the objects position and calculates the shaded areas for each frame; the third one (c) merges the tracked objects areas with the shaded ones into a single mask for the PIV algorithm.

More details for each phase follow:

  1. (a)

    The laser position can be either visible or not within the frame (i.e., in the field of view (FOV) of the acquired frames). In the former case, the user is simply required to locate the laser source by clicking on it in our GUI; in the latter case, the user is asked to draw two segments (two couples of points) belonging to the boundary of the shaded area: the laser position, which is located out of the FOV, is then calculated as the intersection of the two lines comprising the segments. The object shadow is assumed to reach the ROI frame box.

  2. (b)

    Once the laser position is known, the tracking of the objects is performed as follows: one channel (in our case, the green one since a RGB color space is employed; however, the GUI allows to specify the preferred channel) of each frame is binarized using a locally adaptive threshold (Bradley and Roth 2007), the latter being computed for each pixel using the local mean intensity around its neighbors. The binary image, comprising particles and objects, is then converted into regions. The only obstacle present in our experiment is identified based on its larger size compared to all the particles. Other strategies have been previously discussed. Then, the boundary polygon of the obstacle region is determined with a user defined density of points. A ray casting (RC) approach is here adopted for the determination of the shadow. RC falls in the framework of the “light transport modelling”, which is at the basis of computer graphics. It is chosen here because it provides numerically exact shadows. Several other methods have been developed, mainly aimed at reducing the computational loads of the RC, though at the expense of accuracy. The algorithmic structure, adapted from Case (2015), is here briefly recalled: for each frame (not indexed here for the sake of clarity), a ray \(r_{ij}\) is cast from the laser position L towards the ith vertex \(P_{ij}\) of the jth object’s bounding polygon; the aim is to find whether \(P_{ij}\) belongs to the subset \(A_j\) of the bounding vertices directly illuminated by the laser. \(P_{ij}\) is added to \(A_j\) if \(r_{ij}\) crosses at least one side \(S_{kj}\) (k spanning all sides of the jth object bounding polygon) after hitting \(P_{ij}\) (that is the intersection \(Q_{ijk}\) does not lie between the laser position and the vertex \(P_{ij}\)). The only two rays, namely \(\rho _1\) and \(\rho _2\), which do not cross any additional side, are stored.

  3. (c)

    Once the set of vertices, namely \(A_j\) directly illuminated by the laser, have been identified, the shaded portion of the ROI frame box is determined by intersecting the latter with \(\rho _1\) and \(\rho _2\) . The two intersections are appended to \(A_j\). The region enclosed by points in \(A_j\) is finally converted to a mask.

In case of multiple laser sources, the RC algorithm needs to be applied to each of them, and the union of the shaded areas is taken. A pseudocode of the raycasting procedure is reported in Alg. 1.

figure b
Fig. 1
figure 1

Sketch of the dynamic masking procedure. Green lines are the borders of the fan laser sheet. The object is shown in yellow. a Two segments (depicted in orange) are drawn by specifying their endpoints \(P_1\), \(P_2\), \(P_3\) and \(P_4\) (red crosses); then the laser source position (green cross) is calculated by intersecting the segment extensions (dashed orange traces); any instant can be used to this purpose; b tracking of the time varying position of the object and subsequent identification of the portion of its boundary directly illuminated by the laser (cyan line, referred to as \(A_j\) in the text); tracing of the two rays (red lines, referred to as \(\rho _1\) and \(\rho _2\) in the text) passing through the endpoints of \(A_j\) line; c finding the two intersections of \(\rho _1\) and \(\rho _2\) with the ROI frame box (cyan circles, referred to as \(F_j\) in the text) and masking of the area bounded by \(A_j \cup F_j\). Steps b and c are both carried out for all n instants \(t\in \left[ t_1,t_n \right] \)

3 Validation of DM

In this section, we present the comparison between the PIV measurements carried out with the proposed DM and two other approaches, namely the no-masking (NM) and the static masking (SM) one.

Fig. 2
figure 2

Picture of the experimental setup in the channel, with a magnified 3D view of a generic VI. The red face is the one that was coated with fluorescent paint in the experiments

Fig. 3
figure 3

Superimposition of three frames of the ROI used for the PIV analysis, showing both the VI positions and the corresponding clouds of seeding particles. Coloring refers to different instants. It is evident that object tracking for this case can be easily carried out considering objects’ sizes even if particle size is here magnified by choosing a deliberately high threshold value for the binarization process

3.1 Experimental setup

We designed the PIV setup and developed the present DM technique, in order to analyze the performance of vibration inducers (VIs) (Curatolo et al. 2019, 2020). The latter are winglets able to induce regular and wide oscillations of a cantilever placed counterflow in a non-pulsating fluid flow. Such VIs are mounted at the tip of the cantilever (see Fig.  2) and feature two concave wings able to generate lift towards the neutral configuration of the cantilever at any point of the oscillating motion.

The VIs are envisaged to enhance mechanical energy extraction from stationary fluid flows by means of piezoelectric patches mounted on the surface of the cantilever. The whole lateral edge of the wing, highlighted in Fig. 2, is coated with fluorescent paint according to the specifications described in Sect. 2.1. The experiments are carried out in the free surface channel of the Hydraulics Laboratory of the Engineering Department of Roma Tre University. The 10.8 cm long cantilever is placed at the centerline of the channel, oriented upstream, and oscillates in the vertical-longitudinal plane. A ceramic perovskite (PZT) piezoelectric patch (7 \(\times \) 3 cm) made by Physik Instrumente (PI) is attached to the upper surface of the cantilever. It provides an AC electrical voltage difference consequent to its deformation under flow induced oscillations. The 2D velocity field in the vertical midplane of the left wing of the VI has been obtained by means of a homemade underwater PIV equipment.Footnote 1 A continuous wave, low cost, low power (150 mW), green (532 nm) laser beam is spread into a 2 mm thick fanned sheet of \(120^\circ \) intersecting one wing of the VI at half span as shown in Fig. 2. The water is seeded with polyamide particles with a mean diameter of 100 \(\upmu \)m and a density of 1016 Kg/m\(^3\). The laser source is placed 15 cm above (roughly 4 cm below the free surface) and 5 cm downstream of the VI, inclined \(5^\circ \) upstream. The above setup is conceived to investigate mainly the wake of the wing. The upstream face of the wing and part of the downstream one are not directly hit by the laser sheet. A high speed commercial camera (Sony RX100 M5) shooting perpendicularly to the laser sheet is used to acquire a movie. The latter is recorded in high frame rate mode at 500 fps with a frame size of 1920 \(\times \) 1080 px, later cropped to a smaller 655 \(\times \) 850 px ROI to be analyzed during the image analysis. A time-resolved, freeware, open source, PIV analysis tool for MatLab is used (Thielicke and Stamhuis 2014). This tool employs a multipass direct Fourier transform correlation with interrogation area (IA) deformation (in our case 64 \(\times \) 64, 32 \(\times \) 32, and 26 \(\times \) 26). At each pass, the overlapping of 50% between adjacent IA is allowed in order to obtain additional displacement information at the borders and corners of each IA. After the first pass, particles displacement information is interpolated to derive the displacement of every pixel of the IA, which is deformed accordingly.

The seeding particles number density is about 5 per IA at the first pass; according to Keane and Adrian (1992), such density value ensures a 95% valid detection probability. IAs are sized in order to ensure a sufficient permanence of particle within frame couples. The analyzed flow dynamics is characterized by flow velocities ranging between 0.4 and 0.7 m/s. Therefore, the particles appear in the third pass IA for roughly 3-4 frames, which is larger than the recommended minimum value of 2 frames (Keane and Adrian 1992).

3.2 Assessment of PIV chain analysis

The accuracy of the employed PIV algorithm has been previously exstensively assessed in literature (e.g., Guérin et al. (2020), Vennemann and Rösgen (2020), Mohammadshahi et al. (2020), Narayan et al. (2020)). However, in order to ensure the physical consistency of our PIV measurements, two benchmark cases are here presented.

The first one compares the vertical profile of longitudinal flow velocity measured by means of the same PIV setup described in Sect. 3.1 in the experimental channel with an analytical reference solution. The latter has been calibrated through PTV (particle tracking velocimetry) measurements carried out by means of floating tracers. The analytical velocity profile is described by Eq. 1 (Keulegan 1938).

$$\begin{aligned} u(z)=u^* \left[ \, 5.75 \log {\left( \frac{z}{\delta }\right) }+8.5 \right] ; \end{aligned}$$

where u is the horizontal flow velocity component, z is the vertical coordinate, \(\delta \) the bed roughness and \(v^*\) the friction velocity assumed to be given by a uniform flow formula, namely \(u^*=U/C\); U is the depth averaged flow velocity, and C is a friction coefficient given by \(C=5.75 \, \log {\left( 13.3 \, f \, R/\delta \right) }\), \(R=0.2\) m being the hydraulic radius and \(f=0.92\) the shape factor for finite width channels. Figure 4 shows the comparison between the analytical profile and the PIV measurements resulting from averaging the instantaneous values over a 4 s time window. Local fluctuations are found to evolve on time scales of roughly 0.5 s. Best fit of the PTV results yields a value of \(\delta =1\) cm for the bed roughness, the only free parameter in Eq. 1, compatible with the actual condition of the experimental channel bed surface. The analytical value of flow velocity at the location of the resting configuration of the VI is indicated in figure by a black cross. The comparison shows a remarkable agreement, thus proving that the combination of experimental setup and PIV algorithm can be considered reliable for the analyzed setup.

The second benchmark compares the amount of reattached flow over the back surface of the VI. Indeed, given the high camber of these devices, the flow detaches from the downstream surface and eventually reattaches. The amount of surface exhibiting attached flow is found (Curatolo et al. 2020) to be correlated with the efficiency of the VI in exciting the piezoelectric patch (i.e., efficiency is higher if larger and faster oscillations are induced). Here, we compare the length of the reattached flow at top dead point of the oscillation as measured through the PIV analysis, with the one predicted by a CFD (computational fluid dynamics) commercial code FLOW-3D® (Flow Science 2019), solving RANS (Reynolds-averaged Navier–Stokes) equations coupled with a k-\(\epsilon \) turbulence closure on a structured grid (1 mm spacing is chosen for our simulations). The flow on the downstream side detaches and reattaches at several locations for such high camber VI. The quantity compared in this benchmark is the length of the arc between the leading edge of the VI and the closest location of flow reattachment. With reference to Fig. 5, the length of the arc predicted by the CFD model is just 10% higher than the measured one. The PIV analysis, employing the DM technique presented in this work, is then demonstrated to provide physically sound measurements. A detailed analysis of the fluid mechanics of the wake and its correlation with the overall efficiency of the VI are currently ongoing and will be the object of future works.

Fig. 4
figure 4

Comparison between vertical profiles of longitudinal flow velocity. Values are made nondimensional by the depth averaged velocity U and the flow depth h for the flow velocity and the vertical coordinate, respectively. Red crosses: PIV measurements; black trace: analytical formula Eq. 1. The black cross depicts the analytical value of velocity at the location of the resting configuration of the VI analyzed in this work; laser position is at \(z/h=0.9\); highest measured values are at \(z/h=0.85\)

Fig. 5
figure 5

Reattached flow length. Comparison between the experimental measurement based on the PIV analysis employing the proposed DM technique (main panel), and the outcome of the numerical model (top-left closeup). Red line highlights the portion of the downstream face of the VI wing showing reattached flow. See text for quantitative comparison

3.3 Results

With reference to Fig. 6, we compare the results of the three approaches in terms of instantaneous flow velocity field. The chosen instant corresponds to the top dead point of the oscillation.

The proposed DM (panel a of Fig. 6) yields a smooth flow field, which reveals coherent swirling structures in the wake.

The NM approach (panel b1 of Fig. 6) also correctly predicts the vortex structures in the wake, but yields largely inaccurate values in the shaded area. It is also evident that an a posteriori filtering of the obtained flow field is not feasible since no reasonable criterion can be inferred from the comparison. Indeed, the flow velocity has a “reasonable” magnitude also at locations where the largest errors are produced as can be observed in panel c1 of Fig. 6, where differences between the velocity fields obtained by DM and NM approaches are shown. Moreover, no filtering criterion can be formulated even assuming a plausible flow direction, since the highly unstable swirling motions, which develop in the wake, happen to move close to such locations. Even if the modeler was aware of such inaccuracies, the NM approach would yield a “reasonable” but still largely inaccurate flow field at the inner chord of the wing and just below it. Such behavior could be highly misleading.

Panel b2 of Fig. 6 shows the flow velocity field obtained with the SM approach, while panel c2 shows the differences between the results obtained with SM and DM approaches. The SM approach clearly shows an overall better accuracy compared to the NM counterpart, but this is due to the fact that the location of the laser source is such that the shaded area does not move much during the oscillation (see Fig. 3 for a visual inspection of the maximum displacement experienced by the VI during one oscillation); in other words, for the analyzed case, the choice of the neutral configuration to draw the static mask is sufficient to obtain an error lower than the NM approach. We would like to highlight that the superiority of the SM over the NM cannot be generalized, since any experimental setup encompassing larger object displacements would result in the NM to be consistently more accurate.

Although Fig. 6 exhaustively demonstrates the differences yielded by the analyzed approaches, in order to provide a more quantitative assessment of the results, frequency distributions of the errors have been computed. Inspection of such distributions in Fig. 7 confirms that the SM approach yields better overall predictions than NM, the SM distributions being more peaked. Nonetheless, the SM still produces spikes of abnormal intensity. Such values, represented by the tails of the distributions, are connected to an overestimation (left tail) and an underestimation (right tail) of the extent of the static mask. The magnitudes of the frequencies, however, rule out the applicability of both SM and NM for the considered case, making the resort to DM mandatory.

Fig. 6
figure 6

Flow velocity fields: comparison between results from DM results (a), NM (b1), and SM (b2); lower panels show differences between DM and NM (c1) or SM (c2) fields

Fig. 7
figure 7

Frequency distribution of differences of horizontal (u, semitransparent green) and vertical (v, red) flow velocity components: NM-DM (a); SM-DM (b). Semitransparent green coloring allows for the visibility of red bars sharing the same flow velocity value. Frequencies are normalized by the total number of elements of the velocity matrix

4 Conclusions

In this work, we present a new experimental technique aimed at providing PIV analysis tools with a dynamic masking (DM) module. Dynamic masking is a required step in time resolved PIV setups encompassing opaque moving/deformable objects immersed in the fluid flow. Along with the masking algorithm, we envisage the employment of fluorescent coating to allow for accurate tracking of the object. We present the measurements carried out by means of an in-house designed, low cost, PIV setup, comparing the proposed DM and two other approaches, namely the no-masking (NM) and the static masking (SM) one. Although the analyzed flow dynamics encompass limited displacement of the solid object, the quantitative comparison demonstrates the mandatory need to adopt a DM technique. The present experimental approach, whose accuracy is here proven, is coded into a freeware and user friendly package, whose output can be directly fed into a previously available freeware PIV analysis tool, thus tangibly aiding any implementation of low cost, though still very accurate, PIV setup.