remote sensing Evaluation of the Inﬂuence of Processing Parameters in Structure-from-Motion Software on the Quality of Digital Elevation Models and Orthomosaics in the Context of Studies on Earth Surface Dynamics

: The fully automated Structure-from-Motion approach for developing digital elevation models and orthomosaics has been known and used in photogrammetry for at least 15 years. Years of practice and experience have allowed researchers to provide a solid description of the applicability and limitations of this method. That being said, the impact of input processing parameters in software on the quality of photogrammetric products has yet to be fully ascertained empirically. This study is aimed at identifying the most advantageous processing workﬂow to ﬁll this research gap by testing 375 different setup variations in the Agisoft Metashape software for the same set of images acquired using an unmanned aerial vehicle in a proglacial area. The purpose of the experiment was to determine three workﬂows: (1) the fastest, which has the shortest calculation time; (2) the best quality, which is as accurate as possible, regardless of the time taken for the calculations; and (3) the optimal, which is a compromise between accuracy and calculation time. Each of the 375 processing setup variations was assessed based on ﬁnal product accuracy, i.e., orthomosaics and digital elevation models. The three workﬂows were selected based on calculating the height differences between the digital elevation models and the control points that did not participate in their georeferencing. The analyses of the root mean square errors (RMSE) and standard deviations indicate that excluding some of the optimization parameters during the camera optimization stage results in high RMSE and an increase in the values of standard deviation errors. Furthermore, it was shown that increasing the detail of individual processing steps in software does not always positively affect the accuracy of the resulting models. The experiment resulted in the development of three different workﬂows in the form of Python scripts for Agisoft Metashape software, which will help users to process image sets efﬁciently in the context of earth surface dynamics studies.


Introduction
The relief of the Earth's surface is constantly modified by natural processes (e.g., erosion, weathering) and direct human activity. These dynamics are important to studies of the landscape evolution as well as studies of processes which may pose threats to human life and infrastructure. Therefore, landscape dynamics have been studied in a number of contexts that include the following: (a) the possibility of the occurrence of landslides and areas susceptible to their formation [1][2][3]; (b) to observe areas at risk of snow avalanches [4]; (c) to monitor land surface changes due to mining activities [5,6]; and (d) to assess the dynamics of aeolian processes [7] or changes to riverscapes [8][9][10][11][12]. One example of areas characterized by particularly high dynamics of the surface is proglacial areas [13][14][15][16][17]. Ongoing climate warming [18][19][20], characterized by an increase in mean annual air temperatures For example, some attention was directed to the impact of mission design (e.g., [51][52][53]) or number and location of GCPs (e.g., [54][55][56][57]) on the accuracy of photogrammetric products. Another example is a work illustrating the processing of photo sets with no GCPs, but using co-registrations of the models (e.g., [58]). The authors proved that in this type of research, such as change detection, satisfactory results can be achieved even without GCPs, which is particularly important in the case of objects that are difficult to access. Similar conclusions were suggested by de Haas et al. [59], who presented evidence for the limited impact of GCPs on the increase in accuracy of models compared to projects where the co-alignment of multiple surveys is used. In addition, researchers also checked if the choice of software matters for the quality of DSM (e.g., [60]) and application of oblique photos (e.g., [61]), and critically assessed the use of RTK technology in UAVs compared to the traditional GCP scheme with UAVs without this technology [62]. The aim of this study was to investigate the influence of particular calculation parameters in the Agisoft Metashape software on the accuracy of photogrammetric products: DEMs and orthomosaics. Another objective was to find the most efficient workflows that can be used in the processing of large images sets of different research objects. For this purpose, 375 different workflows were formulated in the software, which were then checked while processing the same set of images representative of the proglacial area. Additionally, we aimed to select three workflows: (1) the fastest, which has the shortest calculation time; (2) the best quality, which is as accurate as possible, regardless of the time taken for calculations; and (3) the optimal, which is a compromise between accuracy and calculation time. These workflows are included in this article as Supplementary Materials in the form of Python scripts for processing a set of images in Agisoft Metashape. Thus far, there is no publication of such multi-threaded research in that form that can be easily implemented by other researchers in their work. The correct selection of the script and processing efficiency depend on the size of the image set, the expected accuracy, or the available computing power.

