OPTIMIZED POST-PROCESSING OF MULTIPLE UAV IMAGES FOR FORESTRY INSPECTIONS

The following paper discusses possible optimized post-processing and data tracking of UAV imagery for forestry inspection. The survey took place in the National Natural Reserve Božídarské rašeliniště – The Wetland of Božídar from 2015 till now. The purpose of this study is to provide with a suitable post-processing method of UAV images in a protected area with no necessity of human interaction with the species. The authors used UAV imagery from RGB and multispectral sensors. The focus of the paper is the postprocessing which relies solely on open-source tools. The results of the paper are a script for automatic computation of vegetation indices, a script for canopy height model in a certain part of the mapped area a possible GIS solution for storing and tracking the data. * Corresponding author


INTRODUCTION
Sustainable management of forests and protected natural reserve areas requires a detailed understanding of the area and how it changes by conducting constant and on-time inspections. The science for gaining tree metrics called dendrometry consists of field measurements of tree metrics and has been vastly used so far. It implies the usage of different laser rangefinders with geometric and trigonometric calculations. Important aspects of forestry inspections are the number of trees in a certain area, its density with a tree/ha unit, tree volume, etc. (Tiberiu Paul Banu, 2016). Although dendrometric techniques are simplified and easy to apply, they could be time-consuming, expensive and sometimes impossible to apply. Moreover, these techniques could be insufficient for certain forestry monitoring. Other parameters that are mainly scoped by researchers are canopy height model (CHM), crown projection area (CPA), diameter at breast height (DBH) (Grznárová et al., 2019). The latter will sometimes be impossible to measure by conventional techniques. Recently, many technologies have been used for detailed monitoring of forests. All of them are branches of the science of Remote Sensing. The Remote Sensing techniques provide better overall inspections of a forest area and what is more, there is no need for human interaction with the species. Satellite data has proved to give a beneficial overview of a forest state. With the numerous open-source satellite data available, it's easier for different specialists to use these data resources. Another preferred technology is the Light Detection and Ranging technique (LiDAR) which provides with more precise remote measurements of the digital terrain model (DTM) (García et al., 2018), (Tomková and Lysák, 2019). However, the latter could be either expensive or difficult to post-process. Some authors have used LiDAR technology and machine learning in order to obtain some forestry indices. As an alternative to LiDAR, the fast pace of technology and implementation of low-cost Unmanned Aerial Vehicles and Systems (UAV, UAS) have made it a possible tool in vegetation analysis (Mohan et al., 2017), (Pauly, 2014), (Tiberiu Paul Banu, Gheorghe Florian Borlea and Constantin Banu, 2016), (Pavelka, 2019), (Mohan et al., 2017). On one hand UAV images are gathered relatively fast and there is no necessity of human interaction with the trees. On the other hand, given the homogeneous texture of the forests, UAV images possess several obstacles like problematic image alignment (Wallace, 2017). The study area discussed in this paper is a protected area, what is more, a moorland. There is a short man-made wooden path for people to observe the scenic views of the area. This fact makes it impossible and dangerous for in-situ observations. In such cases, close-range aerial images could assist forest administrators to take better control of the wetland and the tree species. The goal of this paper is to present a methodology of image post-processing from multiple remote observations and develop a tool for forest managers to easy access to these data. The authors used optical RGB (red, green, blue) and multispectral data for broad-scale analysis and different temporal and geographical scales in the wetland of Božídar. However, working with multiple data, forest administrators will not only need a photogrammetric software solution, but also several GIS software solutions and considerable knowledge of geospatial processing. For example, the output results from multitemporal flights might result in numerous data which could involve time-consuming manual work. That is why we have decided to look into the possibility of creating an optimized post-processing solution which would not only save valuable processing time, but also establish better cooperation between different experts and the forest administrators.

