Identifying Urine Patches on Intensively Managed Grassland Using Aerial Imagery Captured From Remotely Piloted Aircraft Systems

The deposition of livestock urine and faeces in grazed fields results in a sizable input of available nitrogen (N) in these soils; therefore significantly increasing potential nitrogen pollution from agricultural areas in the form of nitrous oxide (N2O), ammonia (NH3) and nitrate (NO3-). Livestock deposition events bring in high spatial variability within the field and the prevention of detailed accountability when assessing the contribution that animal waste has on nitrogen pollution pathways. This study investigated an innovative technique for identifying the spatial coverage of urine deposition in grasslands without the need for manual soil measurements. A Remotely Piloted Aircraft System (RPAS) using a twin camera system was used to identify urine patches in a 5 ha field, which had been grazed by sheep three weeks previous to measurements. The imagery was processed using Agisoft Photoscan (Agisoft LLC) to produce true and false colour orthomosaic imagery of the entire field. Imagery of five areas (225 m2) within the field were analysed using a custom R script. For a total of 1125 m2 of grassland, 12.2 % of the area consisted of what was classified as urine patch. A simple up-scaling method was applied to these data to calculate N2O emissions for the entire field providing an estimate of 1.3 to 2.0 kg N2O-N ha-1 emissions from urine and fertiliser inputs.