Study Area and Technical Information
The experiment used a set of UAV-collected images showing a sample area (~50,000 m 2 ) of diverse terrain within the foreland of the Breiðamerkurjökull, Iceland (Figure 1). The flight took place on 5 September 2021 using the Map Pilot Pro mobile application in autonomous mode. To acquire the images, we used a multirotor DJI Phantom 4 Pro UAV equipped with a DJI FC6310 camera at a resolution of 20 MP and a focal length of 8.8 mm (24 mm equivalent for 35 mm format). In total, 82 vertical RAW images with a resolution of 5464 × 3640 pixels were taken and saved in the DNG format. The forward and side overlap were programmed at 80%, while the flight altitude was set at 70 m, rate of the image capture:~5 s. The photographic exposure was set at 1/160 s (19 images) and 1/120 s (63 images). The GSD (Ground Sample Distance) of the images was~1.92 cm/pix. The intention of the authors was to carefully reproduce the typical settings for missions performed for similar purposes [37]. During the flight, no strong gusts of wind or rainfall were noticed, even though the sky was fully cloudy. The quality of the images was checked in the Agisoft Metashape software before processing using a dedicated tool "Estimate image quality"-each image taken for calculations had a value above 0.80. DNG images were directly imported into Agisoft Metashape and were not subjected to exposure nor color modifications. The study areas represent a typical proglacial landscape, built from sands and gravel.
We used 40 GCPs, arranged in 4 rows of 10 points and 15 m apart at an angle of 90°, to georeference the model. Additionally, in order to check the accuracy of DEMs, 31 control points (CPs) not involved in georeferencing during SfM processing were randomly located in the study area. Each of the GCPs and CPs were constructed in the form of a circle of stones, in which the location of the middle stone was measured by the differential GNSS Topcon Hiper II receiver (Figure 2), using RTK survey technique and local base station (vector < 200 m). Survey uncertainties were between 0.008 and 0.015 m. The Agisoft Metashape Professional software (version 1.7.1 build 11,797) was used to process the set of images, model and generate DEMs and orthomosaics. The computing platform was a desktop computer with Windows 10 64 bit, a 6-core (12 thread) Intel Xeon E5-2440 processor with a base frequency of 2.40 GHz (2.90 GHz in Turbo mode), a GeForce GTX 1060 6 GB graphics card, and 79.97 GB DDR3 RAM. The computer was not used for other purposes during calculations to ensure the same computing power for all models. GNSS measurement was carried out on the middle stone in the circle, which differed from the others by its size and shape. The study areas represent a typical proglacial landscape, built from sands and gravel.
We used 40 GCPs, arranged in 4 rows of 10 points and 15 m apart at an angle of 90 • , to georeference the model. Additionally, in order to check the accuracy of DEMs, 31 control points (CPs) not involved in georeferencing during SfM processing were randomly located in the study area. Each of the GCPs and CPs were constructed in the form of a circle of stones, in which the location of the middle stone was measured by the differential GNSS Topcon Hiper II receiver (Figure 2), using RTK survey technique and local base station (vector < 200 m). Survey uncertainties were between 0.008 and 0.015 m. The Agisoft Metashape Professional software (version 1.7.1 build 11,797) was used to process the set of images, model and generate DEMs and orthomosaics. The computing platform was a desktop computer with Windows 10 64 bit, a 6-core (12 thread) Intel Xeon E5-2440 processor with a base frequency of 2.40 GHz (2.90 GHz in Turbo mode), a GeForce GTX 1060 6 GB graphics card, and 79.97 GB DDR3 RAM. The computer was not used for other purposes during calculations to ensure the same computing power for all models. The study areas represent a typical proglacial landscape, built from sands and gravel.
We used 40 GCPs, arranged in 4 rows of 10 points and 15 m apart at an angle of 90°, to georeference the model. Additionally, in order to check the accuracy of DEMs, 31 control points (CPs) not involved in georeferencing during SfM processing were randomly located in the study area. Each of the GCPs and CPs were constructed in the form of a circle of stones, in which the location of the middle stone was measured by the differential GNSS Topcon Hiper II receiver (Figure 2), using RTK survey technique and local base station (vector < 200 m). Survey uncertainties were between 0.008 and 0.015 m. The Agisoft Metashape Professional software (version 1.7.1 build 11,797) was used to process the set of images, model and generate DEMs and orthomosaics. The computing platform was a desktop computer with Windows 10 64 bit, a 6-core (12 thread) Intel Xeon E5-2440 processor with a base frequency of 2.40 GHz (2.90 GHz in Turbo mode), a GeForce GTX 1060 6 GB graphics card, and 79.97 GB DDR3 RAM. The computer was not used for other purposes during calculations to ensure the same computing power for all models.  GNSS measurement was carried out on the middle stone in the circle, which differed from the others by its size and shape.

