Comparison of dense optical flow and PIV techniques for mapping surface current flow in tidal stream energy sites

Marine renewable energy site and resource characterisation, in particular tidal stream energy, require detailed flow measurements which often rely on high-cost in situ instrumentation which is limited in spatial extent. We hypothesise uncrewed aerial vehicles (UAV) offer a low-cost and low-risk data collection method for tidal stream environments, as recently techniques have been developed to derive flow from optical videography. This may benefit tidal and floating renewable energy developments, providing additional insight into flow conditions and complement traditional instrumentation. Benefits to existing data collection methods include capturing flow over a large spatial extent synchronously, which could be used to analyse flow around structures or for site characterisation; however, uncertainty and method application to tidal energy sites is unclear. Here, two algorithms are tested: large-scale particle image velocimetry using PIVlab and dense optical flow. The methods are applied on video data collected at two tidal stream energy sites (Pentland Firth, Scotland, and Ramsey Sound, Wales) for a range of flow and environmental conditions. Although average validation measures were similar (~ 20–30% error), we recommend PIVlab processed velocity data at tidal energy sites because we find bias (underprediction) in optical flow for higher velocities (> 1 m/s).


Introduction
Marine renewable energy offers electricity generation from highly predictable sources [1][2][3]. Both offshore wind and tidal energy are being developed globally to move towards a net-zero carbon future. Flow data in such developments are routinely collected for a variety of reasons, such as initial site characterisation [4], device micro-siting [5] and flow around structures and turbines [6,7].
Data collection for marine renewable energy site selection, resource characterisation and turbine placement often involves fixed seabed instrumentation or boat-based measurements such as Acoustic Doppler Current Profilers (ADCP). Bottom-mounted ADCPs provide a point-based measurement in a single location, whilst boat-based ADCP measurements are non-synchronous and typically of a low spatial resolution. ADCP measurements, whilst still essential, do carry high risk and cost. X-band radar is an effective method of deriving surface currents over a large area and has been used in tidal flows [8], however comes with high instrument and operating costs, particularly in remote environments. Small UAV technology is increasingly accessible with consumer off the shelf UAVs providing flexible platforms with high-quality video and effective battery life at a relatively low cost. These systems have been increasingly used in marine science [9]. UAV surveys incur less financial risk, and less physical risk, as the UAVs are typically lightweight and highly manoeuvrable [10].
For the marine renewable industry, video-derived flow will provide a valuable addition to existing data capture methods, measuring surface flow in a low cost and low-risk way. Capturing flow over a large spatial area is extremely useful throughout the lifecycle of a floating or seabed development enabling initial site sift and selection, characterisation, device micro-siting and flow-structure analysis over different periods.
Flow derived from optical videography began as a laboratory technique originally derived from laser-based particle measurements [11]. Flow derived from downward-looking video offers a way of measuring surface flow over a large spatial area capturing fine spatio-temporal detail of flow characteristics. UAV-derived video can also provide an additional tool to rapidly define surface flow characteristics such as high-velocity jets and other turbulent features in tidal streams; therefore, UAVs could offer an essential tool for the tidal energy industry. Various methods are available for deriving flow from video, each with advantages and disadvantages; however, their applicability to tidal energy site characterisation is unknown. Here, we compare two methods: large-scale particle image velocimetry (LSPIV) and Gunnar-Farneback dense optical flow.
Particle tracking techniques have been increasingly used for flow measurement in rivers [12][13][14][15][16]. LSPIV relies on the flow being seeded with artificial or natural particles and is highly accurate in a wide variety of natural flow conditions [17]. However, LSPIV does have drawbacks, as the technique relies on natural particles such as foam or debris on the surface; insufficient particles require artificial seeding which is labour intensive and not appropriate for tidal environments on a large scale. The technique also has a reduced ability to derive flow from a low-intensity image gradient [18]. However, it has been shown to provide good results when ephemeral turbulent structures advected by the mean flow are tracked, sometimes termed surface structure image velocimetry [19], and it would be this approach that could be used at tidal sites.
PIVlab is a GUI-based particle image velocimetry (PIV) software written in the MATLAB environment [20][21][22]. PIVlab uses a cross-correlation algorithm to derive the most probable particle displacement in small image subsections [20]. PIVlab has been applied to natural environments in the past for extracting river velocity and is accurate when compared with in situ measurement [23][24][25][26][27] and has also been used to estimate river discharge [25,[27][28][29]. Use of PIVlab for measurement of tidal flows, including at tidal stream sites, has been demonstrated [30,31]; however, good results were dependent on site and environmental conditions. Therefore, investigation of alternative surface velocimetry approaches is warranted to seek wider ranging applicability of UAVs for tidal resource assessment.
Various optical flow algorithms are available for surface water movement detection, some of which have been applied to the marine environment [32]. Here, the Gunnar-Farneback dense optical flow is used as a method of deriving flow from consecutive optical images by using pixel intensity and calculating the movements of each pixel between consecutive frames [33]. This has the benefits of being less computationally expensive and does not require seeded particles to calculate flow. Disadvantages are the technique assumes spatial smoothness whereby surrounding pixels are assumed to have the same general movement of the target pixel. The technique also requires consistency in pixel intensity between frames. The Gunnar-Farneback method of optical flow has been cited to be potentially useful for natural flow conditions [33][34][35]. The Gunnar-Farneback method is a two-frame motion estimation based on polynomial expansion [33]. The technique uses a neighbourhood around each pixel to identify its most likely movement between two frames and utilises a pyramid decomposition which enables the algorithm to handle large pixel motions, where pixel displacements are greater than the neighbourhood size.
Although both these techniques have been well established in the fluvial environment and applied to surf-zone currents [36,37], optical flow approaches have yet to be tested in oceanic waters with different surface characteristics. This study tests whether the optical flow algorithm offers a more reliable way to inform on surface water flow in a tidal channel with relevance to the tidal energy industry.
This study compares field measurements of flow speeds in tidally energetic channels between LSPIV utilising PIVlab and dense optical flow techniques using the Gunnar-Farneback algorithm. The objectives of this study are to compare two velocimetry techniques, LSPIV and optical flow, against underway ADCP data and drifter data using short downward-looking videos of a section of tidal flow. Further, the study will test the techniques in two well understood tidal energy sites to test the effects of differing environmental conditions on the techniques and to understand the transferability of the technique to different sites.

Experimental and study sites
Data were collected from two energetic tidal channels targeted for renewable energy developments, the Inner Sound of the Pentland Firth in the North of Scotland, and Ramsey Sound in Wales. The sites were chosen as representative test cases for this study for the purpose of being able to transfer the techniques used here to other less understood sites. The Inner Sound is a tidal channel that separates the Orkney Islands from Mainland Scotland (Fig. 1). The Inner Sound is being developed as a tidal energy site and currently has active turbines deployed in the channel at the time of writing. The channel is a constriction between the Atlantic Ocean and North Sea producing fast tidal currents over 3 m/s in places [4]. The mean water depth is 19 m with a maximum of approximately 36 m in the channel. Due to the flow speed, high levels of turbulence are present in the Inner Sound. One common turbulent feature is the presence of kolk boils [10]. Kolk boils are rotating vertical plumes of water associated with obstacle interaction and high shear near the seabed where vortices are formed which emigrate towards the surface. They present on the surface often as smooth circular or semi-circular areas of water due to the eruption of vertical flow and water displacement.
Ramsey Sound lies between the island of Ramsey and the Welsh mainland ( Fig. 1). It has long been a focus for tidal stream energy extraction: the Tidal Energy Ltd. Del-taStream device was deployed in 2015. Tidal renewable energy in Wales is an emerging market with several companies receiving funding to develop the sector and deploy devices connected to the national grid. Cambrian Offshore is redeveloping the Ramsey Sound site with aim of deploying a tidal turbine in the channel.
The current regime in Ramsey Sound is forced by a progressive tidal wave, meaning that peak flows are around high and low water; current speeds in Ramsey Sound are up to 3 m/s [38,39]. The bathymetry in the area is highly variable leading to both spatial and temporal (flood versus ebb) differences in turbulence metrics [5] and hence the surface features required for surface velocimetry. The mean depth is 20 m, whilst maximum depth is approximately 70 m.

UAV surveys
At both sites, short stationary hovers recording video were carried out for several minutes at a time. In addition, boatbased ADCP and GPS drifters were used to provide validation measurements for UAV-derived surface flow measurements. UAV and validation techniques were different between the two sites due to site conditions, but the experimental methodology was designed to be comparable.

Inner Sound
Fieldwork at the Inner Sound was conducted on the 2nd of May 2021. GPS drifter recovery challenges in fast flows and a highly exposed site meant only boat-based ADCP measurements were conducted at the Pentland Firth site. A downward-looking Teledyne Workhorse Sentinel 600 kHz ADCP was used with a blanking distance of 0.88 m at a depth of 1.78 m which provided clearance of the boat hull. The ADCP was set to ping as fast as possible with an approximate ping rate of 2 Hz with data averaged over 1-s intervals. Bin depths were set to 2 m. The first depth bin was used to compare with the video-derived flow (depth bin of 2.66 -4.66 m). Boat speed was kept to a minimum (2 knots) during the ADCP transects, with position recorded by D-GPS and bottom-tracking enabled. ADCP transects were carried out immediately after the UAV flight.
A DJI Phantom 4 Pro 2.0 UAV was used at the Inner Sound with standard GPS. The wind speed during the survey was < 10 knots with overcast consistent lighting conditions. The UAV was orientated with the long axis (width) of the video recording in parallel to the current flow direction at altitudes of 120 m above sea level and downward-facing nadir video. As flights are over the open water, no ground control points are possible for georectification. Instead, GPS coordinates from the flight log data of the centre of each image frame were used. The mean of the GPS coordinate was used for all GPS points acquired in the flight log over the length of the stationary hover video (1 min). For the Inner Sound data, the drift around the central hover point was < 1 m with a mean GPS horizontal dilution of precision (HDOP) of 0.54 over the duration of the video clip. The video recording mode was 30 frames per second with an image size of 4096*2160 pixels. The ground resolution was calculated using the image width of 4096 pixels, sensor The video excerpt for this study was 60 s in length, comprising 1800 frames.
For dense optical flow, the mean GPS position from the flight log throughout the video was used to rectify the images with the calculated image height and width. Yaw from the flight log was used for image rotation from geographic north. No lens correction was carried out as the lens distortion on these consumer UAVs has been reported as being very low [40] and would be the same for each type of processing method. However, methods do exist to correct for these distortions such as the checkerboard method [41]. Images were calibrated using the length of each image whereby a length is calculated from camera specifications for PIVlab.

Ramsey Sound
Fieldwork at Ramsey Sound was conducted on the 14th of May 2021; five flights were conducted from peak current down to slack water. Nadir videos of 60-s duration were made of the flow at altitudes of 120 m, again with the long axis parallel to the flow direction; eleven videos were selected for analysis where there was good overlap with validation data. Weather conditions were variable with wind speeds up to 6.3 mph and a cloudless sky. All videos had bright, constant illumination with sun glinting off turbulent surface features; also observable in the imagery were small wind-driven ripples in the same direction as the flow and small standing waves opposing the flow. Validation data were collected with both boat-based ADCP surveys and GPS drifter runs. Four GPS drifters, the design of which is described in Fairley et al. [30], were deployed and recovered from a RIB such that they transited through the field of view of the UAV. It has been shown that the presence of a small number of drifters in the field of view does not impact on results compared to the case with no drifter [30]. At the same time, ADCP transects preceded the UAV video collection. These transects were collected with a similar setup to the Inner Sound transects. WinRiver II software was used to acquire data from a pole-mounted 600 kHz Teledyne Sentinel ADCP. GPS and wind data were incorporated from an AIRMAR 200WX meteorological station. The first bin started at 0.82 m below surface, and bin height was 0.5 m. The ADCP was set to ping at 2 Hz; alternating between water profile and bottom track pings to allow for relative vessel motion correction.

Image pre-processing
Prior to processing in PIVlab, individual frames were first extracted from the video to image stills. The image stills had pre-processing steps applied before analysis to improve the measurement quality. For optical flow, video frames were processed on the fly. For comparison of techniques, the same image pre-processing steps were applied to both the optical flow frames and PIV frames. Image pre-processing improved performance in both optical flow and PIV techniques (Fig. 2). The image pre-processing steps applied were in order as follows: • Image was converted to greyscale. •

PIVlab
Various post-processing is available in PIVlab such as smoothing and high-pass filtering. These were not applied to the results for comparison with the optical flow results.
All processing was carried out using an Intel Core i7-2600 k CPU 3.40 GHz with 4 cores. No graphics card processing was used. Three passes of the interrogation window were used within PIVlab with a first pass of 128 × 128 pixels second pass of 64 × 64 pixels and a third pass of 32 × 32 pixels. After the PIVlab processing was complete, the mean vectors were computed from all the consecutive frame vectors, giving temporal mean flow vectors for the entire video clip.

Dense optical flow
MATLAB offers built-in methods for dense optical flow of which there are three algorithms available. Equations for the Gunnar-Farneback dense optical flow algorithm are explained elsewhere [33,34,43]. A MATLAB script was written which reads in the video, performs image pre-processing and dense optical flow. Temporal mean optical flow vectors for each pixel for the whole video were calculated from the sum of all vectors divided by the number of frames in the video.

Image complexity metric
A simple edge-detection algorithm was used to show the difference in image complexity and structures between the Inner Sound and Ramsey Sound. Image segmentation using the Sobel method was carried out on processed greyscale video frames. Sobel edge detection undertakes a spatial gradient measurement on an image where regions of high spatial frequency correspond to edges within the images. Structures on the surface of the water primarily caused by turbulence and foam patches which are beneficial to both optical flow and LSPIV were attempted to be captured by the Sobel edge detection as a metric for the suitability of the video for the flow analysis. Wind ripples present in the Ramsey Sound data were visually measured by tracking individual wind ripple crests between frames. This was done manually by marking the position of individual crests then measuring the distance travelled in pixels.

Inner Sound
A 60-s-long video recorded at 30 frames per second was analysed using PIVlab and Gunnar-Farneback dense optical flow. The video was analysed using every other frame resulting in a total of 900 frames. It could be visually seen that the UAV was at the edge of a fast-flowing jet with slowermoving water also visible to the right. In addition, the video contained a region of active kolk boils in the far left of the video frame, consisting of smooth circular regions which slowly traversed the video frame (Fig. 3).
Visual results (Fig. 3) showed good similarity between the two techniques with general flow patterns being consistent. Both the PIVlab and optical flow averaged results were then geo-rectified for comparison with ADCP data. The ADCP data compared were from a transect immediately after the flight. Point data were extracted from both PIVlab and optical flow rectified TIFF files matching locations of point data from the ADCP data. Linear regression was used to compare the datasets. There was a short difference in time between the UAV survey and the ADCP transect. The UAV flight video began at 13:36:10 and ended at 13:37:40; ADCP measurements were taken from 13:39:55 until 13:43:03.
A linear fit between ADCP magnitude and PIVlab generated magnitudes derived an r-squared value of 0.47, with 0.74 RMSE for y = x and a p-value of < 0.001 for a sample group of 72 measurements. A linear fit between ADCP magnitude data and optical flow derived magnitude derived an r-squared value of 0.47 with 0.61 m/s RMSE for y = x, and p-value of 0.001. When the magnitude values derived from PIVlab and optical flow were compared with each other, this yields a linear fit derived r-squared value of 0.98 with 0.24 m/s RMSE for y = x, and p-value of < 0.001 (Fig. 4, Table 1). For directional comparison, when comparing ADCP directions with PIVlab directions 37% were within 10 degrees and 79% within 30 degrees. Directions derived from optical flow compared to ADCP measurements were move favourable, with 49% within 10 degrees and 84% within 30 degrees. Comparing PIVlab against optical flow, 37% were below 10 degrees of difference and 96% were below 30 degrees. Figure 5 plots ADCP velocity with ADCP error velocity coded in colour plotted against the longitude. The ADCP error velocity is the difference between two estimates of vertical velocity and offers a built-in means to estimate ADCP data quality. Also plotted are the derived velocity estimates for each ADCP data point from optical flow and PIVlab results from a mean flow of all frames from the 60-s video clip. The optical flow and PIVlab results were georectified to extract each flow point at each ADCP data point position. A mismatch between the PIVlab/optical Flow and ADCP results can be seen between approximately -3.14° and -3.1406° longitude (Fig. 5), where a jet-like feature was present on the mean optical flow and PIVlab results.

Ramsey Sound
Results from Ramsey Sound show similar patterns between video-derived current methods against both validation measures, for both ADCP and surface drifters (see Fig. 6 and Table 2). Both methods performed similarly at lower velocities (Fig. 6, left), but optical flow did not perform as well as PIVlab in flows exceeding 1 m/s. For higher measured velocities, optical flow underpredicted the velocity, whereas PIVlab matched the measurements better. This is   problematic for optical flow because it is higher velocity regions that tidal stream developers are most interested in. A similar comparison for all equivalent points in the images for both PIVlab and optical flow shows the same pattern (Fig. 6, right). Table 2 gives error and correlation statistics for the two methods and sets of validation data. Root mean squared errors are better for the PIVlab results, but the differences in mean percentage error are lower; this is because for optical flow the errors are greater at higher velocities.

Image complexity
The differing effectiveness of each technique may be explained by image complexity or 'clutter', as these features are required for tracking to obtain video-derived current. By using the Sobel edge-detection algorithm, a comparison of information present in the images for flow analysis can be made to investigate the differing effectiveness of each technique. For each video, 30 individual frames were processed with Sobel edge detection. All pixels which were defined as an edge were summed as a percentage of total pixels in each image. For the Ramsey Sound video clip during low-speed current conditions, close to tidal slack water (Ramsey Sound, slow, Fig. 7), the 30 individual frames treated with Sobel edge detection resulted in 10.00% mean, 10.24% maximum and 9.70% minimum percentage of edge pixels with an IQR of 0.19. Fast current conditions close to peak flow (Ramsey Sound, fast, Fig. 7) had 4.58% mean, 4.65% maximum and 4.50% minimum percentage of edge pixels with an IQR of 0.03. The Inner Sound frames had 14.20% mean, 16.20% maximum and minimum of 13.50% with an IQR of 0.312. The two sites yielded differing imagery due to the scales of turbulent features and wind conditions (Fig. 7). Figure 7 shows the result from the first individual frame of each video showing a low percentage of detected edge pixels for both Ramsey Sound slow and fast current conditions, whilst a greater number of detected edge pixel in the Inner Sound site.
Visually the presence of wind ripples in the Ramsey Sound data are the dominant surface feature. By tracking ripple crests in MATLAB and measuring distance travelled, wind ripples were estimated to be progressing at 0.98 m/s during measurement in low current conditions and 0.75 m/s during measurement in the fast current conditions. The wind ripples moved across the surveyed area at an approximately 25-degree angle to the current flow direction during data collected at fast flow conditions and in the same direction as current propagation during low flow conditions with wind ripple wave speed velocities between 0.75 m/s and 1 m/s. Ripple wave speed was estimated by measuring wavelength of several wind ripples in pixels. Wave frequency was estimated by threshold segmenting an individual frame, taking a pixel intensity profile and running fast Fourier transform (FFT) analysis on the signal. Similar wind ripple wave speeds were found when directly measuring the progress in pixels of individual ripple crests between frames (approximate 1 m/s).
By running optical flow on two individual frames rather than an average of all frames, wind ripples are the dominant feature in terms of the estimated flow with the vast majority of flow vectors in line with wind ripple direction and speed (Fig. 8).

Discussion
UAV surveys were undertaken in two tidal stream sites both of which are being developed for tidal stream energy, with turbines already operational in the Inner Sound, Pentland Firth, and previous turbines planed for deployment in Ramsey Sound. The aim of this paper was to compare two methods of deriving flow from downward-looking optical video footage, comparing PIVlab (LSPIV) and the Gunnar-Farneback (dense optical flow). Both LSPIV and dense optical flow techniques are shown to be suitable for the derivation of flow from optical videos in these environments; however, results here indicate the LSPIV method may be more effective in tidal stream sites.
The flight altitude of 120 m was chosen as the maximum in the UK at which a UAV can operate without special permission and offers an acceptable spatial coverage for tidal channel data capture of the order of 110*210 m per frame. Reasonable agreement between ADCP data in the Inner Sound using the dense optical flow and PIVlab may indicate that this flying altitude and resolution are suitable for the measurement of flow at these locations. The effect of flying altitude on LSPIV and optical flow has been investigated in other environments; higher flying altitude resulted in lower resolution and poorer results from LSPIV with a comparable UAV [17], albeit in a riverine environment. The altitude, resolution and coverage, together with spatial and temporal averaging, eventually becomes an application-specific trade off, for example spatial coverage of a tidal stream site for initial site selection and sift.
From a processing perspective, optical flow simplifies processing, as analysis can be performed directly from the video using a single script. PIVlab requires frames to be extracted as greyscale images, then pre-processed prior to LSPIV analysis. The block correlation method of LSPIV is more computationally expensive than the optical flow algorithm, although it can be run under parallel processing in the MATLAB environment and is available under the Python language with GPU support via the OpenPIV software library. The Gunnar-Farneback dense optical flow algorithm is also implemented in the Python-based OpenCV library which supports GPU processing to greatly increase processing speeds.

Inner Sound
Similarity in flow magnitude and direction to the ADCP data was sufficient to show the validity of both PIVlab and optical flow techniques for the Inner Sound data. However, in some parts of the flow, there were large differences between the calculated flow speed by optical flow and PIVlab and the ADCP results. The differences observed may be partially explained by non-concurrent ADCP and UAV flights, with ADCP measurements beginning 2 min and 15 s after the UAV flight in these highly spatio-temporally variable environments. Furthermore, ADCP measurements were averaged over 1 s whilst flow derived from the video was averaged over the video duration of 60 s. PIVlab derived higher velocities in the area of higher flow indicated by the ADCP results between -3.141° and -3.143° longitude (Fig. 5, the left of the video frame), which resulted in a higher RMSE value between PIVlab and the ADCP values. The higher flow speed resulting from PIVlab may be more realistic to surface velocity. It is expected that surface velocity is greater than ADCP-derived velocity, as the ADCP data are from the first depth bin (2.66 -4.66 m) and not the surface velocity. Assuming a logarithmic velocity profile with depth, surface velocity is expected to be greater; however, further measurements of actual surface velocity using an alternative validation measure would be required to confirm this.
There was a mean difference in flow velocity between the PIVlab and optical flow results of 7.3%. A mismatch in flow speeds was evident in both PIVlab and optical flow between approximately -3.14° and -3.1406° longitude (Fig. 5). This area was associated with a jet of high flow which was fluctuating in time and space during the measurement period. To examine this, an animation was made (Supplementary Material) by processing 20-s slices of the video using optical flow. The mean flow for each 20 s slice was used to construct an animation which showed the jet frequently moving and showing changes in velocity. Therefore, it was possible that this jet was not present during the ADCP transect whilst it was evident in the optical flow and PIVlab results.
The surface expressions of kolk boils were present in the video on the left of the frame. Kolk boils are a turbulent feature associated with bottom obstacles and high shear which are common within the Inner Sound [10]. The surface expression of kolk boils is often a very smooth surface associated with the vertical movement of water. ADCP results indicate that within the area of the kolk boil activity nearsurface velocity was in excess of 1.8 m/s and up to 2.7 m/s. PIVlab derived flow for this area was between 2.1 m/s and 2.5 m/s whilst optical flow derived velocities were between 1.8 m/s and 1.2 m/s. Unlike optical flow, the presence of the kolk boils did not appear to affect PIVlab results where it was thought that the smooth surface may result in a lack of natural tracer particles required for the analysis. However, the kolk boils in the Inner Sound often appear as large-scale features with very smooth surfaces, and where larger kolk boils are present, there may be a large enough area with no trackable features as to affect PIVlab results.
The results show that for this downward-looking video in the Inner Sound tidal channel, PIVlab processing was more accurate when compared to ADCP data than optical flow. However, both results show divergence from ADCP data in one area of flow which can be explained by the difference in sampling time between the ADCP measurements, PIVlab averaging and the fact the ADCP results are below surface. Both PIVlab and optical flow techniques showed reasonable agreement with one another which supports the view that discrepancies between the optical flow and ADCP data may be due to the differences in sampling time and sampled volume between the methods.

Ramsey Sound
Weather conditions differed during data collection in the Ramsey Sound with low wind speeds (6.3 mph). Despite the low wind speeds, the wind present was enough to generate surface wind ripples which are evident in the still images visually. The presence of this signal in the data provided an additional test for the two techniques.
At Ramsey Sound, PIVlab performed better than optical flow (PIVlab, RMSE = 0.24 m/s and 0.28 m/s versus optical flow, RMSE = 0.37 m/s and 0.55 m/s). However, the optical flow results were similar in accuracy to the Inner Sound results. Comparison of both the drifter and ADCP data showed that optical flow had good results in low flow conditions, but poorer results when flow speed increased over 1 m/s. This divergence in flow above 1 m/s was investigated by comparing surface detail between the two sites and doing further processing on individual frames.
PIVlab results showed consistent agreement with both the ADCP data and the drifter speeds. In addition, the accuracy of the PIVlab results increased at higher flow speeds, which are more of an interest to tidal developers given power is proportional to speed squared, and typical turbine cut-in speeds of > 1 m/s. Optical flow assumes spatial smoothness (that neighbouring pixels have similar movement) and brightness consistency where pixel intensity does not change significantly between frames [44]. Illumination was highly consistent between frames, so this latter point is unlikely to be a factor.

Image complexity
Wind conditions, lighting conditions, surface waves and turbulence were observed to affect optical flow results, as observed elsewhere [45]. Analysis of image complexity showed that the Inner Sound video frames contained a greater degree of surface texture, which was evident from both visual comparison and results using edge detection; however, it is noted that the lower amount of surface detail present in the Ramsey Sound data was not so low as to affect either technique where there was still an abundance of trackable features present. The performance of the PIVlab results against ADCP and drifter data provided further evidence that this was not a factor.
Further examination focused on secondary wind ripples which are visually the dominant feature in the Ramsey Sound frames, evident as stripe features seen in the on the greyscale image (Fig. 7). By processing individual frames, it can be seen that these smaller-scale wind ripples, which are migrating over the background tidal flow, violate the first assumption of optical flow (requires spatial smoothness), as these surface structures become more pronounced at higher velocities, and hence the difference between neighbouring pixels. Wind ripples were traveling at approximately 1 m/s, explaining the divergence in results between the ADCP data and the optical flow results where flow speeds exceeded 1 m/s. At higher flow speeds, optical flow results are being dominated by the signature of the surface wind ripples averaging out the underlying tidal flow signal. Optical flow analysis accounts for the movement of all pixels rather than LSPIV using natural particles present on the water surface, and so by considering all pixels, the wind ripple signal has a large effect on the net flow computed by optical flow.

Conclusion
Remote measurement of surface-flow conditions from a small UAV provides a method to rapidly investigate detailed flow conditions in tidal streams over a large spatial scale. Consumer UAVs are now widely available, providing a lowrisk and low-cost method of data collection. Many different algorithms exist for deriving flow from nadir videography; here, two common techniques used widely in the fluvial environment were tested as a potential technique for use by tidal energy developers.
At the Inner Sound site, results between both methods were similar, with reasonable comparison with the ADCP data, except for one area of the video where flow speeds derived from videography were very different from ADCP data. This identified a potential limitation in the methodology of this study whereby the non-concurrent nature of the measurements and ADCP measuring beneath the surface may limit using such datasets for validation given the high spatio-temporal variability in these sites. Potentially future studies may utilise methods of surface-flow validation for videography-derived flow which are similar such as X-band radar with concurrent measurement.
Results from Ramsey Sound highlighted an important consideration when choosing between processing techniques. Ramsey Sound videos were collected in higher wind speeds in the presence of wind ripples which acted as a primary dominant signal for optical flow. PIVlab processed velocity showed good performance in the presence of wind ripples. The optical flow results showed a clear deviation from the validation data in velocities in excess of 1 m/s where optical flow underpredicted flows for higher velocities. As wind ripples are a common feature in many tidal channels, often occurring at different angles to the mean tidal flow, PIVlab processing may be the preferred technique to use in tidal-channel environments.
The results from this study indicate that videography techniques could provide a fast, low-cost and low-risk method of deriving an estimate of flow conditions over a large surface area in the marine environment. However, there are differences between processing techniques and more research is required to investigate the effect of environmental variables and different methods to validate the data. After such investigation, it is recommended that these tools be considered by renewable energy developers as a useful spatiotemporal method of collecting surface-flow data in complement with other techniques. In addition, it may be possible for data collection to be scaled up to satellites to investigate global tidal potential in high detail; optical flow has already been applied to satellite data on a larger scale to measure ocean currents [43]. This might be particularly useful for characterising potential in difficult to reach areas or in developing countries.