INTRODUCTION
In order to improve Nutrient Use Efficiency (NUE) and reduce unnecessary losses in the food supply chain, management of nutrients in agricultural systems has to be considered in its entirety. One potential solution to improve NUE is to use precision farming techniques which take into account the spatial heterogeneity and temporal variability of nutrients already present at the field scale before further fertilizers are applied (Mulla, 2012;Hedley, 2014). In the context of precision agriculture in intensively grazed grassland management, it is of particular interest to study excreta deposited by grazing animals. Nutrient losses from livestock at the field scale are difficult to assess in full due to the randomness of the deposition of urine and dung from grazing animals (Auerswald and Mayer, 2010;Cowan et al., 2015). Past research has focused primarily upon the overall control and management of livestock waste and its impacts on the environment, grass production, and soil quality (Boon et al., 2014;Selbie et al., 2015;Hyde et al., 2016) with little attention paid to spatial heterogeneity.
In the case of sheep urine, the nitrogen (N) content is reported in the literature only sporadically and the uncertainties about these values are large as shown in the meta-analysis reported by Selbie et al. (2015). The nitrogen loading was reported to vary from 500 to 1,089 kg N ha −1 for sheep urine deposits based on the findings that the urine contains 5-10 g N L −1 and a volume per urination of 0.5 L would cover an area of 0.03-0.05 m 2 (Haynes and Williams, 1993). In our study, using these values, the amount of urine N deposited represents an equivalent of 2.0-4.8 times the annual amount of N fertilizer (225 kg N ha −1 ). This excess of applied nitrogen leads to an increased likelihood of N leaching, ammonia (NH 3 ) volatilization, and nitrous oxide (N 2 O) emission, but also increased grass growth (Hyde et al., 2016;Marsden et al., 2016), as well as increasing nitrogen and carbon pools in the soil urine depositions change soil pH, soil surface temperature, and soil moisture content (Marriott et al., 1987;Moir et al., 2011;Boon et al., 2014;Selbie et al., 2015). All factors are likely to change the N 2 O emission rate (Clough et al., 2004;Hoogendoorn et al., 2008;De Klein et al., 2014).
Typical apportionment values for deposited sheep urine are estimated as 13% NH 3 volatilization; 2% N 2 O emission; 20% NO 3 − leaching; 41% pasture uptake and 26% gross immobilization of the total deposited urinary nitrogen (Selbie et al., 2015). Monitoring deposited urine in soils is difficult due to the fact that the urine itself is not directly visible. However, urine patches do have visible consequences for the grass growth, most noticeably color and density of the leaves (Dennis et al., 2011). These properties may serve as a useful proxy for tracking urine deposition, but the response in grass growth to urine deposition also depends strongly on soil type, soil moisture content, seasonal and climatic conditions and the nitrogen content of the urine (Clough et al., 2004).
Existing urine deposition detection methods include simple visual observations of variations in vegetation growth and color (Auerswald and Mayer, 2010). Recent advancements in technology have made it possible to detect urine patches by fitting the grazing animals with GPS collars and thermal sensors (Betteridge et al., 2010), or with cameras footage or urine sensors (Misselbrook et al., 2016); all of which typically require considerable investment in time, human and material resources. These methods are usually either only effective over small areas, a small number of grazing animals or require installing sensors on the animals. Moreover, post-grazing methods to detect urine patches manually or electronically are limited in their ability to capture reliable and good quality data (Misselbrook et al., 2016). The method developed in this study could help to mitigate these issues by increasing the frequency of observations, allowing the study of overlapping urination during the same or different grazing events. In other words, a low-cost, high-frequency, non-destructive method that is easy to deploy in the field is required.
In agricultural studies, practices that make use of remote sensing technologies have been widely developed to map a variety of spatial factors such as crop production estimation (Jensen et al., 2007;Hunt et al., 2010), grass nutrient content (Capolupo et al., 2015;Pullanagari et al., 2016), weed distribution (Jensen et al., 2003), soil spatial variability mapping (Stoorvogel et al., 2015), and diseased or damaged crops (Mirik et al., 2006). Remotely Piloted Aircraft Systems (RPAS) can fly at low altitude allowing acquisition of high spatial resolution imagery to observe small individual objects, such as grass patches, and can be deployed even in cloudy conditions for which the acquisition of satellite imagery or helicopter videography become difficult. The effort required to deploy an RPAS platform has greatly reduced in recent years, contributing in some cases to more flexible and affordable experimentation than with other aerial image acquisition systems (Zhang and Kovacs, 2012). Use of other remote sensing techniques (e.g., piloted aircraft, helicopter, satellite platforms) can be limited in its ability to provide adequate field-scale image acquisition, image quality, and spatial and temporal resolutions partly due to cost and sensitivity to weather conditions (Dennis et al., 2013;Ali et al., 2016;Lopes et al., 2017).
In the case of urine patch detection and grass quality studies, good preliminary results have already been obtained using aerial or ground-based imagery Dennis et al., 2013;Roten et al., 2017). Nevertheless, development of automated preand post-processing of images covering large areas, enabling automated detection of patches, is still required. The challenge of automating patch-detection presents complex difficulties, such as the light variability effect on similar reflectance properties, the requirement of a high-resolution image, the identification and removal of unwanted plants and object reflectance interfering with the detection. Recently, numerous approaches have been developed to perform feature or land-cover detection on images from satellite imagery (Sammouda et al., 2014), phenology cameras (Filippa et al., 2016), microscopic or X-ray imagery, and remote sensing imagery from RPAS (Hunt et al., 2010;Mulla, 2012;Capolupo et al., 2015). For high resolution remotely sensed imagery (where image pixels are much smaller than the objects to be identified), an object based image analysis (OBIA) technique is more appropriate to use compared to a pixel based approach (Blaschke, 2010). Commonly used software packages that use OBIA techniques include eCognition (Gupta and Bhadauria, 2014) or python scripts combined with OpenCV, however, these programs can carry expensive licenses or may not be user-friendly for most environmental and agricultural science researchers.
The method developed in this study is a remote sensingbased approach, aimed at enabling the collection of a large number of urination events at numerous times in an automated way (Mulla, 2012). This method is based on grass growth response and does not measure the area over which the urine has been deposited (wetted area), but considers the effective area (Buckthought et al., 2016). The effective area of a urine patch includes the wetted area, the diffusional area and the pasture response area. The wetted area has been distinguished from the diffusional and pasture response area which incorporates the diffusive edge of the nutrients and the plants able to access, via their roots, these nutrients (Marsden et al., 2016). Often N 2 O emission estimates of urine patches focus on the wetted area only and do not account for the diffusional areas (Williams and Haynes, 1994;Hoogendoorn et al., 2008). By measuring nitrogen Frontiers in Sustainable Food Systems | www.frontiersin.org 2 April 2018 | Volume 2 | Article 10 input from urination and spatially determine their locations, the development of this method has the potential to help farmers to control their fertilizer management, improving NUE, and reducing associated N pollution to the environment. The objective of this study was to evaluate the potential and the limitations of using a combined tool of RPAS orthoimagery and a script written in R (R Development Core Team, 2016) to allow feature detection. The aim was to provide an efficient tool to map urine patch coverage over grazed grassland in order to improve N 2 O estimates at the field scale and to better explain field soil spatial variability.

