Cost and time-effective method for multi-scale measures of rugosity, fractal dimension, and vector dispersion from coral reef 3D models

We present a method to construct and analyse 3D models of underwater scenes using a single cost-effective camera on a standard laptop with (a) free or low-cost software, (b) no computer programming ability, and (c) minimal man hours for both filming and analysis. This study focuses on four key structural complexity metrics: point-to-point distances, linear rugosity (R), fractal dimension (D), and vector dispersion (1/k). We present the first assessment of accuracy and precision of structure-from-motion (SfM) 3D models from an uncalibrated GoPro™ camera at a small scale (4 m2) and show that they can provide meaningful, ecologically relevant results. Models had root mean square errors of 1.48 cm in X-Y and 1.35 in Z, and accuracies of 86.8% (R), 99.6% (D at scales 30–60 cm), 93.6% (D at scales 1–5 cm), and 86.9 (1/k). Values of R were compared to in-situ chain-and-tape measurements, while values of D and 1/k were compared with ground truths from 3D printed objects modelled underwater. All metrics varied less than 3% between independently rendered models. We thereby improve and rigorously validate a tool for ecologists to non-invasively quantify coral reef structural complexity with a variety of multi-scale metrics.


Introduction
Using an array of metrics in studies spanning decades, ecologists have shown that structural complexity drives biodiversity [1][2][3][4]. This is especially true on tropical coral reefs, one of the planet's most biodiverse and productive ecosystems [5], where metrics of structural complexity correlate strongly with indicators of reef health such as fish abundance, coral, and macroalgal cover [6][7][8]. Causes and effects are intertwined in these cases: living things create structure, and structure must pre-exist for those living things to find shelter from predators, scavenge, avoid turbulence, or perform other actions necessary for them to thrive [9][10][11][12]. To more precisely understand the nature of the correlations between structural complexity and ecological parameters, for example in a way that could inform the design of artificial reefs, marine a1111111111 a1111111111 a1111111111 a1111111111 a1111111111 single GoPro camera; % $300) and approximately two hours of processing time on a standard laptop (!8 GB RAM, 600 MB free disk space). Model rendering is largely automated, with each model requiring only 10 minutes human-computer time. We provide assessments of accuracy and repeatability using ground truths from known objects, as well as a comparison with chain-and-tape in-situ measurements of R. Our framework is ready-to-go to for use by non-programmers, and could be extended to gather any other conceivable structural complexity metric by a user with intermediate Python programming ability.

Underwater filming
All filming occurred on reefs 5 ± 2 m deep off the Caribbean island of Utila, Honduras (16.0950˚N, 86.9274˚W) under a research permit from the Instituto de Conservación Forestal (#ICF-DE-MP-080-2016). We used GoPro cameras (Hero 3, 3+ or 4) in GoPro flat port underwater housings because they were readily available and widely used within contemporary reef monitoring efforts and recreational dive communities, although any similar camera should produce similar results. Cameras were in video mode, with all default settings except: resolution 1080p (for consistency across cameras), field-of-view narrow (to minimize distortion caused by the fish eye lens), sharpness medium (to minimize prominence of particulate matter), capture rate 24-30 frames per second, and white balance 6500K (for consistency and to suppress blue hues). Only ambient light illuminated scenes.
A SCUBA diver filmed over a 2 x 2 m quadrat following a lawnmower pattern (Fig 1). The camera remained a constant height 0.5-1.0 m above the scene's highest point. It was aimed straight down at the substratum, the lens moving in one plane rather than following the contours of the scene. Underwater visibility needed only to be clear in the 0.5-1.0 m vertical distance between the camera and the reef, so even sites with relatively low visibility could be rendered. The orientation of the camera did not change between adjacent swim passes (Fig 1), meaning the diver either back-finned on an adjacent pass or held the camera still as he rotated his body.

3D model generation
We rendered models in PhotoScan following the standard process well described in the Photo-Scan user manual and by other papers in the field (e.g., [37]). Raw video footage was converted into sequences of still images using the free software FFmpeg (www.ffmpeg.org). Sequential images should contain 60-80% overlap, which in practice meant extracting at 3 frames per second. Approximately 300-600 images captured one 2 x 2 m quadrat.
Images loaded into PhotoScan were rendered into a 3D model following the standard process of (1) aligning photos, (2) building dense point cloud, (3) building mesh, and (4) building texture. All processes were set to medium quality with default settings, except meshes' maximum face counts were set to 3,000,000 (to increase models' fine-scale resolution). PhotoScan performs camera calibration automatically using Brown's distortion model with assumed focal information. Photo alignment was successful even though we did not supply calibration information nor did the photos have EXIF data. Clarity of the model was then visually assessed. Any models in which the quadrat was not clear enough to be used as a scale bar would be rejected. However, no models rendered as part of this study needed to be rejected.
A rendered model was then exported as a wavefront (.OBJ) file and imported into Rhino for further analysis. Firstly, a model was scaled by setting a quadrat's corner-to-corner length to 2 m using the Rhino "Scale" command. Secondly, the model was oriented using the "Rotate" command. For simplicity, we placed all quadrats flat underwater (i.e.,parallel to the ocean surface) and therefore rotated all models such that a quadrat corner rested squarely on the positive X and Y-axes. If a quadrat was placed at an angle underwater, however, divers could record the slope of the quadrat (e.g., by tying a float indicating vertical or by recording the depths of the highest and lowest corners) and then rotate their 3D model accordingly.

