A protocol for the large‐scale analysis of reefs using Structure from Motion photogrammetry

Substrate complexity is an essential metric of reef health and a strong predictor of several ecological processes connected to the reef, including disturbance, resilience, and associated community abundance and diversity. Underwater Structure from Motion (SfM) photogrammetry has been growing rapidly in use over the last 5 years due to advances in computing power, reduced costs of underwater digital cameras and a push for reproducible data. This has led to the adaptation of an originally terrestrial survey technique into the marine realm, which can now be applied at the habitat scale. This technique allows researchers to make detailed 3D reconstructions of reef surfaces for morphometric analysis of reef physical structure and perform large‐scale image‐mosaic mapping. SfM is useful for both reef‐scale and colony‐scale assessments, where visual or acoustic methods are impractical or not sufficiently detailed. Here we provide a protocol for the collection, analysis and display of 3D reef data, focussing on large‐scale habitat assessments of coral reefs using primarily open‐source software. We further suggest applications for other underwater environments and scales of assessment, and hope this standardized protocol will help researchers apply this technology and inspire new avenues of ecological research.


| INTRODUC TI ON
The 3D structure of temperate and tropical reef ecosystems is a key predictor of benthic and demersal community structure, and of ecosystem disturbance and resilience (Ferrari, Bryson, et al., 2016;Graham & Nash, 2013;Zawada, Madin, Baird, Bridge, & Dornelas, 2019). Traditionally, this component of the underwater environment has been recorded visually on a graded scale (Wilson, Graham, & Polunin, 2007), or using in-situ measures like the 'tapeand-chain' method (English, Baker, Wilkinson, & Wilkinson, 1997), or determined via a combination of visual and directly measured elements (Gratwicke & Speight, 2005). However, while these methods have proved useful for ecological studies, there is potential for observer bias, high variation according to placement and nonrepeatability .
The recent development of new technologies to record physical structures digitally, alongside rapid increases in computing power have allowed these traditional methods to be substantially improved upon. 'Structure from Motion' (SfM) photogrammetry (Westoby, Brasington, Glasser, Hambrey, & Reynolds, 2012) now allows us to create a detailed non-destructive 3D digital model of the physical environment from overlapping camera images. Models can be morphometrically analysed in a range of ways, and can be archived for future analysis and comparison by multiple observers (Anderson, Westoby, & James, 2019;. As this technology expands its use into underwater survey and research (from a largely terrestrial starting point), a range of methodologies are developing for creating and analysing 3D reef models, primarily over a small scale. However, there is still uncertainty for researchers new to this field over how to create their own models given the range of options available, and therefore a barrier to its standardized use in this setting from the initial training hurdles.
We present an end-to-end protocol for how to create large-scale 3D models of reefs, common options for analysis of such models, and best practice for storage and presentation of the outputs. We hope to aid researchers new to this approach by providing clear guidance to help fast-track and standardize the applications of photogrammetry within the community. We also hope it will inspire new avenues of ecological research, by summarizing a range of approaches already in use.

| ECOLOG IC AL APPLIC ATIONS
This paper specifically deals with the creation of models created from reef environments; however, the SfM technique has been shown to be accurate and repeatable at a range of scales and across various habitat types above and below water Bryson et al., 2017;Ferrari, McKinnon, et al., 2016;Raoult, Reid-Anderson, Ferri, & Williamson, 2017).

| LI M ITATI O N S
Unlike laser or acoustic-based methods of structural assessment, SfM is primarily limited by lighting, visibility and resolution as it is image-based. This can result in the loss of detail/accuracy in highly complex substrates due to objects creating areas of occlusion (i.e. obscured/shadowed areas where we cannot see, such as the centre of a densely branching coral stand). Adequate lighting, survey coverage, image overlap and camera equipment are therefore essential for creating accurate reef reconstructions (Aber, Marzoff, Ries, & Aber, 2019). Official ISO data collection standards are however still being developed for this technique (Kresse, 2010); therefore, the level of consistency/comparability across outputs from varying cameras, operators and conditions is still to be fully explored. Finally, the size of current individual surveys is generally restricted to hundreds of square metres, primarily due to computer processing power limita-