MATERIALS AND METHODS
Urine patch detection was undertaken by: (1) Collection of pictures in the field using a RPAS; (2) Stitching the collected pictures together to obtain an orthoimage of the entire surveyed area; (3) Automated identification of the urine patches from the pictures; (4) Aggregation of detected urine patch data. This stepwise method was designed to allow the characterization of field scale urine deposition coverage, size, and color.

Remotely Piloted Aircraft Systems (RPAS) and on Board Camera System
The RPAS used in this study was a custom-built, eight-motor multi-rotor system housed in a 1 m diameter Vulcan octocopter frame (VulcanUAV, Mitcheldean, UK; Figure 1), controlled via a 3DR Pixhawk autopilot running Arducopter (v3.2.1) firmware (3D Robotics, Berkeley, USA). The autopilot contained an inertial measurement unit, a barometer, a magnetometer and an external GPS for navigation. The RPAS was powered by two 14.8 V, 10,000 mAh lithium polymer batteries which provide a flight time of ∼14 min whilst carrying the dual camera payload of ∼320 g. The dual camera system was housed in a stabilized gimbal and contained two Canon A2200 point and shoot cameras (Canon, Tokyo, Japan). One of the cameras was unmodified, giving a typical red, green, blue (RGB) image, and one was modified to sense near infra-red (NIR) wavelengths of light through the removal of its internal NIR filter and the addition of an acrylic 585 nm long pass filter (Knight Optical, Harrietsham, UK). The spectral sensitivity of the cameras was tested to identify their spectral characteristics, revealing that for the modified camera, NIR was captured across all channels with the blue channel showing the purest signal (Berra et al., 2015). Both cameras used the Canon Hack Development Kit (CHDK) modified firmware (v1.2) and the KAP UAV exposure control script (v3.1) to enable RAW imagery to be acquired when commanded via the autopilot. The script also allows the shutter speed and ISO to vary within a specified range (1/200 to 1/2,000 s and 200 to 400 ISO, respectively). The internal neutral density filter was not used. The aperture (f 2.8) and zoom level (default) were fixed with focus set to infinity and the white balance was calibrated against a gray card before the flight to provide reliable visual results.

