Probabilistic Evaluation and Filtering of Image Velocimetry Measurements

: The recent technological advances in remote sensing (e


Introduction
It has been more than forty years since the scientific field of computer vision expanded to include motion detection applications. At its core, motion detection is a 'correspondence problem', i.e., to identify the same distinct feature in two images at different times [1]. Fluid mechanics was one of the first fields to which motion detection was applied. In 1984, Adrian [2] employed a pulsed laser to measure, in laboratory conditions, 2D fluid velocity fields. He named this method particle image velocimetry (PIV). Nevertheless, it took some time for image velocimetry to be applied in field conditions. Fujita et al. [3] adapted the PIV method for measuring the velocity field in large water bodies and introduced the large-scale particle image velocimetry (LSPIV). Various other image velocimetry methods were subsequently suggested, such as the space-time image velocimetry (STIV) [4], the optical tracking velocimetry [5], the Kande-Lucas-Tomasi image velocimetry [6], etc.
The simplicity and the capabilities of image velocimetry have attracted scientific interest and a set of studies has supported its value in various hydrological applications, e.g., the estimation of flood discharge via crowdsourced videos [7], automated systems for continuous flood flow measurements [8], earth observation techniques [9], etc. As image velocimetry became an established technique, various researchers conducted studies on its accuracy in order to provide prior estimates of the errors and guidelines to minimize them. For example, in the study of Muste et al. [10], the mean LSPIV velocities were 13% lower than the reference values in two out of the four nodes of a cross-section and were almost equal in the remaining two (see Figure 7b in their study). Furthermore, in the study of Fujita [11], the STIV velocities obtained from the video recorded by camera B (he employed two cameras, B and C, on the visible spectrum and one camera, A, on the infrared) were, on average, 13% lower than the reference values, whereas the velocities from camera A deviated only slightly from the reference values. Then, Le Coz et al. [12] made an indirect comparison between LSPIV velocities and acoustic Doppler current profiler (ADCP) depth-averaged velocities and found the LSPIV velocities to be slightly higher, with an overall deviation of less than 10% throughout the cross-section (see Figure 10 in their study). Finally, in the study of Tauro et al. [5], the estimated velocities with PIV were, on average, 30% lower than the current-meter measurements that capture velocities right below the water surface, whereas the velocities obtained with particle tracking velocimetry were 13% higher (see Figure 10a in their study).
The variety of the patterns of the image velocimetry errors manifests the involvement of multiple uncertainty sources. Detert [13] has conducted an extensive study and concluded that most of these errors are attributed to poor intrinsic (e.g., barrel distortion) and extrinsic camera calibration (bad scaling, i.e., ground sampling distance), non-constant frame rates, and spurious vectors that were not filtered out (i.e., misleading small vectors because of either smooth water surfaces or moving objects such as shrubs on a windy day). Le Coz et al. [14] have studied the error introduced by the uncertainty of the image orthorectification procedure (i.e., the intrinsic and extrinsic calibration) by employing Monte Carlo simulations. They have found that the contribution of the orthorectification uncertainty to the total variance of the estimated discharge can range from 45% to 15%, with a parallel effect on the total variance, when the number of ground reference points ranges from 3 to 19.
The previous errors stem from either the preparatory works (fieldwork and preprocessing of data before applying the image velocimetry algorithm) or from misleading signals occurring naturally in the video footage (e.g., shrubs, submerged moving macrophytes, etc.). In addition to the previously mentioned exogenous sources, there is also endogenous uncertainty in the image velocimetry algorithms. One of the most important sources of endogenous uncertainty is the tuning of the parameters related to the sensitivity of the algorithms. For example, intensity capping [15] has been used by many researchers to improve image velocimetry performance. Detert [13] has employed this filter in Brenta Creek (Roncegno, Italy) and pixels of grayscale intensity darker than 64 were set to zero. Detert does not explain how this '64' was obtained but provides a general guideline in the Discussion section of "Keep records of selected values and conduct sensitivity tests and visual check". In another example, Pearce et al. [16] conducted a more systematic investigation before selecting the optimum value of the interrogation area (IA) size (The size of the rectangular region of a frame where the 'correspondence problem' is applied). They performed a sensitivity analysis of the LSPIV results on the IA size and selected the size with which the results were closest to the median of all trials.
Apparently, the common practice for handling the uncertainty of image velocimetry parameters is to perform some kind of trial and error, to keep the values that achieved the best performance and then to discard the rest of the results assuming that they contain no useful information. In this study, in contrast to the manual trial-and-error approach, it is suggested to employ Monte Carlo simulations for automation and systematization of this procedure. Furthermore, in contrast to the established techniques that eliminate the obviously faulty simulations, it is argued that the results of all simulations contain useful information, which can be extracted to obtain both better estimations of the surface velocities, by filtering out spurious values, and a better insight into the uncertainty structure of these estimations. This concept was tested in six different case studies (Kolubara River, Castor River, La Morge River, Murg River, Salmon River and Thalhofen River) of which the data have been made publicly available by other researchers [16][17][18].

Materials and Methods
In this section, the Monte Carlo simulations and how they were applied to study the impact of the uncertainty of the Free-LSPIV parameters are described. Then, the filters that can be employed to improve the accuracy of the estimated surface velocities are presented. Finally, the metrics that were used to evaluate the performance of the suggested filtering are defined.

Free-LSPIV Parameters and Monte Carlos Simulations
In this study, Free-LSPIV has been used [19,20], but the findings apply to any image velocimetry method that employs parameters that influence the sensitivity of the algorithm. Free-LSPIV was developed with hydrometric applications in mind. For this reason, Free-LSPIV detects displacements in any direction, but the detection takes place along a single line. This line is the cross-section where the discharge is to be measured. The centers of the IAs lie on this line. The number of IAs employed in each case study depends mainly on the spatial density of the available measurements and the width of the cross-section. The origins of the estimated velocity vectors are assigned to the centers of the IAs.
Free-LSPIV has three parameters that influence its sensitivity: the contrast threshold, the minimum acceptable cross-correlation and the IA size. The contrast threshold is a parameter of a pre-processing filter that is similar to the intensity capping. The minimum acceptable cross-correlation is a parameter/threshold of a post-processing filter that rejects estimated displacements if the cross-correlation of the corresponding pixels in two successive frames is lower than this threshold.
Another parameter that is used to filter the results is the maximum acceptable velocity, V up . However, this parameter does not influence the sensitivity and reasonable values can be easily selected. This parameter is also used to define the area to search in the following frame for possible matches of the features in the IA of a leading frame (see Equation (7.30) in [1]). Thus, the rejection of infeasible high velocities is hardwired into the algorithm.
For each one of the three studied parameters, a set of six synthetic values was created with a custom triangular random number generator [20]. The triangular distribution has three parameters: the plausible minimum, the plausible maximum and the most likely value of a variable [21]. These parameters for the contrast threshold, the minimum acceptable cross-correlation and the IA size were (0.3, 1.0, 0.6), (0.4, 1.0, 0.6) and (30 × 30, 120 × 120, 60 × 60), respectively, for all cases studies except for La Morge River where the average size of features was quite large; thus, the selected triangular distribution parameters for the IA size were (45 × 45, 180 × 180, 90 × 90). For each case study, the Cartesian product of the three sets of six values each generated 216 triplets of parameters that were used in Free-LSPIV to obtain 216 estimates of profiles of surface velocities along the crosssection. From those 216 profiles, the profiles V 95 , V 50 and V 05 (i.e., the velocities along the cross-section that at each location are greater than 95%, 50% and 5% of the corresponding 216 velocities) were obtained. It should be noted that it is not guaranteed that every single profile out of the 216 has non-null velocity values at all IA centers (null is not zero; null is no detection). In order to characterize the overall uncertainty of the estimated surface profile, the following metric was introduced: where V 95 , V 50 and V 05 are the mean values of V 95 , V 50 and V 05 , respectively. The larger this ratio, the wider the confidence interval becoms and, hence, the higher the uncertainty.

Filtering
We argue that V 50 is the optimum estimate of the surface velocities and it can be further improved by applying the following three filters:

1.
Velocity estimates are deemed invalid (and removed from the V 50 profile) at the IA centers where the number of the detected velocities is less than half of the total number of the Monte Carlo simulations. Ideally, after the Monte Carlo simulations, 216 velocities values should be obtained at each IA center. However, it is not guaranteed that this will always be the case. The lower the number of the detected velocities, the lower the confidence on the confidence intervals. For example, if Free-LSPIV detects velocity at a specific IA center with only one out of the 216 triplets, then the confidence interval width at this location would be zero, despite the actual uncertainty being very high at this location.

2.
Velocity estimates V 50 are deemed invalid at the IA centers where the V 95 − V 05 > 1.2( V 95 − V 05 ). This condition excludes the estimates at the locations where the confidence interval width is greater than the average width by 20%. This value was selected after an initial investigation. Considering V 95 − V 05 a random variable, the value 1.2( V 95 − V 05 ) was found to correspond to percentiles ranging from 66% (for La Morge River, which has ω = 1.68, i.e., 34% of V 50 are discarded) to 89% (for Kolubara River, which has ω = 0.57). Therefore, it seems that this filter tends to become tighter in wider confidence intervals, which translates into more strict filtering in the cases with increased uncertainty, which is the desired behaviour.

3.
Velocity estimates at the banks that are deemed invalid by the previous filter are replaced by the corresponding V 05 value. That is, if the previous condition holds at any of the IA centers closest to the banks, then the optimum estimate at this location is considered to be V 05 instead of V 50 . The concept behind this choice is the expected lower streamflow velocities at banks due to friction.

Reference Values and Error Metrics
The flow in the Kolubara River, Castor River, Murg River and Thalhofen River was measured with ADCP. In the ADCP method, acoustic transducers are mounted onto a boat facing vertically downwards in order to obtain the flow velocities along a vertical. This is repeated for multiple verticals at different locations. ADCP technical limitations (blanking distance and transducer draft) prevented measurements of flow velocity near the water surface and near the bottom [22]. The flow in the Salmon River was measured with a traditional current meter at the depth-positions of 0.8, 0.6 and 0.2 at each vertical. The flow in the La Morge River was measured with a handheld acoustic Doppler velocimeter at the depth-position of 0.6 at each vertical.
In ADCP, the discharge from each bin (A bin is the area corresponding to a single flow velocity measurement) is calculated with the following formula [23]: where v w is the measured vector of the streamflow velocity, v b is the vector of the boat velocity, dt is the time between ensembles (An ensemble is a single profile of the water velocity through the water column consisting of one or the mean of multiple transducer pings) and dz is the vertical dimension of the bin. Aggregating Q bin over the river crosssection provides the total discharge: where Q bini is the discharge through the i th bin and n b is the number of bins of the cross-section.
In conventional measurements, the mean velocity of a vertical v m is calculated from the velocities at positions 0.8, 0.6 and 0.2 of the vertical with the following equation.
The total discharge can be obtained by integrating v m over the river cross-section: where a i is the area corresponding to the i th vertical of the measured cross-section and n v is the number of the verticals. LSPIV, similar to any image velocimetry method, yields only surface flow velocities V s . For this reason, some method must be employed to link the surface velocity to the mean velocity of each vertical. In this study, the simple method of the constant velocity coefficient (see Section 5.3.9 in [22]) has been used.
Note, however, that hydraulic analysis shows this coefficient to be variable. It is a function of the momentum distribution coefficient β that depends on the cross-sectional geometry and the bed's relative roughness [24]: where A is the cross-sectional area and v is the mean cross-sectional velocity. The discharge estimated from Equations (5) and (6) setting V s = V 50 is Q 50 . The relative error of Q 50 against the reference value was obtained with the following formula.
The discharge estimated after filtering of the V 50 is Q f , and its relative error was obtained with the following formula.
This study focused exclusively on the error of the estimated surface velocity by image velocimetry (i.e., exclude from Equations (8) and (9) the error due to the rough estimation of Q 50 and Q f via Equation (6)). For this reason, Q ref was not the best estimate of the discharge that can be obtained from ADCP or current meter measurements. In the case of ADCP, Q ref was obtained from Equations (5) and (6) instead of Equation (3). In Equation (6), the surface velocity V s was taken equal to the measured streamwise velocity component closest to the water surface. In the case of the current meter and the handheld acoustic Doppler velocimeter, Q ref was calculated from Equations (4) and (5) as usual. However, the surface velocity V s , which was used in the plots for visual comparison, was estimated from Equation (6).

Results
In this section, the application of the suggested methodology to six different case studies is described.

Kolubara River
Kolubara River is located in Central Serbia. The width of the surface of the river is approximately 21 m and the maximum depth is 1.9 m. The mean flow velocity is 0.14 m/s and the discharge measured with ADCP is 3.4 m 3 /s [16].
The surface velocity V s of cross-section S1 of Kolubara River has been estimated by Pearce et al. [16] from the ADCP measurements with the extrapolation of characteristic velocity depth profiles. The video footage was recorded from a UAS hovering 26 m above the river surface. Before video recording, artificial seeding material was distributed evenly across the river surface ( Figure 1).
In this study, their video with the filename VideoA.avi was used, which has a duration of 25 s, resolution 3696 × 4994, frame rate 24 Hz and has been stabilized and orthorectified at a ground sampling distance of 0.01 m/px. The video was sub-sampled at 4 Hz because, according to Pearce et al. [16], this frequency exhibited the best sensitivity analysis scores for LSPIV. The ADCP measurements at cross-section S1 ( Figure 1) were used to evaluate the performance of the Monte Carlo simulations and filters. In order to geo-reference the frames, the coordinates of three ground control points are related to the corresponding coordinates in the image. The ground control points with coordinates (8.77 3.57), (15.96 3.60), (26.00 30.19) correspond to the pixels (1341 1002), (1335 1717) and (3988 2700) of the frames. The velocity that corresponds to 1 px displacement of a feature between two successively processed frames is 0.04 m/s.
The centers of the IAs of Free-LSPIV were aligned relative to the line of the ADCP boat motion (see 'S1' in Figure 6 of Pearce et al. [16] and in Figure 1 below). The Free-LSPIV configuration was the following: sub-sampling = 1/6; V up = 0.5 m/s; number of IAs = 40; projection = 'similarity'. Figure 2 displays the 90% confidence intervals of the surface velocities along the cross-section S1, the surface velocities after filtering and the corresponding ADCP V s measurements (obtained from Figure 8 of [16]). The ratio ω is 0.57.
According to Figure 2, the filtered velocities are relatively good estimates of the surface velocities at this cross-section. This estimation is slightly better than the LSPIV profile given by Pearce et al. [16] in their Figure 8A. The reference discharge is Q ref = 2.75 m 3 /s. The estimated discharge obtained from the unfiltered velocities (the 50% points in Figure 2) is Q 50 = 2.39 m 3 /s, which is 13% lower than the reference discharge. The estimated discharge obtained from the filtered velocities (the continuous red line in Figure 2) is Q f = 2.39 m 3 /s, which is 13% lower than the reference discharge.

Castor River
The Castor River is located in Eastern Ontario, Canada. The width of the surface of the river at the location of the hydrometric survey is 23 m. The mean flow velocity is 1.3 m/s, the river's maximum depth is 1.19 m and the discharge is 30.5 m 3 /s [17].
Perks et al. [17] have made the ADCP measurements that they made on the 10 April 2019 at 11:22:39 and the frames of the video that they recorded on the same day at 11:25:00 publicly available. The video presents a significant density of distinct features (reflections from ripples). The original video was recorded from a height of 5 m above the left bank (looking downstream) at an oblique angle of 57°from the nadir, with a resolution of 2688 × 1520 px and a frame rate of 20 Hz.
Perks et al. [17] have made publicly available 540 frames with ID numbers ranging from 00051 to 00590 (the first 50 frames of the video were withheld because they suffered compression issues). The frames have been orthorectified at a ground sampling distance of 0.01 m/px with a resolution of 4515 × 6063. The size of the file of each frame is 2 MB, whereas the size that each frame occupies in computer memory is 27 MB. In order to achieve high computational speed for the Monte Carlo simulations, all frames need to be loaded simultaneously in the computer memory instead of being accessed sequentially from the storage device. For this reason and because of memory constraints, only the first 40 frames with the ids from 00051 to 00090 were used in our study. In order to geo-reference the frames, the projection 'non-reflective similarity' was selected. The coordinates of the two first pixels on the diagonal of a frame, (1 1) and (2 2), are assumed to correspond to coordinates (0 0) and (0.01 0.01) in the real world (displacement of 1 pixel equals the ground sampling distance, which is 0.01 m/px). The velocity that corresponds to 1 px displacement of a feature between two successively processed frames is 0.2 m/s. The centers of the IAs of Free-LSPIV were aligned to the line of the ADCP boat motion (see the wire in Figure 3). The coordinates of this line were obtained from the file Reference_Castor_002.xlsx, which is included in the publicly available data of Perks et al. [17]. The Free-LSPIV configuration was the following: sub-sampling = 1; V up = 4 m/s; number of IAs = 40; projection = 'non-reflective similarity'.  According to Figure 4, the filtered velocities estimate the velocity profile very well. This performance can be attributed to the high seeding density with distinct natural features. The reference discharge is Q ref = 28.51 m 3 /s. The estimated discharge obtained from the unfiltered velocities (the 50% points in Figure 4) is Q 50 = 29.44 m 3 /s, which is 3% higher than the reference discharge. The estimated discharge obtained from the filtered velocities is Q f = 28.94 m 3 /s, which is 2% higher than the reference discharge.

La Morge
The La Morge River is located in Southern France. The width of the surface of the river at the location of the hydrometric survey is 7.2 m. The mean flow velocity is 0.39 m/s, the maximum depth is 0.61 m and the discharge is 1.32 m 3 /s [17].
Perks et al. [17] have made publicly available the current-meter measurements made on 11 October 2018 and the video that was recorded on the same day. The video is characterized by a significant density of large and distinct artificial seeding materials (corn chips), which, however, are concentrated in the middle of the cross-section ( Figure 5). The original video was recorded from a camera attached to the edge of a three-meter-long mast on the right bank. The original video has a resolution of 640 × 480, a frame rate of 5 Hz and a duration of 10 s (48 frames in total). The publicly available video has been stabilized and orthorectified at a ground sampling distance of 0.01 m/px. The resolution of the orthorectified video is 1550 × 950 with a frame rate of 5 Hz. In order to geo-reference the video, the 'non-reflective similarity' projection was selected. The coordinates of the two first pixels on the diagonal of a frame, (1 1) and (2 2), are assumed to correspond to the local coordinates (0 0) and (0.01 0.01) of the real world. The velocity that corresponds to 1 px displacement of a feature between two successively processed frames is 0.05 m/s. The centers of the IAs of Free-LSPIV were aligned along Transect 001 ( Figure 5). The coordinates of this line were obtained from the file Cross-Section.xlsx, which is included in the publicly available data of Perks et al. [17]. The Free-LSPIV configuration was the following: sub-sampling = 1; V up = 1.5 m/s; number of IAs = 30; projection = 'non-reflective similarity'. Figure 6 displays the 90% confidence intervals along Transect 001, the filtered velocities and the corresponding current meter measurements (not exactly measurements, but the corresponding mean velocity, which was obtained from the file streamgauging_sheet_ midsection.xlsx, was divided by 0.85). The ratio ω is 1.49. The wide confidence interval can be attributed to the low resolution of the video and the lack of features near the banks. According to Figure 6, the filtered velocities estimate satisfactorily the surface velocities. The reference discharge is Q ref = 1.32 m 3 /s. The estimated discharge obtained from the unfiltered velocities (the 50% points in Figure 6) is Q 50 = 1.18 m 3 /s (the depths of Transect 001 were obtained from Cross-Section.xlsx), which is 10% lower than the reference discharge. The estimated discharge obtained from the filtered velocities (the continuous red line in Figure 6) is Q f = 1.17 m 3 /s, which is 11% lower than the reference discharge.

Murg River
The Murg River is located in Northeast Switzerland. The width of the surface of the river at the location of the hydrometric survey is 12 m. The mean flow velocity is 1 m/s, the river average depth is 0.35 m and the discharge is 2.76 m 3 /s [18].
Detert et al. [18] have made publicly available the ADCP measurements made on 6 April 2016 and the frames of the video recorded on the same day. In order to enhance the accuracy of the image velocimetry method, spruce wood chips were spread over the water surface, which appear to be reaching the cross-section after Frame 00100. The original video was recorded from a UAS hovering 30 m above the surface, with a resolution 4096 × 2160, frame rate 12 Hz and a duration of 2 min 11 s, resulting in 1000 frames.
The publicly available frames have been stabilized and orthorectified at a ground sampling distance of 0.0156 m/px. In order to geo-reference the video, the 'non-reflective similarity' projection was selected. The coordinates of the two first pixels on the diagonal of a frame, (1 1) and (2 2), are assumed to correspond to the local coordinates (0 0) and (0.0156 0.0156) in the real world. The velocity that corresponds to 1 px displacement of a feature between two successively processed frames is 0.19 m/s. The centers of the IAs of Free-LSPIV were aligned along the cross-section of the ADCP path. The coordinates of this line (see the wire in Figure 7) were obtained from the file Reference_Data_Murg.xlsx, which is included in the publicly available data of Perks et al. [17]. The Free-LSPIV configuration was the following: sub-sampling = 1; V up = 4 m/s; number of IAs = 30; projection = 'non-reflective similarity'.
Artificial seeding reaches the cross-section after Frame 00100. This is taken advantage of in identifying the impact of seeding on the accuracy of the image velocimetry estimation. For this reason, Free-LSPIV was applied separately to two ranges of frames, the first range included the first 90 frames, whereas the second range included the 100 frames after Frame 00100. Figure 7 displays a frame from the first range, whereas Figure 8 displays a frame from the second range.   Figure 9 displays the 90% confidence intervals for the first 90 frames along the crosssection of the ADCP path, the filtered velocities and the corresponding ADCP V s measurements (V s taken to be equal to the measurements made at 0.14 m below the water surface, available from the file Reference_Data_Murg.xlsx). The ratio ω is 1.68. The wide confidence interval reflects the low density of the features on the water surface.
According to Figure 9, the filtered velocities tend to overestimate the velocity profile. The reference discharge is Q ref = 2.64 m 3 /s. The estimated discharge obtained from the unfiltered velocities (the 50% points in Figure 8) is Q 50 = 3.36 m 3 /s, which is 27% higher than the reference discharge. The estimated discharge obtained from the filtered velocities (the continuous red line in Figure 9) is Q f = 3.05 m 3 /s, which is 16% higher than the reference discharge.   According to Figure 10, the filtered mean values of the Monte Carlo simulations slightly overestimated the velocity profile. The reference discharge is Q ref = 2.64 m 3 /s. The estimated discharge obtained from the unfiltered velocities (the 50% points in Figure 10) is Q 50 = 3.17 m 3 /s, which is 20% higher than the reference discharge. The estimated discharge obtained from the filtered velocities (the continuous red line in Figure 10) is Q f = 3.06 m 3 /s, which is 16% higher than the reference discharge.

Salmon River
The Salmon River is located in British Columbia, Canada. The width of the surface of the river at the location of the hydrometric survey is 59 m. The mean flow velocity is 0.65 m/s, the river's maximum depth is 1.08 m and the discharge is 22.9 m 3 /s [17].
Perks et al. [17] have made publicly available the measurements made using a Flow-Tracker handheld acoustic Doppler velocimeter on 4 June 2019 (measurements only at 60% of the depth) and the frames of the video recorded on the same day. The water is very clear (features on the bottom can be easily seen) with a low density of features on the water surface. The original video was recorded from a UAS hovering 102 m above the surface. The original video has a resolution of 1920 × 1080 px, a frame rate of 24 Hz and a duration of 1 min resulting in 1457 frames.
The publicly available frames have been stabilized and orthorectified at a ground sampling distance of 0.01 m/px. These frames are offered by Perks et al. [17] at a resolution of 16001 × 11001. This resolution requires 176 MB to store a single frame in memory (grayscale with 1 byte per pixel). For this reason, these frames were resized to 50%, which resulted in a ground sampling distance of 0.02 m/px and a size in memory of 44 MB. In order to geo-reference the video, the 'non-reflective similarity' projection was selected. The coordinates of the two first pixels on the diagonal of a frame, (1 1) and (2 2), were assumed to correspond to the local coordinates (0 0) and (0.02 0.02) in the real world. Sub-sampling to a frame rate of 6 Hz was employed. For this reason, three frames are skipped for each frame processed. In total, 76 frames were used starting with Frame 1 and ending with Frame 297. The velocity that corresponds to 1 px displacement of a feature between two successively processed frames is 0.12 m/s. The centers of the IAs of Free-LSPIV were aligned along the measured cross-section. The coordinates of this line (see Figure 11) are provided by the file 08HD006_20190604_ velocity validation.xlsx, which is included in the publicly available data of Perks et al. [17]. The Free-LSPIV configuration was the following: sub-sampling = 1/4; V up = 3 m/s; number of IAs = 40; projection = 'non-reflective similarity'. Figure 11. Extracted frame from Salmon River video [17]. Figure 12 displays the 90% confidence intervals along the cross-section of FlowTracker measurement, the filtered velocities and the corresponding flow measurements (not exactly measurements, but the measurements at 60% of the depth divided by 0.857, see 08HD006_20190604_velocity validation.xlsx). The ratio ω is 1.14. The confidence interval becomes very wide close to the river banks because of the lack of features on the surface at these areas. According to Figure 12, the filtered mean values of the Monte Carlo simulations estimate the surface velocities relatively well. The reference discharge is Q ref = 22.9 m 3 /s. The estimated discharge obtained from the unfiltered velocities (the 50% points in Figure 12) is Q 50 = 25.11 m 3 /s, which is 11% higher than the reference discharge. The estimated discharge obtained from the filtered velocities (the continuous red line in Figure 12) is Q f = 23.9 m 3 /s, which is 5% higher than the reference discharge.

River Thalhofen
River Thalhofen is located in Southern Germany. The width of the surface of the river at the location of the hydrometric survey is 26 m. The mean flow velocity is 1.7 m/s, the river's maximum depth is 1.45 m and the discharge is 52.52 m 3 /s [17].
Perks et al. [17] have made publicly available the ADCP measurements made on 27 July 2017 and the video was recorded on the same day. The camera was fixed at the right bank (looking downstream) with an angle of 25°from the nadir and 85°from the flow direction. The video duration is 2 s at a resolution of 1280 × 800 px and a frame rate of 30 Hz. The water surface exhibits a good density of distinct figures (turbulence structures). The medium resolution and the oblique camera configuration have resulted in diminished information density at the frame areas corresponding to the more distant (from the camera) locations ( Figure 13, areas to the right side). The publicly available frames have been stabilized and orthorectified at a ground sampling distance of 0.01 m/px. The coordinates of the frame pixels (2748 650) and (0 651) are assumed to correspond to the local coordinates (2 0) and (27.92 0.01) in the real world. The velocity that corresponds to 1 px displacement of a feature between two successively processed frames is 0.28 m/s. The centers of the IAs of Free-LSPIV were aligned along the cross-section of the ADCP path. The coordinates of this line (see the wire in Figure 13) are provided by the file Thalhofen_Transect_0.xlsx, which is included in the publicly available data of Perks et al. [17]. The Free-LSPIV configuration was the following: sub-sampling = 1/1; V up = 4 m/s; number of IAs = 40; projection = 'non-reflective similarity'. Figure 14 displays the 90% confidence intervals of the surface velocities along the cross-section of the ADCP path, the filtered velocities and the corresponding ADCP V s measurements (V s taken equal to the measurements made at 0.22 m below the water surface, available from the file Thalhofen_Transect_0.xlsx). The ratio ω is 0.72. The confidence intervals become wider at the distant (from the camera) locations.
According to Figure 14, the filtered velocities estimated the velocity profile relatively well at the locations close to the camera, but the estimates become progressively less accurate. The reference discharge is Q ref = 46.54 m 3 /s. The estimated discharge obtained from the unfiltered velocities (the 50% points in Figure 14) is Q 50 = 46.51 m 3 /s, which is very close to the reference discharge. The estimated discharge obtained from the filtered velocities (the continuous red line in Figure 14) is Q f = 42.46 m 3 /s, which is 9% lower than the reference discharge.

Discussion
According to the results of the case studies, the ratio ω provides useful information on the accuracy of the estimated surface velocities. For example, in the case of Murg River, the value of ω corresponding to surface velocities obtained from the frames with artificial seeding is significantly lower than the value without seeding. A close look at Figures 9 and 10 reveals a greater deviation of the estimated surface velocities from the reference values in the former. It should be noted that in this case, the Monte Carlo simulations and the proposed filters balance out the overall error (the error of the Q f is 16% in both seeded and unseeded range of frames in the Murg River case study).
The shape of the confidence interval across the surface width provides useful information about the spatial structure of the uncertainty along the cross-section. For example, in the case of the La Morge River, Salmon River and Murg River with artificial seeding, the confidence interval width was significantly greater at the areas close to the river-banks. This increased width was proved a posteriori to be related to increased error at these locations. This kind of poor performance near the banks has been observed by other researchers too. For example, in the study of Ioli et al. [25], Fudaa-LSPIV with the BASESURV filter overestimated the flow velocity (compared to that measured with a current meter) at one bank (see Figure 5 in their study), where fewer features were present on the water surface. Another characteristic spatial structure of uncertainty has been observed in the case of the Thalhofen River, where the confidence interval width was gradually increasing with the distance from the camera. A similar effect has been observed by Le Coz et al. [14] and was attributed to the decreasing spatial resolution of the raw image pixels with the distance from the camera due to the non-vertical grazing angle. In all these cases, a strong correlation of the confidence interval width with the position reflected a poor performance of the Free-LSPIV algorithm at the locations with increased width.
In those cases where the lack of features resulted in increased uncertainty near the banks, the filtering algorithm successfully detected and removed the unrealistically large velocity estimates (see the La Morge River and the Salmon River). However, the lack of features near the banks was not always the reason for the deviation from the reference values. For example, in the study of Kolubara River by Pearce et al. [16], the features were evenly distributed along the entire cross-section. As a result, the confidence interval width near the banks was not significantly different from that at the other cross-sectional locations ( Figure 2). Despite this fact, not only the filtered V 50 of our study (Figure 2) but also all six image velocimetry algorithms employed by Pearce et al. [16] deviated significantly from the reference values at these locations (see Figure 8 in [16]). Pearce et al. [16] have commented on this: "It is also likely that the ADCP would produce a bias towards higher velocity magnitudes near high-slope channel edges, due to interference of signal from shallow, low-velocity zone, with high velocity signal from deeper zone towards the center of the channel". If this is the case, then this deviation cannot be considered an error of the image velocimetry methods.
In the case of the Kolubara River, Pearce et al. [16] have estimated the surface velocities at three cross-sections, S1 (the only one used here), S2 and S3. The results they obtained in S1 were similar to the results displayed in Figure 2. Notably, the results they have obtained in S3 (20 m downstream of S1) from the exact same video were consistently 20% higher than the ADCP V s measurements. Pearce et al. [16] have attributed this deviation to "the irregular bathymetry that in turn leads to variable flow regimes". A similar hydrodynamic mechanism could be the reason for the deviation of Free-LSPIV from the ADCP measurements in the Murg River ( Figure 10). The reason for suspecting the existence of such a mechanism is the high variation of the ADCP V s measurements (much higher than that of the other case studies).
The results of the six case studies are summarized in Table 1. The only case where the suggested filters deteriorated the performance was the Thalhofen River, a case with an oblique camera angle and low video resolution.

Conclusions
This study has focused on the endogenous uncertainty of the image velocimetry algorithms. This uncertainty is mainly introduced by the parameters that influence the sensitivity of the algorithm. The optimum value of these parameters varies significantly with the characteristic of each case study (video resolution, camera orientation and stabi-lization, presence of moving objects irrelevant to the flow, illumination conditions, etc.) and cannot be estimated a priori to achieve the optimum signal-to-noise ratio. For this reason, in this study, the Monte Carlo simulations have been employed to quantify the uncertainty regarding the optimum values of these parameters. Monte Carlo simulations are well-known to be highly CPU intensive. This can be considered as a limitation of the suggested approach.
This approach was tested in six case studies of which the data have been previously made publicly available by independent researchers. The following conclusions were drawn after the assessment of the results: 1.
The 50% percentiles of the surface velocities along the cross-section (i.e., the value that is greater than 50% of the corresponding velocities of the Monte Carlo simulations) are a good estimate of the surface velocities of the cross-section. This estimation is obtained without requiring expertise or trial-and-error procedure to select the optimum parameter values of the image velocimetry method.

2.
Various filters can be devised to take advantage of the Monte Carlo simulations and to discard the estimates of the image velocimetry that have increased uncertainty. For example, the estimates with confidence interval width greater than the average confidence interval width by 20% may be discarded.

3.
Specifically, for the locations near the banks and in the case of high uncertainty there (as defined in the previous filter), the plausible assumption of lower velocities due to increased resistance (or shear) near the banks results in the idea of improving the estimation by using low percentiles (e.g., 5%) as an optimum estimate instead of the 50% far from the solid boundary. 4.
The shape of the confidence intervals can provide indications for the existence of specific kinds of uncertainty sources. An increased confidence interval width near the banks indicates a probable lack of features in these areas. A gradually increasing confidence interval width indicates decreased spatial resolution with the distance from the camera because of an oblique camera angle and low recording resolution.
Image velocimetry is becoming increasingly popular because it is not an expensive and demanding method concerning the required equipment. Furthermore, image velocimetry methods not only reduce the overall workload but also save hydrologists from the need to step into the flow, which is prohibitive in extreme floods and is dangerous, in some cases, even in moderate flows. The only demanding fieldwork is the careful definition of ground control points. This study showed that additional information regarding streamflow velocities can be extracted from videos by employing Monte Carlo simulations. It is clear that, in addition to the careful preparatory fieldwork, meticulous office work is required to fully benefit from the advantages of the image velocimetry methods.

Conflicts of Interest:
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses or interpretation of data; in the writing of the manuscript or in the decision to publish the results.