| Computer storage/power
Photographic inputs for SfM can be relatively data-intensive (i.e. multiple gigabytes of data per survey), with reef-scale surveys averaging several thousand images and even small-scale reconstructions of complex objects requiring tens to hundreds of images. However, photographic detail is important, with higher-resolution cameras enabling greater data capture and point-matching per image, as well as greater standoff distances in clear waters. Adequate computing power is therefore essential as ~100 m 2 of complex seabed may require ~1,000 images to produce a sufficiently detailed surface model. These data require large amounts of RAM (≥32 GB), a powerful GPU (e.g. Nvidia GeForce range) and multi-core CPU (e.g. Quad-core Intel i7 or higher) to process in a sensible time period (i.e. hours vs. days). Cluster processing the work over multiple nodes can considerably reduce processing time.

| Survey area set-up (the 're-construction site')
To mark out the site, we recommend initially tying off a Surface Marker Buoy (line taut to surface) with an attached waterproof GPS unit, to a non-living object (or to a fixed steel rebar stake/concrete block, if intending to re-survey over time). Note that while having multiple GPS-marked points is useful, in the field/at depth, this can be impracticable and time-consuming. Instead, one good GPS point, with recorded size and site orientation of the plot around this point, is preferable. Working from this initial point, lay a rough survey area using a reeled measuring-tape ( Figure 1). This tape-laying element is optional but can help visualization of the area during survey, particularly in low-visibility situations (i.e. visibility < site width).
Next, distribute multiple objects/Ground Control Points (GCPs) of known dimensions (that are visible, non-mirrored and weighted) across the survey area. Finally, set up a spirit level (using a stable tripod), and take the depth and time at the top of the level. Inclusion of a spirit level with compass allows accurate assessment of site slope three-dimensional (XYZ) orientation and cardinal direction. Where using an ROV/drone, paired lasers can be used for size calibration.

| Image collection/swim pattern
Swim over the area, pointing the camera down towards the substrate at a roughly perpendicular/oblique angle, 1-2 m above the substrate for habitat-scale assessments. Photograph the area of interest, spirit level and markers/GCPs, with the sequential images overlapping by 50%-75%. The initial image should capture a slate, detailing survey site, replicate, date, time and depth.
The survey pattern used to collect underwater imagery will vary according to the scale of survey (colony vs. reef), the reef complexity and the angle of slope. Common approaches apply a 'lawn-mower' pattern zig-zagging over the substrate (Burns, Delparte, Gates, & Takabayashi, 2015), or an expanding spiral pattern (Pizarro, Friedman, Bryson, Williams, & Madin, 2017), which can be beneficial in lower visibility environments (Figure 1). The exact angle of shots will vary according to the substrate, with the techniques all aiming to attain good coverage while minimizing occlusion and blue-water image space.

| Scale: Habitat versus colony
Survey area coverage will vary according to the aims of the study (Lechene, Haberstroh, Byrne, Figueira, & Ferrari, 2019), ranging from a few cm 2 (assessing individual colonies or polyps) to many hundred m 2 (assessing habitat-scale/multi-colony changes). Within a 1-hr dive in clear still conditions, a buddy team can expect to be able to survey at least 400 m 2 planar area of contiguous moderately complex substrate.
Site-specific hydrology, lighting, structure, depth and slope conditions will all affect the total amount of time needed and therefore the feasible survey coverage. Scale of assessment and associated detail will also affect the outputs, with the number of photos needed per m 2 increasing as scale decreases (i.e. as the need for fine-scale detail increases).