Description of the Study Area
The study area is situated in the Krušný mountains in the Carlsbad Region, Czech Republic (see Figure 1.). Translated from Czech, Božídarské rašeliniště means the Wetland of Božídar, which is a wetland accumulating peat and turf. It is located between 940 m -1115 m altitude above sea level with an approximate area of 930 ha. Turf has been extracted in this area until the beginning of WWII, and since 1965 the whole wetland has been proclaimed a National Natural Reserve. The total area of the reserve is 930 ha, all of which is protected and supervised by the Natural Conservation Agency of the Czech Republic (NCA CR, 2020). The most common species in the area are dwarf birch, spruce, kneeling and pine trees surrounded by meadows. The subject of protection is a set of hillside pea-bogs, springing from fissure water screes with and peat meadows which altogether form a moorland.

Flight Campaigns
Several flight campaigns were conducted between 2015 and 2018 with three different sensors. These are presented in Table  2 with the output datasets needed for forest inspections. The purpose of this table is to outline the necessity of a spatial geodatabase for storing, post-processing and updating the information regarding the Natural reserve. However, if the datasets are not stored in a database, the data will accumulate with time which makes it difficult for automatic post-processing or temporal analysis. In this paper, only two sample data are showna multispectral flight campaign from 2017 and an RGB dataset from 2015. The multispectral imagery is used to present the automatic processing of vegetation indices. The RGB dataset is used to present the optimized algorithm for tree detection. The goal of the study is to discuss a possible methodology for storing and post-processing multiple datasets.

Photogrammetric Processing
For all image processing, we used Pix4Dmapper (Pix4D Ltd., 2020) which is a part of the UAS eBee. We used the geotags of the images for geolocation in WGS '84 UTM 33N. The RGB images were computed with a custom number of keypoints: 15 000, because of the homogeneous texture of the tree crowns. The initial ground sampling distance was 4.88 cm. A pointcloud densification has been done and the resulting pointcloud was exported into *.las format. A digital surface model (DSM) was created with 5cm resolution and a digital terrain model (DTM) with 25cm. Respectively an orthophoto mosaic was created with a pixel resolution of 5 x 5 cm. The NIR images were processed similarly and an orthophoto was resampled with the same pixel size of 5 x 5 cm. Processing multiband images though requires a radiometric calibration. Prior to each flight, several images of a calibration panel were taken and later used in the post-processing software. We used the reflectance values provided by the manufacturer to correct the whole image dataset. In that case we can later do spatial analyses with the multispectral data. For image alignment, the number of matching keypoints was increased to 20 000 because of the low resolution of the multiband camera. Multispectral datasets were resampled to 16 x 16cm pixel size for the resulting reflectance maps and digital surface models.

Post-processing for the multispectral data
Multispectral imagery provides additional information regarding the individual tree species which can be classified using machine learning methods or analysed for diseases or insect invasions (Ibanez et al., 2016). The photogrammetric processing resulted in creating 4 different orthophoto maps which contain the reflectance values in each pixel. A map was created for each bandgreen, red, red-edge and NIR. We created a simplified autonomic vegetation calculation for the specific type of camera that we used. This script saves manual work and time in the processing. The calculations were done using Python language from the Python console in QGIS. This script called"MultiBand_VI_calc.py" uses the gdal library which focuses on raster calculations. Namely, the goal of this script is calculating all possible vegetation indices from the multispectral camera. The structure of the script is the following: Importing the necessary library in pyQGIS.

from osgeo import gdal
The script creates as many functions as the number of bands or output rasters -fn1, fn2, fn3 and fn4. This script facilitates the fast vegetation processed for multiple images with different temporal and spatial resolution. The input and output directories must only be changes after each processing.

Post-processing for obtaining tree metrics
The authors have used an algorithm to calculate the tree density in the area of the wetland based solely on open-source products. For this purpose, a point cloud has been used from a flight campaign in June 2015 with an RGB camera. As mentioned above, the photogrammetric imagery was processed in Pix4Dmapper and after the point cloud densification was computed, the point cloud was filtered using Mean Filter with a window 3x3m. Based on the filter pointcloud the Digital Surface Model (DSM) and Digital Terrain Model (DTM) were computed. The workflow is described in Figure 2.
In order to compute the density, the individual tree must be detected. We chose to work with a Canopy Height Model (CHM) of a certain region of the mapped area. The CHM was computed in pyQGIS/gdal as a subtraction of the DSM and DTM rasters. The canopy height model was calculated as per formula (1): After CHM computation a clipping function was applied using a polygon in shp format. The polygon was chosen in a way that it encompasses only trees with an area of 55 ha. The clipping is again performed in pyQGIS/gdal. A condition for this computation is that all the dataset is in the same coordinate reference system. The input and output data are defined as follows: rasin = 'C:\CHM.tif' shpin = 'C:\cutarea.shp' rasout = 'C:\CHM-clipped.tif.' The gdalwarp function in gdal plays an important role for reprojecting the dataset. The function -crop_to_cutline is enabled for the raster to be clipped according to the cutline of the cut polygon.