Unmanned Aerial Survey
On the 6th of June 2016, four flights were operated to survey the entire field, from two take-off positions which ran perpendicular to the slope of the field to maintain an altitude of 35 m above ground level. The images captured during the four flights were then considered as one dataset. All flights used pre-programmed automatic waypoints facilitated by Mission Planner (http:// ardupilot.org/planner) to ensure an image overlap of 60% and a side overlap of 80% in order to optimize the image stitching. The flight speed was 2 m s −1 to allow for the camera system to capture images at the rate of one image every ∼6 s. Georectification of the imagery was performed by surveying the center of twelve fixed collars (used for static chambers measurements) distributed within the field using a Piksi (Swift Navigation, San Francisco, USA) real-time kinematic GPS with an expected accuracy of ±13 cm (Figure 2).

Field Site
The survey was conducted over a 5 ha intensively managed grazed grassland ∼10 km South of Edinburgh, 190 m above sea level (3 • 12 ′ W, 55 • 52 ′ N) over the period March 2016 to June 2016 (Jones et al., 2017). The field is predominantly grazed by sheep, which is annually grazed at 0.7 livestock unit (LSU) per hectare rate. Before the RPAS survey, the field was grazed from the third week of March 2016 to mid-May 2016 (7 weeks), by 100 ewes and was fertilized in early April 2016 with 69 kg of N ha −1 in the form of urea. After the grazing period, no animals were present in the field. The field was harvested mid-July 2016 and 12 sub-samples were collected for a total area of 1.5 m 2 . The dry matter (DM) grass yield was 8.0 tone ha −1 with a dry matter content of 243 g kg −1 . The crude protein content was an average of 79.3 g kg −1 DM and the metabolized energy 10.8 MJ kg −1 DM. From the same subsamples, the DM grass yield was found to be significantly different between patch areas, areas where urine was deposited and areas visually not affected by urine (one-way ANOVA, p = 0.0015, n = 12) with an average of 9.5 and 6.0 tone ha −1 , respectively. The protein content and the metabolized energy of the grass did not show significant differences between the two areas of grass visually assessed as patch area or not affected area. The field consists of an imperfectly drained MacMerry soil series, Rowanhill soil association (Eutric Cambisol) with a pH (in H 2 O) of 5.1 and a clay fraction of 20-26% (Jones et al., 2011). The main grass species is Italian ryegrass (Lolium perenne). The long-term average annual rainfall  at this site is 980 mm and the mean daily temperature is 18.8 • C in summer (July) and 5.6 • C in winter (January) (Jones et al., 2017).

Pre-processing Using Agisoft Photoscan
The RGB and NIR images were initially processed to remove erroneous pixels using the Canon Hack Development Kit CHDK (http://chdk.wikia.com/wiki/PTP_Extension), followed by further processing using a custom script in ImageJ (Schindelin et al., 2013) converted each image to a 16 bit linear tagged image file format (TIFF) file (white balance set to 1, no gamma correction) using DCRAW software (Coffin, 2016), which utilized a dark image of the same ISO and shutter speed in order to reduce dark current signal noise. Each image was then smoothed using an ImageJs despeckle filter to further remove noise before the PTlens software (T.Niemann, Portland, Oregon, USA) was used to correct lens and edges distortion. The RGB images were processed a second time to produce a better visual set of data in 16 bit TIFF format (gamma corrected, white balance as set for each flight, utilizing highlight recovery options) and sharpened using ImageJs sharpen filter. The TIFF files were geotagged using the GPS information from the RPAS flight log and were then processed using Agisoft Photoscan (Agisoft LLC), using high settings (Highest alignment, High Dense cloud with mild depth filtering) to produce a georeferenced orthomosaic for each dataset: RGB and NIR (Figure 2).

Algorithm Step 1: Cropping of the Orthoimages and NDVI Calculation
The RGB and NIR orthimages of the surveyed field were stacked on a raster layer then clipped to select smaller areas resulting in a more manageable file sizes of 15 by 15 m of grassland (1107 by 1107 pixels, format .tiff, 20.6 MB, resolution of 1.84 cm 2 pixel) (Figure 2).
Red and NIR stands for the red reflectance and near-infrared reflectance.
The NIR images allowed the calculation of the Normalized Difference Vegetation Index (NDVI) based on the data from the blue channel of the modified camera (to give NIR) and the red channel of the un-modified camera (to give the red). NDVI is a ratio using red and NIR reflectance to highlight photosynthesis (Equation 1). NDVI varies between −1.0 and +1.0 and is mostly used for satellite pictures due to its link with differences in vegetation type, biomass and photosynthetic potential. NDVI is commonly used for feature detection in vegetation environments (Jensen et al., 2003;Hunt et al., 2010;Mulla, 2012). Red and NIR cropped images were also studied in addition to NDVI cropped Frontiers in Sustainable Food Systems | www.frontiersin.org 4 April 2018 | Volume 2 | Article 10 images to estimate the efficiency of using NDVI to supplement the use of either Red or only NIR images.

Algorithms Step 2: Pixel Clustering
To detect urine patches in each picture the clustering method based on pixel segmentation was chosen to be applied to the NDVI raster layer created from the RBG and NIR images.
Clustering is the task of grouping a set of pixels in a way that pixels of the same group called a cluster (K) are more similar in term of color characteristics, to each other than to those of the other groups. In this study, the algorithm was written to perform an unsupervised classification using K-means clustering method (Jain, 2010) on each pixel of the NDVI layer. This method is designed to handle large datasets and follows four consecutive steps for each cluster: 1. Selection of the K cluster centroids 2. Attribute pixel to its closest centroid 3. Set position of each cluster to the mean of all pixel values belonging to that cluster 4. Reiteration of the steps 2 and 3 until convergence or until the maximum number of iterations is reached (default is 10 iterations) The algorithm implemented in R was developed by Hartigan and Wong (1979) for the purpose of partitioning data points into k groups to minimize the distance from the data points to the cluster centroid. In other words, in the Lloyd's algorithm (Equation 2), for each iteration, each pixel is assigned to the cluster with the smallest value of: Where n is the number of pixels, K the given cluster, i is the pixel considered, c i is the set of pixel that belong to the cluster k and x i − µ i the Euclidean distance between the pixel i and the centroid of the cluster K. The selection of the cluster first centroid is normally randomized inside the whole image. But in this study, the starting point to the K-means method was arbitrary set to ensure that the results would be the same if the process was to be repeated. The clustering was performed for a set number of clusters per image that needed to be predetermined. For this purpose, the elbow method (Figure 3) which is a hierarchical cluster analysis was performed using a set of dissimilarities for the number of objects (n) being clustered. The method selected was the Ward's minimum variance method (Ward, 1963) that allows the identification of compact, spherical clusters. Through this method, the optimal number of clusters was found to be 4 for the 15 by 15 m squares of grassland.

Algorithms Step 3: Isolation of Each Urine Patch
The next step was to isolate the urine patches from each other. For each image, inside the cluster corresponding to the urine patch, the connected adjacent pixels were grouped together to form a patch. For this step, a virtual window of 9 by 9 pixels was created to screen the whole image to remove small groups of pixels which were noise from the clustering step. Then using the same method, gaps inside the same patch were dissolved and pixels belonging to the same patch were connected. Before moving to the next step, the function rasterToPolygon() (from the R package "raster, " https://www.rdocumentation.org/ packages/raster/versions/2.6-7) was used to convert each patch as a polygon.

Algorithms Step 4: Patch Selection and Calculation of Their Characteristics
To avoid the detection of unwanted objects such as weed patches, small shadows and groups of denser grass, objects <300 cm 2 were discarded, which correspond at the minimal potential size of a urine patch (Selbie et al., 2015;Marsden et al., 2016). Finally, the patch characteristics such as size, centroid coordinates, patch average color values, and shape index (giving an information on the shape of the patch) were calculated and converted to square meters. These values were used to estimate the total coverage of urine patches at the field scale. A step-by-step synthetic diagram of the script is provided in Figure 3.

RPAS and Image Stitching Limitations
The orthoimages (i.e., RGB and NIR) obtained from the RPAS survey undertaken on the 6th of June 2016, were generated using Agisoft Photoscan (Agisoft LLC). The Figure 2 shows the output of this software: RBG orthoimage and NIR adding the red digital channel and the Digital Elevation Model (DEM) reprensenting the elevation from the sea level. The stitching of the images captured by the RPAS into an orthoimage is necessary to create an image appearing as though it was taken from a uniform altitude, a rectilinear lens, with limiting edge distortions and with accurate details. The image stitching software is limited by the quality of the pictures captured and the weather conditions (e.g., influenced by light and wind speed). The quality of the camera can also be problematic in some cases. To account for the images distorsions, the surveyed area must be at least 10 m wider than the actual study area. Moreover, color calibration of the pictures is required to enable time series monitoring and the comparison between fields. The proximity and the size of the urine patch deposition required a high pixel resolution but also required the images to be as close as possible to true-colors to ensure accurate patch detection. A more detailed review on the challenges and limitations of using RPAS over grassland environments is presented in Von Bueren et al. (2015).

Image Segmentation Using K-Means Algorithm
Orthoimages of the whole field were cropped to 225 m 2 squares (15 by 15 m) of grassland (Figure 2). Five of these cropped images, corresponding to locations close to the middle of the field surveyed, were processed using an R script (see location of the first square in Figure 2) as a proof of concept.
To automate the patch detection, the K-means method (Hartigan and Wong, 1979), commonly used for image segmentation (Lopes et al., 2017;Singh and Misra, 2017), was Frontiers in Sustainable Food Systems | www.frontiersin.org 5 April 2018 | Volume 2 | Article 10 implemented in the R script. The advantage of this algorithm is that it has a low computational complexity, it is an unsupervised learning mechanism and the resulted clusters of this method are not overlapping. This method was able to detect the urine patches on image with high color similarities, patches in close proximity, and overlapping. However, the K-means methods can work efficiently only if the optimal number of clusters is correctly determined. In this script, the elbow method (Strobl et al., 2017) was used to determine that four clusters were the optimal number of clusters required (Figure 3). The Kmeans results ( Figure 4B) were compared visually to the RGB images ( Figure 4A) to access the certainty of patch detection. The specific cluster corresponding to the urine patch was allocated visually and processed using custom functions to isolate each patch (Figures 4C,D). This step is the limitating step in terms of computational complexity, and therefore it is the slowest step in the process ( Table 1). An object-based detection instead of a pixel-based method could improve the efficiency of this step but would require a supervised initial classification of some of the areas by the script-user (Rastner et al., 2014). Other features may be mistakenly be labeled as patches when in reality they are weed patches, fence poles, or tractors tracks. These issues have not been assessed in this study due to the fact that the study area did not contained any of these items, but it will be Frontiers in Sustainable Food Systems | www.frontiersin.org 6 April 2018 | Volume 2 | Article 10 important to include a correction in a future version of this script.
The typical wetted area of the sheep urine patch, based on field measurements, is estimated to be between 300 and 500 cm 2 (Selbie et al., 2015;Marsden et al., 2016). Additionally, the effective area of a sheep urine deposition has been shown to not exceed 20 cm beyond the wetted area (Ducau et al., 2003). Therefore, the total area of the visible patch can range between 400 and 1,600 cm 2 (Marsden et al., 2016). The effective area may vary with the volume, the urine nitrogen concentration, soil texture, soil moisture content as well as the topography of the area, vegetation type, and root architecture (Haynes and Williams, 1993;Dennis et al., 2011). Using this information, the script was written to select effective patch areas larger than 300 cm 2 .

Validation of the Use of NDVI
NDVI used in this study was chosen for the analysis based on references belonging to other scientific disciplines such as satellite images analysis (Zha et al., 2001;Colombo et al., 2003), feature detection for self-driving cars (Cho et al., 2014) and other RPAS studies as described in the section 1. It was chosen in this study due to its capability to detect the small differences of the green and red spectra inside the images (Rasmussen et al., 2016).
The NDVI is based on Red digital numbers and NIR reflectance values which required to modify the camera to measure NIR. Multispectral sensors such as the parrot sequoia or red edges (https://www.parrot.com/us/business-solutions/ parrot-sequoia), are often used to measure NIR values. These devices are about five times more expensive than the modified Canon camera used in this project. Moreover, the necessity of having an extra device on the RPAS would have increased payload capacity of the RPAS and cost. The downside of having two different cameras to ensure that each pixel in both orthoimages are corresponding to the exact same location in the field. For this task, the images have been georeferenced using GPS data collected in the field. The next step was to identify if the Red digital numbers or the NIR data alone could differentiate efficiently the area affected by urine deposition to the rest of the field. After running the script using the NDVI data, a t-test has been used to compare the values of pixels allocated to the patch area and the ones allocated to the "non-patch" area. The Fvalue and the R 2 from the t-tests were used to compare the performance of the color indices (Figure 5). The difference between pixels allocated to the patch and non-patch area was significant for the three indices (Red, NIR, NDVI). Nonetheless, in this study, Red and NIR values for pixels allocated to urine patches were significantly different than the non-patch pixels. However, from the F-stats and R 2 values, it is clear that NIR and Red digital numbers did not perform as well as the NDVI values ( Table 2).

Urine Patch Coverage and Characteristics
The detection of individual urine patches using the RPAS during four flights on one single day allowed us to calculate the area covered by patches over a sub-section of the field of 1,125 m 2 ( Table 3), which was 12.2 ± 2.2 %. This coverage value has been used as an estimate of the whole field coverage which corresponds to an area covered by urine patch of 0.7 ha for the 5 ha field. This value is at the low end of urine patch estimation compared to repeated estimates (14-31%) over a year of urine depositions from repetition grazed cattle using field observations or RPAS imagery and grazed by cattle Dennis et al., 2013;Selbie et al., 2015). This difference is likely due to the short grazing period before the survey (7 weeks), smaller animals (sheep) as well as as well as the urine nutrient content difference (Kelliher et al., 2014). To evaluate the annual    [2003][2004][2005][2006][2007] where the urine patches were identified visually in the spring, summer, and autumn periods each year. This identification was time-consuming and took 12 weeks for each season and was considered to be relevant for the previous 3 months of urine deposition. By comparison, RPAS survey could be undertaken weekly, pre-and post-grazing and will generally take <2 h. In this study, every grass patch detected using the RPAS survey was considered as a urine patch. However, dung patches are likely to form grass patches unde specific conditions of accumulation of sheep dung. In contrast to cattle dung which forms a grass patch of >50 cm 2 after degradation of the dung (taking up to 12 months), sheep dung is in form of pellets scattered over large areas and are unlikely to generate a discernible pasture response (Williams and Haynes, 1995). Moreover, within the period between the grazing ends and the RPAS survey the sheep dung depositions were probably fully degraded (Williams and Haynes, 1995). Therefore, dung deposition was not visible in the output images. For these reasons, grass patches visible in the output image have been assumed to be due to urine and not dung depositions. In the case of potential prior excreta depositions, in this study, the previous grazing event was over 5 months prior to the grazing period studied. Therefore it was unlikely that previous depositions were visible on the RPAS survey images.

Estimation of N 2 O Emissions From Patches at the Field Scale
In this study, the urine patch coverage was used to estimate urine and fertilizer induced N 2 O emissions. A homogeneous amount of urine deposited on the patch has been assumed to calculate the total N 2 O emissions of the studied field. The calculations have been based on the national greenhouse gas inventory methodology (De Klein et al., 2006). The emission factor of mineral nitrogen fertilizer application and of urine deposition is 1%, i.e., 1% of the nitrogen applied is emitted as N 2 O. During the period of study, a treatment of 69 kg of N ha −1 was applied and we estimated that 12.2% of the field was covered by urine patches. The amount of nitrogen in sheep urine is required to use the emission factor but this is poorly reported in the literature Hyde et al., 2016;Marsden et al., 2016). For these calculations, the data summarized by Selbie et al. (2015) on sheep grazing urine N content were considered. The N loading for sheep urine was ranged from 500 to 1,089 kg N ha −1 . An average value of 800 kg N ha −1 was assumed. From these data, the total emissions of N 2 O from both urine and N fertilizer application was estimated at 1.3 and 2.0 kg N 2 O-N ha −1 for the period of grazing studied ( Table 4). The emissions from dung depositions and the potentially combined effect of urine and fertilizer were not considered.
To provide an order of magnitude, the contributions of the N 2 O emissions from 7 weeks of grazing of 100 ewes and from the mineral fertilizer applied during the same period have been determined. The urine depositions from the grazing ewes contribute of 47-66% of the total N 2 O emissions (   To improve the up-scaling of the emissions, more specific emission factors are required for sheep urine patches Marsden et al., 2016), as they vary with season, soil properties (texture, pH, moisture content), and as it has been done for cattle urine deposition (Clough et al., 2004;Boon et al., 2014;Krol et al., 2016;Minet et al., 2016).
These calculations were based on the percentage of urine patch coverage calculated previously and so, on the effective area of the urine deposition. The difference in emissions between the wetted and the effective areas was assessed for cattle urine by Marsden et al. (2016). They concluded that the cattle urine patch diffusional area is an extremely important source of emissions from urine patches and needs to be considered when measuring EFs. This study justified using the total area affected by urine deposition instead of the wetted area for N 2 O emissions calculation.
These results (Table 4) are an example of how the urine patch coverage can be used to improve our understanding and estimation of emissions. Furthermore, the automated detection of urine coverage can improve model validation when compared with field data, upscaling from individual patches to field scale as well as allowing the consideration for temporal changes of the emissions.

R Script Efficiency
This study has led to the production of a script written in the R software. This software is largely used in the scientific community as a statistical tool but more and more researchers are using it for spatial and image analysis. OBIA techniques can be implemented to optimize the processing time and increase the accuracy of the detection (Blaschke, 2010). The R-package currently under further development, will allow researchers working in this area to easily replicate a similar analysis. For a 225 m 2 square of grassland, the script will take 48.4 s to process (on a computer with limited power capacity, 4GB RAM, processor Intel R , Core TM , i5-5200 CPU, 2.20 GHz). Each step of the script time processing is shown in Table 1. While considering 1 ha of grassland, the script takes about 35 min to run (Figure 3). This accounts for the image segmentation, clustering, the calculation of the parameters of each grass patch and plotting the results, but does not include the generation of the orthomosaic. In future, it will be important to expand this code to run with object-based detection software such as eCognition by Trimble or ArcGIS software by Esri. This would prevent multiple counting or miscounting of patches at the edges of the smaller images by processing the entire field image at once. It will also allow the analysis of larger datasets, such farm scale or entire grazing period datasets.

CONCLUSIONS
In this study, RPAS and R image analysis have proven to be effective when carrying out high-resolution, non-destructive, near real-time, and low-cost assessment of the size and distribution of urine patches from aerial surveys. This process has been automated and kept unsupervised. The process is based on R software which gives the opportunity to researchers to easily adapt this script to their research purposes as well as directly using it for urine patch coverage estimation. An outcome of this study is the R package which facilitates easy and quick processing of the orthoimages collected with a RPAS. The script efficiency has shown promise for analyzing small and homogenous areas which seem to work sufficiently for plot-based experiments or individual occasions. However, for long-term monitoring of grazing and management impacts on grassland, a more efficient software would be required. Using low-cost RPAS, onboard cameras and an open source software, this method offers new perspectives for nutrient management, precision agriculture, and greenhouse gas emissions estimation in grassland systems.

AUTHOR CONTRIBUTIONS
JM and SG-P designed the method, developed the image analysis approach and conducted data collection. JM wrote the paper with contributions from all co-authors.