Guidelines of the Experiment
Before starting the calculations, the planned variants of input processing parameters were formulated in the software, while naming of the projects followed a logical, structured and individual code ( Figure 3). We investigated how the following parameters and their values would impact the final accuracy of the photogrammetric products (measured by errors on CPs) and calculation time: • Alignment accuracy-five levels of accuracy: lowest, low, medium, high, and highest.

•
The number of key points and tie-three sets were adopted: 1. Set "A"-limit 10,000 key points and 1000 tie points.
• Dense point cloud generation quality-five levels of quality: lowest, low, medium, high, and ultra-high.

•
Optimization parameters-five sets were adopted:

Guidelines of the Experiment
Before starting the calculations, the planned variants of input processing parameters were formulated in the software, while naming of the projects followed a logical, structured and individual code ( Figure 3). We investigated how the following parameters and their values would impact the final accuracy of the photogrammetric products (measured by errors on CPs) and calculation time: • Alignment accuracy-five levels of accuracy: lowest, low, medium, high, and highest.

•
The number of key points and tie-three sets were adopted: 1. Set "A"-limit 10,000 key points and 1000 tie points. 2. Set "B"-limit 100,000 key points and 10,000 tie points. 3. Set "C"-no limit.
• Dense point cloud generation quality-five levels of quality: lowest, low, medium, high, and ultra-high.