iface.addRasterLayer(rasout)
The detection of individual trees is computed by searching for local maxima in a predefined areawindow. We used a circular window with a radius -1 m, 3 m ad 5 m. This method is a part of the neighbourhood functions known in GRASS GIS like r.neighbor and in ArcGIS -Focal Statistics. Focal functions calculate a new value for every cell in the output raster as a function of the existing values of the cells in its neighbourhood on the input raster. The cell being processed is called the focal cell. The neighbourhood could have different shapes: rectangular, circle, wedged, etc. (Zhu, 2016). The graphical results of the three computations are shown in Figure 3, 4 and 5.  The tree density is computed from the three computations with different window size ( A comparison was carried out by overlapping the densified point cloud and the three pointsets. The results showed that when using a circular window with a 1m radius up to three local maxima were found on a single tree crown. This could be due to broad tree crowns.

Creating a GIS database
The authors gathered multiple image dataset from the study area from 2015 till now. This fact makes it difficult to operate and cooperate with other people with the same image data. One solution to bridge the gap between different expert teams is to create a spatial database where to archive and store spatial information. To analyse the measured datasets of the Wetland of Bozidar, we used a PostgreSQL database (DB) (Berger, 2014), (Landa, 2017). We created the DB bozidar with the extension postgis and postgis_raster using the Query tool in the pgAdmin: In this command, the correct coordinate system, path, name, schema and database were written. Then, the DB was attached to QGIS and later shp-format files were imported from the DB importer. Figure 6. Visualised datasets in QGIS stored in a PostGIS database

Results
The results of this paper are two scripts written for pyQGIS which accelerate the post-processing when having multiple image data. The authors used image datasets from their long work monitoring of the Wetland of Bozidar. The first script enables faster computation of vegetation analyses and clips the index maps with a predefined area of interest. The second one is a preliminary script which deals with individual tree detections. After the photogrammetric processing, the point cloud of an RGB dataset taken in 2015 was densified. A mean filter was applied to the pointcloud for noise reduction. After this, a DSM and DTM were computed. Based on these two rasters, a canopy height model was computed. To detect the trees, neighbourhood statistics were used to search for local maxima in a predefined window. The shape of this window was set to be circular. Three different radii were applied -5 m, 3 m and 1 m. A comparison between the number of tree and tree density was made. As it might be expected, the number of local maxima varies depending on the window size. The authors, therefore, compared the densified pointclouds and the three pointsets. This resulted in the conclusion that using a window radius of 1 meter might calculate up to three local maxima on a single tree crown. The authors suppose that, the algorithm should be preceded by crown delineation, calculation of the average crown area and this number should used as a window radius. Given the fact that the second script is still preliminary, the authors will focus on improving it. Furthermore, a spatial geodatabase was created to archive, store, track and cooperate with the imagery data from 2015 till 2018. For this purpose, a PostgreSQL database with a postGIS extension was used. To enable raster import, the postgis_raster extension was added. The database bozidar was connected to QGIS where the data can be accessed. This geodatabase improves the cooperation between geodesic engineers and forest administrators.

Future work
The authors continue their work on improving the optimized computation of tree metrics. In order to compute accurately the tree density, a crown delineation must be carried out first. An average value for the crown diameters in a certain region will give better aspects for selecting either the shape or radius of the searching for local maxima window.
Having created a geodatabase of multiple imageries, the authors look into the possibility of creating an automatic statistical computation between the same tree metric parameters for all necessary datasets. The work is focused only on using open source tools.