Assessment metrics
We analysed our 3D models in Rhino using four metrics: point-to-point distances, rugosity (R), fractal dimension (D), and vector dispersion (1/k). In addition, we assessed the precision of the models by repeatedly filming several scenes and quantifying variance between independent renderings. Students previously unfamiliar with the software involved learned to independently render and analyse models after a three-hour tutorial, so this method is suitable for rapid uptake. Point-to-Point distances. To demonstrate the proportional accuracy of our 3D models, we rendered an underwater scene containing ten man-made objects and compared objects' known dimensions (ground truths) to their dimensions in the model. Objects of muted colors roughly matching the tones of the surrounding reef were chosen, representing a range of sizes and shapes (Fig 2). Known dimensions ranged from 0.8-65.0 cm in the X-Y plane and 2.0-18.0 cm in Z. No key dimensions were taken under an overhang, as an overhang will not render well using our filming method because we only move the camera in the X-Y plane, an issue further discussed below.
The accuracy of a measurement was computed with Eq 1: where UW 3DM is the dimension measured on the underwater 3D model, and Ground Truth is the known dimension. Rugosity. We chose rugosity as a complexity metric because it is standard in traditional coral reef research-so standard that the most recent (as of March 2017) meta-analysis of structural complexity on reefs was only able to compare rugosities because of the "limited scale and replication" of studies employing alternative methods [8]. Rugosity is typically measured using the chain-and-tape method and quantified as the length the chain reaches as it falls over topography divided by the total length of the chain [18,19]. It is not to be confused with "surface rugosity," a term describing the ratio of 3D surface area to projected planar area, or with "roughness," a term describing qualitative features or referencing the Hausdorff dimension.
To measure linear rugosity on a 3D model in Rhino, we first created a curve that followed the topography of the model. The curve was created with the Rhino built-in command "MeshIntersect," which provides a cross-sectioning tool that allows the user to select a slice of user-determined linear length of the model by intersecting a mesh plane with the 3D reef mesh. In practice this can be performed between any two coordinates on the model. Here, in order to compare our 3D model-derived results with in-situ chain-and-tape measurements, curves were selectively positioned to match their in-water counterparts. We then ran a custom Rhino Python script (github.com/gracecalvertyoung/Rhino-Python-3D-Coral-Reefs/tree/master/Rugosity) using the "RunPythonScript" command. The script asked the user to select surface contours, and then it laid virtual chains along each contour and returned rugosities. Rugosity (R) equalled the distance that a virtual chain fell along the curve (R N ) divided by the total length of the chain (R D ). The virtual chain comprised of linear segments each the length of a chain link (2 cm was used), which the script created from the input contour with the build-in Rhino function "rs.DivideCurveEquidistant." The virtual chain was laid via either (1) the extendible-chain method ( Fig 3A) or (2) the fixed-length chain method ( Fig 3B). The extendible chain method determined how long a chain would need to be to cover the input curve, while the fixed-length chain method determined how far a chain of a set length (1 m was used) would fall along the input curve. This second method more closely resembled traditional chain-and-tape measurements, although it is a less accurate estimate of the overall reef complexity because of the chain's limited length.
Results from both methods were compared against in-situ chain-and-tape measurements. For the purposes of this comparison, 3D model-derived rugosity was the average of three adjacent virtual chains spaced 4 cm apart to account for an in-situ chain not laying perfectly straight.
Fractal dimension. We choose fractal dimension (D) as a complexity metric because it is a sophisticated and accurate means of assessing surface complexity that has been shown to be well suited to describing coral reefs [40][41][42][43]. Developed by [44], D is between 2 and 3 for a surface, with a greater number indicating greater complexity. It allows structural complexity to be explored within set size categories; e.g., researchers can define a size category based on a particular species of interest and its unique habitat requirements, or calculate complexity for multiple categories in a particular reef area [45,46].
Contemporary studies in the field of pattern recognition (machine learning and/or computer vision) have presented alternatives to, or improvements on, traditional fractal dimension (e.g., [47][48][49]), as further discussed under Future Study. However, these approaches are better suited to image analysis programs (e.g. MATLAB, as [50] uses) than within Rhino. Going from Rhino to an image analysis program for our use-case would introduce additional steps and software into the method. Therefore, in order to maintain a simplified and streamlined method while still providing useful ecological metrics, we choose to calculate D at multiple scales in Rhino.
There are several methods for calculating D, and different methods will yield different results [45,50,51]. While no method is definitively superior to all, [52,53] suggest an areabased method is appropriate for calculating D of surfaces. We therefore implemented an areabased method, following [52], who estimated D of rock surfaces (an application similar to ours).
Following [52], D indicates how surface area changes with resolutions. It is the slope of a model's resolution (δ) versus surface area (S(δ)) on logarithmic scales (Fig 4). We chose our resolutions, δ = 0.01, 0.05, 0.15, 0.3, 0.6, and 1.2 m, based on the refuge size categories of [17], who found holes of those size categories to be key factors influencing fish species abundance on coral reefs.
To measure D on a 3D model in Rhino, we ran a custom Rhino Python script (https:// github.com/gracecalvertyoung/Rhino-Python-3D-Coral-Reefs/tree/master/Fractal_ Dimension) using the "RunPythonScript" command. The script first re-rendered the model at We compared 3D model-derived measurements of D to ground truths to gauge the accuracy and resolution of our 3D models in terms of D. The ground truths were three different theoretical structures that were 3D printed. The shapes placed underwater, hereafter refered to as the printed structures, matched the shapes of the 3D prints but were concrete, cast in moulds created from the 3D printed shapes. The accuracy of a measurement was calculated as a percentage (Eq 2).
where UW 3DM is the value of D derived from the underwater 3D model and Ground Truth the value of D derived from the ground truth. Unlike Eq 1, one is subtracted from Ground Truth in the denominator because fractal dimension can only vary between 2 and 3 for a surface. Vector dispersion. Vector dispersion (1/k) was determined as an appropriate metric for measuring benthic structural complexity by [54]. It measures the uniformity in angles of a surface. Mathematically, it estimates vector variance for all normal vectors of individual planar surfaces. It is a value between 0 and 1, where 0 indicates a flat plane and a number closer to 1 indicates a more complex surface. Like R and D, 1/k must be calculated for a specified resolution; we choose 1 cm following [54]. In basic terms, a surface with a high value of 1/k at 1 cm resolution would trap particulate matter more easily, be less easy to roll a ball of diameter 1 cm over (or clumps of sediment), and reflect light more variedly than a surface with a lower value of 1/k.
To measure 1/k in Rhino, we ran a custom Rhino Python script using the "RunPython-Script" command (https://github.com/gracecalvertyoung/Rhino-Python-3D-Coral-Reefs/tree/ master/Vector_Dispersion). Whereas [54] created the grid of points with a profile gauge over the physical surface, our script projected a grid of points, spaced 1 cm apart, onto the highest Z-points of the 3D modelled reef. The script then created triangles between adjacent points and computed the directional cosines of triangles' normal vectors (Fig 5). It then computed Method for multi-scale measures of rugosity, fractal dimension, and vector dispersion from coral reef 3D models Method for multi-scale measures of rugosity, fractal dimension, and vector dispersion from coral reef 3D models 1/k using Eqs 3 and 4.
where i is the number of triangles created between surface points and cos x is the directional cosine of a triangle's normal vector in the X direction, cos y in the Y direction, and so on. We compared 1/k measurements from an underwater 3D model to ground truths (the same three printed structures used to validate measurements of D) in order to gauge the accuracy and resolution of our 3D models in terms of 1/k. Precision. We independently modelled eight 2 x 2 m quadrants three times each to evaluate the repeatability and consistency of our method in terms of the above metrics. R was computed using the extendible-chain method as the average of six virtual chains laid over the quadrat (as in Fig 3). D was computed for the resolutions δ = 0.01, 0.05, 0.15, 0.3, 0.6, and 1.2 m. 1/k was computed as the average over 1.6 m 2 ) of the quadrat.

Results and discussion
The method took 3 minutes in-water filming per 2 x 2 m quadrant, significantly less time than did placing quadrats, laying out transect tape, or other activities of the dives. It was important that the diver keep the camera orientation consistent on adjacent swim passes (Fig 1) because if the diver instead rotated the camera with his body, the footage was too blurry or disparate for the SfM algorithm to render the model. We found that filming the perpendicular set of swim-overs (Fig 1) was necessary for consistently successful photo alignment, even though this step was not required by other studies that use SfM with diver-held monocular footage (e.g., [37]). Our added step could be necessary because of our absence of calibration data, the smallscale of the quadrat, or non-manual intervention during photo alignment compared to other studies. The minimal time committed to this step (% 1.5 min dive time) made it worthwhile in ensuring model quality.

Assessment metrics
Point-to-Point distances. Dimensions on the underwater 3D model matched strongly with their true dimensions in both the X-Y (n = 48, R2 = 0.99; p < 0.001; Wilcoxon matched pairs test) and Z planes (n = 25, R2 = 0.83; p < 0.01; Wilcoxon matched pairs test). The root mean square errors (RMSE) of our models were 1.48 cm in X-Y and 1.35 cm in Z. The slopes of the regression plots (Fig 6) indicate that models underestimated dimensions in both X-Y and Z.
Measurements had accuracies of 89 ± 12% (mean ± SD) and 78 ± 13% in X-Y and Z respectively. These results are on-par with those of [30], who found their centimetre-scale underwater models to underestimate surface area and volume by 18% and 8% respectively. The improved accuracies of [30] were to be expected because they modelled smooth, bright, multicoloured objects in a tank of water, which should render better than natural scenes in the ocean.
Our accuracies are lower than what is possible from in-situ underwater SfM 3D models: [31] report RMSE errors of 0.605 mm from close-range photogrammetry from calibrated consumer-grade stereo-cameras. Our lower accuracy was to be expected, as we did not calibrate cameras and used a considerably less time-consuming rendering process compared to other methods: e.g., methods that include manually removing outlier points on 3D models, manually identifying ground control objects, and/or using PhotoScan's high or ultra-high quality settings. [55] showed that models from calibrated GoPro footage can achieve RMSE errors of 0.40 mm; users requiring models accurate at scales finer than 1.5 cm should consider a method requiring higher hardware/software effort and cost or at minimum calibrate their cameras.
Our reduced accuracy in Z compared to X-Y was expected because the camera travelled only in the X-Y plane. Having divers film around objects to capture more Z-plane features may improve Z-plane accuracies as well as capture structures precluded by overhangs. We performed a few trials filming perpendicular to the surface terrain, or around objects, but it led to unwanted noise in the models or yielded unsuccessful photo alignment-complications likely caused by the extended background water column introducing moving particulates and not containing features for the SfM algorithm to align. A solution could be PhotoScan's "mask" feature, but trade-offs with dive time and ease-of-use would need to be considered.
Overall the results indicate that measurements taken from 3D modelled reef in any direction can be treated with a high degree of confidence. This is further supported by the consistently accurate results obtained from the varying selection of shaped and sized objects, which gives reassurances when working with the highly variable structure of the natural world. It is worth noting that some objects rendered better than others. For example, looking closely at Fig 2, the surface of the SCUBA tank appears to have a texture less smooth than the real life object; this could be because it is somewhat shiny and therefore not ideal for photogrammetry. These texture discrepancies are better estimated by the metrics of rugosity, fractal dimension and vector dispersion rather than point-to-point distances, however, and so are discussed in more detail later. Importantly at this stage, it had no impact on the accuracy of point-to-point distance measurements, meaning our models are well suited to the collection of size data.
Reported as accuracies using Eq 1, the extendible chain method had an accuracy of 85.7 ± 22.8% and the fixed length chain method had an accuracy of 86.8 ± 7.8%. These Method for multi-scale measures of rugosity, fractal dimension, and vector dispersion from coral reef 3D models accuracies are on par with the accuracies of 85.3 ± 0.6% [33] and 89% [56], the only other studies to compare linear rugosity from a SfM 3D model (albeit using different methods) to chainand-tape measurements.
Fractal dimension. D values from underwater 3D models matched well with ground truths. The highest accuracy occurred for measurements at the largest measured resolution, 30-60 cm (99.67 ± 0.11%) and accuracy decreased only to 93.57 ± 2.13% at the finest resolution, 1-5 cm (Fig 8; Table 1). Reduced accuracy at the finer scale was understandable, as smaller details are logically more difficult to capture because of complications such as particulate matter in the water interfering with image resolution. D values were marginally underestimated at the 1-30 cm resolutions, which is visibly demonstrated by the excessively smooth appearance of modelled objects (Fig 8).
The higher accuracy of D compared to point-to-point distances, rugosity, and 1/k indicates that models are well-suited to convey overall complexity, even though some features may not perfectly match their ground truths.
Vector dispersion. 1/k matched well with ground truths, with an overall accuracy of 86.94 ± 4.55% (Table 1). There was no consistency in whether the models over-or underestimated 1/k. This level of accuracy can be considered above satisfactory, and further validates that the underwater 3D models used here accurately represent the structural complexity of their study areas. While no other study to our knowledge has computed accuracies in terms of D or 1/k, our accuracies are on the high-end of the wide range reported by other studies computing surface area and volume from photographic models, accuracies which range 1-17% and 2-9% for surface area and volume, respectively [38].

Precision
The rendering of multiple models of the same reef area demonstrated the high repeatability of the method. Table 2 shows that coefficient of variation (CV) in measurements were all below 2.8% (for rugosity) and as low as 0.6% (for D between 1-5 cm). The slight variations could result from human influences such as inconsistency in filming technique, scaling along the quadrat, and placement of rugosity lines or point clouds over the model. While no other study to our knowledge has computed precision in terms of D or 1/k, our results are on the low-end of the range of 1-10% reported by [38] for surface rugosity from photogrammetric models. Similar to our method, [38] modelled six scenes 7-10 times to derive their CVs.

Future study
To further refine the filming technique and model rendering process, it would be helpful to assess the accuracy of measurements along the Z plane for larger objects, as this study only measured up to 18 cm in Z. It would also be useful to explore how model quality is affected by water conditions, available lighting (quality/quantity), depth, and other environmental factors (e.g., [57] look at sun and wind patterns to find the optimum daytime for filming). Method for multi-scale measures of rugosity, fractal dimension, and vector dispersion from coral reef 3D models Computing additional metrics of structural complexity could also assist with long-term reef monitoring strategies and benthic community assessments. Metrics such as surface area, volume, slope, and average height could be of interest, as could any of those reviewed by [2] or [58]. Slope in particular is not addressed in our study, as all our quadrats were placed flat (parallel to the ocean surface) for simplicity and consistency. To incorporate slope into 3D models, the models should be rotated to the appropriate angle prior to obtaining metrics, or rugosity could be decoupled from slope [56]. We attempted to tie a small fishing float to the corner of a quadrat to indicate its angle with respect to the surface, but, unsurprisingly, the float moved too much to render in the 3D model. On future studies, divers might record a quadrat's angle by noting the depths of two corners of the quadrat and positioning the 3D model accordingly. Advanced users may also wish to implement other numerical approaches for estimating fractal dimension and/or metrics from the field of pattern recognition (machine learning and/or computer vision) such as lacunarity [47], color texture analysis based on fractal geometry [48], and/or local fractal dimension [49]. These state-of-the-art methods are presented for image analysis, but it would be possible to apply them on a coral reef 3D model by converting the 3D model into a "heat map" or 2D array of the quadrat. Once the heat map is generated, existing toolboxes in MATLAB (e.g., as [50] uses) would likely be more suited to the calculations than Rhino-Python scripts. That said, a user would still need to initially process the model in Rhino to scale, rotate, and identify the quadrat area.

Conclusion
While 3D modelling from underwater photogrammetry is a reasonably established method for representing and assessing coral reef structures, it remains largely reliant on sophisticated or costly hardware and/or software that can restrict accessibility to the wider research and conservation community. We present a cost-effective and automated technique that demonstrates how a single uncalibrated GoPro camera can produce accurate and precise models at small spatial scales (1.5 cm to 2 m), with variations in structural complexity between models below 3% and a high level of accuracy when compared to ground-truth measurements. We also provide useful tools for non-programmers to quantify reef 3D structures via a suite of ecologically-relevant metrics. By expanding beyond simple rugosity measurements to include fractal dimension (D) and vector dispersion (1/k), we provide researchers with a more thorough approach to exploring the quantity and quality of 3D complexity, including the ability to focus on complexity ranges that are ecologically relevant to target organisms.