| Camera settings for image capture
Structure from Motion photogrammetry can be conducted using a single camera; however, an array of linked (e.g. remote release connected DSLRs) or time-lapsing cameras of the same model and settings can also be used to increase area coverage within the survey time ( Figure 2).
Photogrammetry software such as Agisoft Metashape will automatically calibrate (and group) cameras during optimization providing EXIF data are present. If not, parameters must be added manually.
Multiple camera types are now available for underwater photography Nocerino et al., 2019). While GoPros are ideal for rapid and affordable assessment in optimal conditions, for the best quality outputs in terms of resolution, alignment and adaptability, we broadly recommend a DSLR with a large, high MegaPixel image sensor (ideally full frame/≥1" with global shutter), and a flat, fixed focal length 'prime' wide-angle lens (i.e. ~20 mm) with auto-focussing. This allows adaptability to varying underwater environments and wide field of view. Ensure the same camera model and lens focal length are used for any one survey, as variations will cause processing issues (Lavy et al., 2015).
Take care with image exposure and re-assess frequently. A good aperture for images is ~5.6, with a fast shutter speed to limit F I G U R E 1 The typical conceptual layout of equipment over the substrate in preparation for photogrammetric survey. (1) A permanent visible marker (taped steel rebar) standing ~1 m proud of the reef; (2) small corner-marker tags to aid re-location of the survey area; (3) in-situ markers/Ground Control Points (GCPs) of known XYZ (3D) dimensions; (4) measuring tape detailing the survey extent and (5) in-situ spirit-level and compass for calibration and additional scaling to XYZ planes. Right panels show the direction of movement (black line) by the surveyor for a reef-or colony-scale assessment. Reef-scale patterns are depicted as from above low-light image blur (i.e. 1/125 or faster, altered frequently as ambient light changes), and moderate ISO (i.e. 200-400) to compensate without adding grain. White-balance needs to be set at the start of each survey to an in-situ colour reference. Adequate strobe lighting becomes essential at increased depth or within more turbid waters.
Ensure the angle of the lighting is oblique rather than directly on to the subject, and use a diffuser to minimize backscatter and give even illumination.
In clear water conditions with adequate ambient or video-lighting, quality wide-angle action cameras such as GoPro (with large image sensors) can be used, typically applying the time-lapse function (~1 frame/second). Video footage can also be used; however, this involves an additional step of 'frame-grabbing', which can take time and reduce image quality. With older video cameras, it is advisable to use a non-interlacing video format to retain high-quality outputs.
Ensure any underwater equipment is washed daily and is periodically inspected to ensure continued use throughout a survey campaign, with no loss of data, quality or time. Open-source tools, including VisualSFM, COLMAP, Regard3D, OpenDroneMap and Bundler, each vary in the degree of user control, outputs available, photo number-limit and processing time.

| Processing of images
We recommend the use of Agisoft Metashape for SfM processing of reef imagery, due to its affordable price, wide use, good technical support and easy control over processing and outputs. Table 1 details our recommended process for SfM-derived reef model creation. For in-depth discussion on camera trade-offs, optimal calibration, processing/alignment error mitigation and post-process  F I G U R E 2 (a) A diver using a handheld DSLR camera to survey a coral reef using the SfM technique; (b) example camera configurations for short-range photogrammetry underwater (wide-angle DSLR/compact/paired action-cameras, with video lights/strobes); (c) resulting dense pointcloud layer of a 100 m 2 reef section, with individual photo locations shown in blue TA B L E 1 A workflow detailing the steps recommended to create a 3D reef pointcloud using SfM, following initial image collection

Project creation and image alignment
Step Action 1 Collect field imagery (label images sequentially as captured) and back-up the data 2 Import imagery to an Agisoft Metashape project (1 reef or colony of interest per chunk). Camera and lens type are detected automatically from image EXIF metadata, but can be specified further to increase accuracy (Tools > Camera calibration) 3 Save the project with a sensible and informative naming convention i.e. 'SiteName_Block#_Depth#_Replicate#.psx' 4 Align imagery to create a sparse pointcloud (Workflow > Batch process > Add > Job type = Align Photos > Apply to = All/unprocessed/selected chunks, Save project after each step = True) -Default settings (Accuracy = High, Generic preselection = Yes, Key point limit = 40,000, Tie point limit = 4,000). All batch job settings can be saved as an.xml file.
-For difficult to align models deselect 'generic preselection', change key and tie points to = 0 (infinite). Note processing time will significantly increase

Error reduction and scaling
Step Action Complete processing steps 4-9 first and check results before moving on to next steps if using the batched workflow. Steps 5 and 6 are non-essential but will reduce systematic errors and are therefore recommended

Dense cloud creation, cleaning and orientation
Step Action based on point height, and will therefore not fully account for overhanging objects (similarly to topobathic Lidar/Sonar techniques).
We recommend a protocol for reef surface analysis in Table 2 using Gwyddion. This method assesses reef surfaces using both a virtual transect and virtual quadrat, resulting in a wide range of possible output metrics.
For analysis of substrate community composition/distribution/ cover, etc., HD ortho-rectified image-mosaics and Digital Elevation Models (DEMs) can also be exported from Agisoft Metashape (Table 1) and integrated into commonly used workflows, such as 'Coral Point Count (CPCe)' software in JPG format, or within ArcGIS in ASCII/GeoTIFF format, respectively.

| Volumetric analysis
We recommend using the open-source software 'Cloudcompare' to simply align multiple reef surface models and to calculate the 2.5D volume change between pointcloud layers (Table 3).

| Structure and metadata
For efficient storage of raw and processed data, we recommend following established ISO compliant folder structure systems, such as the British Geological Society marine survey system (https://www. bgs.ac.uk), and following MEDIN (or similar) metadata standards (https://www.medin.org.uk/data-stand ards). We recommend the daily download of all captured data in the field, followed by the creation of back-up copies. Labelling and filing of imagery should be completed on the day of collection to avoid confusion, along with formatting of camera memory cards before each reuse.

| Data sharing/storage platforms
For increased accessibility and data sharing of 3D layers, alongside traditional storage solutions there are a number of online TA B L E 2 A workflow detailing the steps recommended to analyse a 3D reef surface model, using a virtual transect or virtual quadrat method 3D surface analysis workflow

Data import and conversion
Step Action

| CON CLUS IONS
The 3D analysis and mapping of reefs using SfM modelling is likely to revolutionize marine monitoring and rapidly become standard practice, allowing a suite of new questions to be quantitatively assessed (Obura et al., 2019). Detailed substrate data can be captured and stored indefinitely allowing interrogation with constantly evolving analytical tools, and integration within large-scale assessments (Madin, Darling, & Hardt, 2019). The initial capture methods must therefore be rigorous and methodological, and care must be taken whilst planning long-term surveys to ensure direct comparisons can be made over time. The protocol described here has been developed over several years and is focused on providing a low-cost and efficient workflow for the production of structural data to a high quality.
However, this technology and the range of applications to which it can be applied are of course still relatively young and so are rapidly evolving. Protocols such as ours will consequently continue to develop and change at pace as more of the marine community uses the technology. As camera equipment improves and both the costs and time of processing decrease, we hope to see this technology become even more widespread and a standard tool within ecological survey.

ACK N OWLED G EM ENTS
The authors would like to thank the Bertarelli Foundation who TA B L E 3 A workflow detailing the steps recommended to analyse volumetric change between two reef models over time

Data import, alignment and calculation
Step Action 1 Import two XYZ surface layers (.txt files) of interest into Cloudcompare 2 Roughly align the two layers using the 'Equivalent point pairing' tool ([select both clouds of interest] > Tools > Registration > align (point pairs picking) > Choose 'reference' and 'aligned' roles for layers (oldest/before layer typically the reference)> [Select at least 4 matching point pairs based on fixed in-situ markers or objects]) -Note that the alignment points/markers need to be arranged in a nonlinear pattern, dispersed around the area of interest (i.e. four rebar markers placed at each corner of the quadrat) Note, layers should ideally be the same size. If one layer is larger than the other, this should preferably be the bottom layer; therefore, additional cropping may be needed