•
Optimization parameters-five sets were adopted: 1. Set "A"-parameters: f. 2. Set "B"-parameters: f, cx, cy. 3. Set "C"-parameters: f, cx, cy, k1, k2. 4. Set "D"-parameters: f, cx, cy, k1, k2, b1, b2. 5. Set "E"-parameters: f, cx, cy, k1, k2, k3, k4, p1, p2, b1, b2. The levels of accuracy mentioned above determine the sampling rates at which the software processes the data. When the calculation accuracy is set to high at the image alignment stage, the software works on images with their original resolution. On the other hand, when the medium accuracy is set, the original image is reduced four times, in the low setting 16 times and in the lowest setting 64 times. For detailed photos, the highest level can be used, where the original resolution of the image is upscaled by a factor of 4 to find more key points. The meaning of these levels of settings is the same for the dense point cloud generation. In addition, during the image alignment step, the software calculates the optimization parameters that can be used to optimize the sparse point cloud. The f parameter is the focal length; cx and cy are intercepting axis of the lens optical with sensor plane; b1 and b2 are coefficients of affinity transformation and skew; coefficients k1, k2, k3 and k4 relate to radial distortion, and coefficients p1 and p2 to tangential distortion [63]. A detailed description of the processing steps, including the characteristics of the accuracy and quality settings, and a description of the optimization parameters process, can be found in the Agisoft Metashape software manual, available on the manufacturer's website (https://www.agisoft.com/downloads/user-manuals/ accessed on 3 March 2022). The levels of accuracy mentioned above determine the sampling rates at which the software processes the data. When the calculation accuracy is set to high at the image alignment stage, the software works on images with their original resolution. On the other hand, when the medium accuracy is set, the original image is reduced four times, in the low setting 16 times and in the lowest setting 64 times. For detailed photos, the highest level can be used, where the original resolution of the image is upscaled by a factor of 4 to find more key points. The meaning of these levels of settings is the same for the dense point cloud generation. In addition, during the image alignment step, the software calculates the optimization parameters that can be used to optimize the sparse point cloud. The f parameter is the focal length; cx and cy are intercepting axis of the lens optical with sensor plane; b1 and b2 are coefficients of affinity transformation and skew; coefficients k1, k2, k3 and k4 relate to radial distortion, and coefficients p1 and p2 to tangential distortion [63]. A detailed description of the processing steps, including the characteristics of the accuracy and quality settings, and a description of the optimization parameters process, can be found in the Agisoft Metashape software manual, available on the manufacturer's website (https://www.agisoft.com/downloads/user-manuals/ accessed on 3 March 2022).
Taking into account all possible values of the above-mentioned parameters, 375 (5 × 3 × 5 × 5 = 375) different workflows were formulated and processed. In the first stage, an "initial" project was created in Agisoft Metashape to which the images and GCPs were imported in the UTM zone 28N coordinate system (EPSG: 25828). DNG photos were not modified or converted in any way before importing them into the software. Subsequently, GCPs were marked into all images. Prepared in this way, the project was duplicated 375 times in order to start processing in the next step in accordance with the adopted workflow for a given project. As part of the calculations, each sparse point cloud was filtered with the Gradual Selection tool, using the same parameters for all models (reprojection error = 0.5, reconstruction uncertainty = 10, image count = 2, projection accuracy = 20). The end result of the processing was a report, a DEM, and an orthomosaic ( Figure 4). Taking into account all possible values of the above-mentioned parameters, 375 (5 × 3 × 5 × 5 = 375) different workflows were formulated and processed. In the first stage, an "initial" project was created in Agisoft Metashape to which the images and GCPs were imported in the UTM zone 28N coordinate system (EPSG: 25828). DNG photos were not modified or converted in any way before importing them into the software. Subsequently, GCPs were marked into all images. Prepared in this way, the project was duplicated 375 times in order to start processing in the next step in accordance with the adopted workflow for a given project. As part of the calculations, each sparse point cloud was filtered with the Gradual Selection tool, using the same parameters for all models (reprojection error = 0.5, reconstruction uncertainty = 10, image count = 2, projection accuracy = 20). The end result of the processing was a report, a DEM, and an orthomosaic ( Figure 4). In the next stage, DEMs were checked for height accuracy in the ArcMap software, using 30 CPs not participating in georeferencing. By selecting the Extract Values to Points tool, the differences in height between the CPs and the DEMs were obtained, and then the standard deviation and the root mean square error (RMSE) were calculated for the CPs of each model. We tested the accuracy of DEMs, not raw point clouds, as in most previous geomorphological works, DEMs were the most commonly used as final products for landform interpretation, mapping and change detection analysis [37]. In addition, we also visually checked raw point clouds in CloudCompare. For projects where RMSE values were low, the locations of control points were near to point cloud. For projects where RMSE values were high, control points were noticeably above or under the cloud. Additionally, based on the data from the report, the calculation time for each processing step was checked and the total calculation time for each project was summarized. Detailed information on each workflow is included in the Supplementary Materials (S1).

Results
Out of 375 projects, 195 did not generate a dense point cloud nor produced a DEM and orthomosaic. The step of aligning images at the lowest accuracy is responsible for the first 75 unsuccessful projects-the number of points remaining after filtration of sparse point clouds at this level (~600 points for all 75 chunks) was insufficient. Hence, the first result of the analysis is the statement that the level of accuracy of alignment set to lowest and subsequently filtered is insufficient to generate photogrammetric products. The sets of the "A" and "B" optimization parameters and alignment of images at low, medium, high, and highest accuracy are responsible for the remaining 120 projects, for which it was not possible to generate dense clouds. In these workflows, the sparse point clouds were In the next stage, DEMs were checked for height accuracy in the ArcMap software, using 30 CPs not participating in georeferencing. By selecting the Extract Values to Points tool, the differences in height between the CPs and the DEMs were obtained, and then the standard deviation and the root mean square error (RMSE) were calculated for the CPs of each model. We tested the accuracy of DEMs, not raw point clouds, as in most previous geomorphological works, DEMs were the most commonly used as final products for landform interpretation, mapping and change detection analysis [37]. In addition, we also visually checked raw point clouds in CloudCompare. For projects where RMSE values were low, the locations of control points were near to point cloud. For projects where RMSE values were high, control points were noticeably above or under the cloud. Additionally, based on the data from the report, the calculation time for each processing step was checked and the total calculation time for each project was summarized. Detailed information on each workflow is included in the Supplementary Materials (S1).

Results
Out of 375 projects, 195 did not generate a dense point cloud nor produced a DEM and orthomosaic. The step of aligning images at the lowest accuracy is responsible for the first 75 unsuccessful projects-the number of points remaining after filtration of sparse point clouds at this level (~600 points for all 75 chunks) was insufficient. Hence, the first result of the analysis is the statement that the level of accuracy of alignment set to lowest and subsequently filtered is insufficient to generate photogrammetric products. The sets of the "A" and "B" optimization parameters and alignment of images at low, medium, high, and highest accuracy are responsible for the remaining 120 projects, for which it was not possible to generate dense clouds. In these workflows, the sparse point clouds were not optimized with the k1 and k2 parameters, which were characterized by a high RMSE for GCPs of~48.23 cm and a high reprojection error in the range of 2.74-5.80 pixels. Parameters k1 and k2 are responsible for the optimization of the sparse point cloud in terms of the radial distortion of the lens-the conclusion is that images from the DJI FC6310 camera are burdened with high radial distortion. Due to the absence of dense point clouds and DEMs in these projects, they were not included in any further work, and so only reports were generated.
In the remaining 180 projects, DEMs, orthomosaics and calculation reports were generated, in line with the planned workflows. The spatial resolution of the photogrammetric products depended on the level of accuracy set for dense point cloud generation-at the lowest level the resolution was~28 cm, at the low level~14 cm, at the medium level~7 cm, at the high level~3.5 cm, and at the ultra-high level~1.75 cm. The spatial resolution of all orthomosaics was the same: 1.75 cm. RMSE and standard deviation based on CPs were calculated. From the obtained results, it can be concluded that when the accuracy of alignment of images was set to the high or highest level and then combined with the exclusion of k3, k4, p1, and p2 optimization parameters, the results were characterized by an increase in the RMSE value and standard deviation based on CPs. RMSE/SD for the high level reached the values of 14-15 cm, and for highest level 43-44 cm. The increase in the RMSE value and standard deviation based on CPs occurs with an increase in the number of points in the sparse cloud. Only when the optimization of the sparse point cloud was conducted using the set "E" (optimization of the parameters f, cx, cy, k1, k2, k3, k4, p1, p2, b1, b2) were the high values of RMSE and standard deviations based on CPs reduced to values <2.5 cm. Figure 5 shows histograms for the 12 selected models, demonstrating the effect of parameters k3, k4, p1, and p2 on the height difference distribution based on CPs. Histograms of the height difference distribution, calculated based on CPs for each model, are included in S2 as Supplementary Materials. Moreover, a noticeable effect on the RMSE and standard deviation value was noted for the step of dense point cloud generation-with the increase in its quality and optimization of all parameters (set "E"), the values decrease.
Remote Sens. 2022, 14, x FOR PEER REVIEW 8 of 16 Figure 5. Distribution of the difference in elevation between 30 CPs and DEMs for the 12 selected workflows. The histograms are arranged according to the sets of optimization parameters and the level of accuracy of image alignment: in the first column there are four histograms for projects with the "C" set, in the second with the "D" set, and in the third with the "E" set. The level of accuracy for generating the sparse point cloud in the column is set from low (first row) to highest (fourth row). All histograms are for projects where the quality of dense point cloud generation has been set to ultra-high. The following regularities can be seen: (1) increasing the quality of generating a sparse point cloud increases the differences in elevation for models with optimized parameter sets "C" and "D" (approximately from −2 to 2 cm for low, from −2 to 4 cm for medium, from −20 to 30 cm for high and from −50 to 50 cm for ultra-high quality); (2) optimization of the sparse point cloud with all parameters (set "E") significantly affects the accuracy of the models, resulting in the standard deviation of <2.5 cm.
In addition to analyzing the quality of the models, the calculation time for each step was checked, while calculation time for each project was summarized to compare the workflows in terms of calculation time and test if the increase in accuracy can be achieved All histograms are for projects where the quality of dense point cloud generation has been set to ultra-high. The following regularities can be seen: (1) increasing the quality of generating a sparse point cloud increases the differences in elevation for models with optimized parameter sets "C" and "D" (approximately from −2 to 2 cm for low, from −2 to 4 cm for medium, from −20 to 30 cm for high and from −50 to 50 cm for ultra-high quality); (2) optimization of the sparse point cloud with all parameters (set "E") significantly affects the accuracy of the models, resulting in the standard deviation of <2.5 cm.
In addition to analyzing the quality of the models, the calculation time for each step was checked, while calculation time for each project was summarized to compare the workflows in terms of calculation time and test if the increase in accuracy can be achieved with reasonable computing time. The step of generating a dense point cloud turned out to be crucial-the calculation time at the lowest level of accuracy may be shorter than ultrahigh even six times, and between high and ultra-high three times ( Table 1). The detailed results of the calculations, along with the quantitative and qualitative characteristics of the models, can be found in the Supplementary Materials (S1). Table 1. An example of the calculation time data from Supplementary Materials (S1) for each processing step. The data concern 15 projects which include: accuracy of alignment of images at the medium level, three different sets of tie points and key point limits, accuracy of generating a dense cloud of points at five different levels, and a set "C" of optimization parameters. It is clearly visible that the step of generating a dense point cloud is the most time consuming. It is worth noting that the orthomosaic generation step can account for over 60% of the calculation time (e.g., project 181_m_A_lt_C).

Discussion
In the following subsections, we discuss the impact of subsequent processing steps in SfM software on the accuracy of DEMs and orthomosaics.

Alignment of Images
The level of accuracy in the alignment of images may affect the results of standard deviations and RMSE based on CPs; nevertheless, for each level of accuracy in this step, values below 1 cm are possible to achieve. However, higher values in the order of 9, 15 or 44 cm were recorded where the level of accuracy was set to high or highest, the sparse point cloud was not optimized with the k3, k4, p1, and p2 parameters ("E" optimization parameter set), and no point limits were introduced in the sparse cloud. Such high results Remote Sens. 2022, 14, 1312 9 of 15 did not occur at the low and medium levels in projects with a similar number of points in a sparse cloud, hence the influence of the size of the sparse point cloud on this issue should be excluded. In addition, this step significantly influenced the calculation time-the use of high or highest level of accuracy, while not applying the key and tie points' limits, only increased the calculation time, but did not increase the accuracy of the photogrammetric products. At the low and medium level of accuracy, the difference in calculation time was visibly lower. It has to be noted that downsampling of the original images (i.e., levels lowest, low, and medium) can mix spectral values of pixels. Therefore, in the case of large spectral differences between control points and surroundings, this aspect can influence the accuracy assessment.

Key and Tie Points' Limits
The limit of key and tie points, with one exception, did not affect the accuracy of DEMs. In the group of projects with the set "A" (i.e., limit 10,000 key points and 1000 tie points), the lowest standard deviation based on CPs was 0.63 cm (which is the best result among all 180 projects). The most accurate project with the "B" set (i.e., limit 100,000 key points and 10,000 tie points) had a standard deviation of 0.65 cm, and with the "C" set (i.e., no limit on key or tie points) the standard deviation was 0.67 cm. Similar results of the sets "A", "B" and "C" were also recorded for the RMSE values (0.76, 0.76, and 0.80 cm, respectively). The exception here is the generation of a sparse point cloud at the high and highest level of accuracy, plus a lack of optimization with parameters k3, k4, p1, and p2, which significantly reduces the accuracy of the models (standard deviation and RMSE based on CPs in the range of 9-44 cm). Such large values for high and highest settings can be potentially related to the general roughness of the surface or false matches related to similar texture of the studied area.
Therefore, increasing the number of points in the sparse cloud by increasing the limit of key and tie points or removing them completely does not always improve the accuracy of the models, and may result in an extension of the calculation time during its generation and subsequent processing steps. This applies, for example, to the three projects with the longest calculation times, of which the longest was almost five hours.

Dense Point Cloud Generation
The process of generating a dense point cloud turned out to be a significant element in terms of the accuracy of the models. High and ultra-high quality in combination with optimization of the parameters from the "E" set produced the best results-the resultant DEMs were characterized by standard deviation and RMSE based on CPs ≤ 1 cm. That likely results from the texture of the surface (gravels)-in this case, more characteristic points can be identified in the images and used to construct point cloud. The increase of quality of the dense point cloud generation step, along with the use of the key and tie points' limits from the "A" set, result in a significant decrease in the value of the standard deviation and RMSE based on CPs. It should be underlined that calculating dense cloud with the highest possible quality resulted in the extension of the calculation time: in the case of the ultra-high quality, even several times. This is because the ultra-high settings oversample the original images and, therefore, quadruple memory consumption.

Optimization Alignment
The optimization of the sparse point cloud turned out to be the most important processing step in terms of the accuracy of DEMs. As mentioned in Section 3, projects with parameter sets "A" and "B" did not generate a dense point cloud. Only adding the parameters k1 and k2 to the sets "C", "D", and "E" resulted in the generation of a dense point cloud and photogrammetric products. These parameters relate to radial distortion [64], which characterizes the images from the DJI FC6310 camera [50], hence the lack of these parameters in the optimization could cause the problem with generation of a dense point cloud. The lowest RMSE and SD of CP errors were recorded in the workflows with the "E" set, in which all possible optimization parameters were applied, i.e., responsible for radial and tangential distortion, affinity and orthogonality. Nearly all the most accurate models in the experiment have been optimized with these parameters, therefore we recommend their use. A comparison of DEM accuracy results in relation to the optimization sets is presented in Figure 6. However, the possibility of overparameterization should be taken into account [65], for it may result in a poorly modeled surface and that is not reflected in its actual shape. It should be emphasized that the option to skip this step completely or partially should be used only when the operator has more reliable calibration parameters than those estimated by the software (for example, when using cameras calibrated in laboratory conditions). The gain in time is negligible compared to the significant loss in accuracy. Before the use of DEMs for further analyses, we recommend checking them first with CPs.

Best Workflows
Out of 180 completed projects, three workflows were selected, corresponding to the requirements formulated on account of the research aims. The main determinant was the low values of standard deviation and RMSE based on CPs in relation to the processing time of the set of images. On the other hand, when choosing the fastest procedure, it was assumed that the spatial resolution of the obtained DEM was better than 10 cm. The full characteristics of the workflows are presented in Table 2 based on the data contained in Supplementary Materials (S1). Table 2. Detailed description of the three workflows that meet the requirements formulated in view of the research aims. The difference in the SD of CP errors between workflows I and II is 0.38 cm, and between II and III only 0.07 cm. However, the workflows differ from each other mainly in terms of the time of calculations, which in the I type was more than seven times faster than the III type. The conclusion is that setting higher levels of accuracy in the software is not always appropriate (remembering that the total calculation time depends mainly on the computing power).

Type of Workflow
Project

Best Workflows
Out of 180 completed projects, three workflows were selected, corresponding to the requirements formulated on account of the research aims. The main determinant was the low values of standard deviation and RMSE based on CPs in relation to the processing time of the set of images. On the other hand, when choosing the fastest procedure, it was assumed that the spatial resolution of the obtained DEM was better than 10 cm. The full characteristics of the workflows are presented in Table 2 based on the data contained in Supplementary Materials (S1).

Workflows in Python Scripts
In order to process many sets of images more efficiently or develop accurate DEMs and orthomosaics, workflows and their settings presented in the previous subsection were prepared in the form of Python scripts for Agisoft Metashape Professional (runs stable in version 1.7.1 build 11,797). The scripts are text files that run in the software with the Run script tool. They are written to make calculations on all chunks in an open project. The scripts should be used for projects with imported images, and to obtain a high-accuracy model, one should put GCPs on the images before running the scripts. Some of the previous studies have paid attention to the reproducibility of algorithms in Agisoft Metashape software, indicating that they may result in different outcomes (elevation variations ≥10 cm) even while using the same set of images and processed with exactly the same processing workflow [66]. For this reason, the scripts were checked on the same set of images used in the study, in which no significant differences were found based on reports and analysis of the results. Nevertheless, random differences in other larger sets of images cannot be excluded, such that the variance of the point cloud [50] or precision map [67] should be investigated before proceeding with further analysis of the processed data. The scripts are provided as Supplementary Materials for this article. Table 2. Detailed description of the three workflows that meet the requirements formulated in view of the research aims. The difference in the SD of CP errors between workflows I and II is 0.38 cm, and between II and III only 0.07 cm. However, the workflows differ from each other mainly in terms of the time of calculations, which in the I type was more than seven times faster than the III type. The conclusion is that setting higher levels of accuracy in the software is not always appropriate (remembering that the total calculation time depends mainly on the computing power).

Type of Workflow
Project

Potential Applications
The scripts can be used in the analysis of many research objects. The set of images analyzed in this study concerned proglacial areas with different terrain heights. Other potential applications may include, for instance, studies of alluvial fans [68], glacial landforms [40,69], glacier lake outburst floods [70,71] or aeolian landforms [72][73][74]. Furthermore, the scripts can be used for modelling various small objects, e.g., in archaeology [75] or geomorphology [76]. The presented scripts enabled a quick launch and systematic work, thereby making it possible to process more efficiently, e.g., several dozen large sets of images in agriculture [77], where each field can be used as a separate point of interest. The use of scripts, instead of selecting parameters manually, will be particularly helpful when processing many projects simultaneously in a computing cluster, positively influencing usage efficiency. This utility will be of most effective importance for multiannual, cyclical analyses of the same research areas (e.g., glaciers) [44,45], as it provides a constant, comparable workflow, reduces the time spent on calculations and project preparation, and will make comparisons between models more reliable, e.g., in research geomorphological fields such as change detection (e.g., [78]). In addition, field work may require a quick check on a portable notebook to ensure that the selected flight parameters (altitude, forward and side overlap of images) are sufficient to generate an accurate model. Script #1, with the shortest calculation time, may well be the answer to such needs. To increase the chance of repeating our results, we emphasize the importance of the quality of the input data and recommend the use of RAW images.

Conclusions
In this study, we delivered the first empirical test of the impact of processing parameters in Agisoft Metashape on the accuracy of the results of SfM processing based on typical application in geomorphological research. To achieve accurate DEM, it is crucial to use correct settings, including parameters optimizing a sparse point cloud. Moreover, needlessly increasing the level of accuracy of calculations does not always result in an increase in the accuracy of photogrammetric products, but may only extend the calculation process and delay the obtainment of results. To address these problems, three different workflows in the form of Python scripts for Agisoft Metashape were prepared, which, depending on the needs and available computing power, allow for the development of accurate models. For many scientists dealing with surface dynamics, scripts in which automating calculation work is performed should be a noticeable facilitation and may turn out to be a new method of improving quality in their research work. Key calculation settings and parameters, applied in the form of editable scripts, will increase the efficiency in processing and comparing large datasets, in addition to significant time savings due to the use of a powerful computing cluster. The high usability of the scripts is seen in the long-term observations, for example, of many glaciers and their forelands, where the automated workflow allows for a better management of numerous projects, not to mention rendering the process of comparing models reliable. Moreover, the authors do not exclude that the developed scripts will find their use in creating other three-dimensional models of various objects, not necessarily those related to glaciers and their forelands. In addition, it is suggested to perform the same experiment in the future for sets of images from several different cameras, and also including ground-based and oblique images.