Detection of landscape features with visible and thermal imaging at the Castle of Puerta Arenas

There are some archaeological sites with hard accessibility which remain unexplored and barely documented. The use of unmanned aerial systems (UAS) alleviates this challenge with aerial observations monitored with distant remote control. In addition to acquiring images in the visible wavelengths, other devices can be coupled on aerial platforms to inspect beyond the remaining structure of an archaeological site. For instance, thermography has proven to be of great help in the detection of buried remains due to observed temperature anomalies. This work explores the Castle of Puerta Arenas fortress to build the first aerial 3D reconstruction of this site by using RGB and thermographic images collected from a UAS. Orthomosaics have been applied to hypothesize about the original shape of the fortress, whereas 3D reconstructions have been rather applied to visualization and analysis. In this regard, the explored remains have been processed as dense point clouds in the visible and long-wave infrared spectrum, with the latter leading to the detection of hypothetical and still unknown towers. The detection of anomalies has been automatized by performing statistical analyses, globally and limited to smaller 3D voxel neighbourhoods. As a result, the studied remains have been documented and observed from an unexplored perspective, helping their conservation and dissemination, as well as suggesting future excavations.


Introduction
The Arabic rule in Spain began in 711 after the defeat of King Rodrigo at the Guadalete River.This marked the beginning of a significant period of development, which resulted in the gradual displacement of Christians from most of the Iberian Peninsula.However, a small Christian stronghold persisted in the Northern mountains, and it was from here that the reconquest, a centuries-long process, was initiated.One pivotal event during the Spanish reconquest was the Battle of Navas de Tolosa (also known as the Battle of Al-Iqāb in Arabic historiography) in 1212.This battle played a crucial role for the Christian kingdoms, as it resulted in the conquest of a large portion of Andalusian lands by Christian forces.The Nasrid Kingdom of Granada, which emerged during this period, continued to exist with constantly chang-mentation on this fortress was collected by Fernández Hervás (1986).His work provided insights into the castle's shape as observed from the ground.Additionally, Francisco Olivares conducted more recent investigations (Olivares Barragán 1992), shedding further light on the subject.However, it is important to note that due to limited ground-based observations and incomplete data, there are inaccuracies in the depictions of the castle's shape, which will be discussed in detail in Section 4. Despite its proximity to a village, the Castle of Arenas has not received extensive study and research primarily due to its steep and challenging location.Consequently, there is a scarcity of available documentation about the castle.
The use of UAS (unmanned aerial systems) in archaeological fieldwork has steadily increased during the last decade (Campana 2017;Casana et al. 2017;Enríquez et al. 2020;Salgado Carmona et al. 2020).These aerial systems have proven to be particularly valuable for studying archaeological sites located in remote and inaccessible natural landscapes.One of the key applications of UAS technology is in generating 3D reconstructions, which provides an efficient means of surveying large and otherwise difficult-to-reach areas (Collaro and Herkommer 2025;Jurado et al. 2022).UAS platforms have been primarily used together with multispectral (Salgado Carmona et al. 2020;Casana et al. 2017) and thermal (Salgado Carmona et al. 2020;McLeester et al. 2018;Patrucco et al. 2022;Sutherland et al. 2023;Brooke 2018) imaging sensors to capture data beyond the RGB (red, green, blue) spectrum.This approach helps to identify features that may not be readily visible in standard RGB images.However, RGB imagery is still useful when ground-based work plays a significant role in the interpretation process (Enríquez et al. 2020).To extract digital elevation models (DEM), photogrammetry-based 3D reconstructions (Salgado Carmona et al. 2020) or LiDAR (Light Detection and Ranging) sensors (Calleja et al. 2018;Štular et al. 2021) are commonly employed.These elevation maps enable researchers to visualize variations in terrain height, aiding in the identification of human-made structures such as building remains and pavements (Calleja et al. 2018;Pecci and Masini 2016;Dubbini et al. 2016).Furthermore, orthomosaics generated from RGB, thermal, and multispectral imagery provide another valuable tool for rapid visualization, assisting in the detection of anomalous landscape features (Calleja et al. 2018;Potter et al. 2023).Multispectral indices derived from these images and orthomosaics are often computed to differentiate ground and vegetation data, facilitating the identification of patterns in vegetation that may be associated with human-made features, while filtering out vegetation to focus on groundbased patterns.In addition to UAS, lower-resolution images obtained from satellite sources have also been employed for the analysis of archaeological landscapes (Waagen 2019).These satellite images offer a broader perspective, allow-ing researchers to examine larger areas and gain insights into the overall context and distribution of archaeological sites.Finally, magnetometry and gradiometry have also been assessed in seek of hidden patterns in the archaeological site by evaluating the Earth's magnetic (Potter et al. 2023).
One common approach to obtain accurate 3D reconstructions involves utilizing photogrammetry and computer vision techniques on images collected from UAS.This method employs techniques like structure from motion (SfM) and multi-view stereo (MVS) to achieve the desired results.SfM is particularly effective in this context as it enables the detection of key points that are visible in multiple images and facilitates the estimation of camera parameters.This process ultimately generates a sparse point cloud, which can be further enhanced using MVS to create a dense point cloud (Furukawa and Hernández 2015;Clapuyt et al. 2016).A comprehensive 3D point cloud of the castle scenario can be generated with SfM-MVS, enabling a detailed examination of its geometric features.
On the other hand, the preservation of cultural heritage has witnessed significant advancements through the utilization of high-resolution digital cameras, enabling the reconstruction of scenarios with remarkable accuracy.These images not only facilitate the generation of 3D models using photogrammetry but also provide access to information beyond the visible range, depending on the integrated sensors.Thermographic imaging has emerged as a compelling alternative to RGB sensors in archaeological applications (Casana et al. 2017;Brooke 2018;McLeester et al. 2018;Salgado Carmona et al. 2020) since it enables the recording of radiation emitted from object surfaces, be it from the objects themselves or surrounding elements.Consequently, buried remains can be detected through thermal imagery, as the radiation from shallow underground artefacts becomes visible.This approach is particularly effective when (1) a significant thermal contrast exists between the background and relevant features, (2) there is a greater thermal inertia between the ground and the features, typically during nighttime when the ground is cooling, and (3) buried features are close to the surface.While thermal orthomosaics often suffice to reveal artefacts (McLeester et al. 2018;Salgado Carmona et al. 2020), the interpretation of these mosaics can be further enhanced by utilizing 3D point clouds and triangle meshes.
It is important to note that consumer-grade thermal cameras typically offer lower image resolution, commonly around 640 × 512 pixels or 640 × 480 pixels, which poses challenges when estimating dense and large point clouds with photogrammetry (Javadnejad et al. 2020;González et al. 2019;Grechi et al. 2021;López et al. 2021).In this manner, RGB and thermal point clouds reconstructed with photogrammetry can be aligned by estimating a rigid transformation (Webster et al. 2018); however, this approach only works if the thermal point cloud is accurate in terms of spatial 123 features and have a high point density.Then, 3D points from the RGB point clouds are augmented with thermal information extracted and aggregated from the k-nearest neighbours (KNN) (Jurado et al. 2020).An alternative approach involves employing a baseline dense point cloud for the projection of thermal imagery (López et al. 2021.Nevertheless, previous research on fusing thermography with 3D data, whether derived from LiDAR or photogrammetry, has primarily focused on land surveys and façade inspections (Patrucco et al. 2022).This alternative involves projecting thermal imagery by calibrating a thermal device and another one that provides the dense point cloud.The calibration of both kinds of sensors can be performed before the flight, by detecting key points in checkerboards in images (Adán et al. 2020;Javadnejad et al. 2020), or afterwards, by registering co-acquired images (López et al. 2021;Javadnejad et al. 2020).The latter approach has been proven to be more accurate (Javadnejad et al. 2020).
In this study, our primary focus is on the Castle of Puerta Arenas, where we employ 3D reconstruction and visualization techniques to identify and reconstruct the fortress's main features, thus shedding light on its ancient shape.Additionally, we explore the potential of combining RGB and infrared imagery to detect buried remains and extract new hypotheses regarding the castle's history.Therefore, the main objective is to put focus on an archaeological site that has been abandoned, looted, and neglected for almost five centuries.The main contributions of this work are (1) the recognition of the core structure of the castle, including walls and towers; (2) the identification of minor structures, such as cisterns; and (3) the identification of possible spots of buried remains.This paper is structured as follows: Section 2 details the zone of study and the sensors used for data collection.Section 3 describes the acquisition of data as well as the proposed methodology, given by the 3D reconstruction, point cloud characterization, orthophoto, and DEM generation.In Section 4, we present the outcomes of our analysis, showcasing the findings and visual representations derived from the collected data.Subsequently, in Section 5, we delve into the analysis, interpreting the results and providing a comprehensive understanding of the castle's features and their significance.Finally, Section 6 summarizes the key findings of the study and outlines avenues for future research.

Study area
The Castle of Puerta Arenas is situated on Cerro del Castillo, a hill located approximately 39 km south of Jaén in the southern region of Spain.The castle's precise geographic coordinates, based on the European Terrestrial Reference System 1989 (ETRS89) reference system, are 37 • 35 34 N and 3 • 37 20 W. It occupies an altitude of around 1370 m above sea level, with the summit reaching 1393 m and the lower wall positioned at 1360 m.The surrounding terrain is predominantly covered by Mediterranean pine vegetation.The strategic selection of this site by the Moors can be attributed to its natural features, including its mountainous and rugged topography, which offered excellent defensive advantages.The research conducted in this study covers an area of approximately 0.6 hectares.Figure 1 provides a visual representation of the specific location where our research activities were carried out.

UAS and field data
The International Civil Aviation Organization (ICAO) defines a UAS as "an aircraft and its associated elements which are operated with no pilot on board" (ICAO 2011).UAS technology has proven to be invaluable in various fields of  The ease of operation and the high-quality results obtained make UAS an indispensable tool in these domains (Pecci and Masini 2016).For our research, we utilized a DJI Matrice 300, which is a UAS equipped with a DJI Zenmuse XT2 sensor.The DJI Zenmuse XT2 integrates a high-resolution FLIR thermal sensor and a 4K RGB camera.The thermal sensor enables the capture of thermal imagery, while the RGB camera provides high-resolution images.More detailed characteristics of both sensors are presented in Table 1.A total of four flights were conducted, taking into consideration the limitations imposed by the UAS battery charge.The flight plan comprised one nadir camera optical axis, which involved capturing imagery perpendicular to the ground, and three oblique flights to acquire data from the wall sides.All flights were executed in automatic mode, with the first flight conducted at an altitude of 60 m above ground level, while the oblique flights were carried out at an altitude of 50 m.During image acquisition, the frontal overlap for all flights was set at 85%, ensuring significant overlap between consecutive images, while the side overlap was maintained at 80%.These overlap settings help ensure the adequate coverage required for accurate photogrammetric processing.The resulting ground sampling distance (GSD) was calculated to be 2.1 cm per pixel for RGB imagery and 6.0 cm per pixel for thermal imagery.The flight operations were scheduled close to midday to minimize the occurrence of shadows on the archaeological remains.Although the period between sun-set and sunrise is more optimal for thermal imaging due to thermal contrast, safety considerations favoured the midday flight period over the nighttime hours (Casana et al. 2017).The weather conditions during the flights were sunny, with no significant wind.The total flight time accumulated to approximately 90 min, during which a total of 3740 images were acquired.The UAS trajectories are depicted in Fig. 2.

Acquisition of GCPs
In accordance with the sequence outlined by Limp (2016), the first step involves obtaining the coordinates of ground control points (GCP), which significantly impact the geolocation accuracy and the subsequent quality of the generated geometry.For this purpose, a pair of Topcon GR5 RTK-GNSS devices were utilized in real-time kinematic (RTK) mode to acquire GCP coordinates.To establish accurate GCP coordinates, a reference station was positioned at the trigonometrical station of Orozco, which is part of the REGENTE network and situated approximately 1120 m from our study area.As per the manufacturer's specifications, the precision of the East and North components is estimated to be 5 mm + 0.5 ppm, while the precision of the Up component is 10 mm + 0.8 ppm.Consequently, the measurements obtained exhibit centimetre-level precision, which is considered satisfactory for photogrammetric surveys, given that the uncertainties associated with the acquisition and the dimensions of objects (e.g., vegetation, stones, and loose soil) are typically above the centimetre scale (Dubbini et al. 2016).
To ensure accurate georeferencing of the results within a national grid and height datum, the GCPs were carefully positioned.All coordinates in Table 2 are presented in meters, utilizing the UTM map projection system.The reference system employed is the ETRS89, EPSG 25830, and the altitude calculations are based on the mean sea level in Alicante, Spain.Considering the relatively small dimensions of the surveyed area, approximately 0.6 hectares, initially, six GCPs were deemed sufficient.However, due to the steep topography of the site, a total of ten GCPs were acquired to ensure comprehensive coverage.Among these GCPs, seven were  utilized for georeferencing the acquired images, while the remaining three were designated as control points for accuracy assessment.Two GCPs were specifically located on the side of the hill at an elevation of 1350 m.These strategically positioned GCPs played a crucial role in accurately georeferencing the imagery and accounting for the challenging terrain conditions.By carefully selecting and acquiring GCPs, we were able to achieve precise georeferencing and ensure the alignment of the project results with the national grid and height datum, thus facilitating accurate spatial analysis and interpretation.

Software processing
A plethora of open-source and commercial photogrammetric software is available, and, in this work, the processing was conducted using Agisoft Metashape (version 1.7.5).With this software, we were able to reconstruct dense 3D point clouds from RGB images by applying the SfM-MVS algorithm.The orientation of images and the 3D reconstruction are fully automated using images collected from any viewpoint.More insight into the followed steps is provided in Section 3.

Methods
In this section, the steps conducted to acquire data from the archaeological site are described.The procedure is mainly composed of four steps: (1) measurements of GCPs, (2) reconstruction of a dense RGB point cloud, (3) generation of 2D-based maps, including DEM and orthomosaics, and (4) reconstruction of a thermal point cloud.The overall methodology is shown in Fig. 3.

GNSS measurements of GCPs
To ensure accurate georeferencing of the acquired images, a global navigation satellite system (GNSS) receiver was utilized to obtain precise coordinates of the GCPs that served as reference points for aligning the images spatially.Furthermore, these GCPs play a crucial role in assessing the geometric accuracy of the generated 3D model, specifically in terms of scale.To evaluate the scale correctness, the rootmean square error (RMSE) was calculated for the X, Y, and Z axes.The RMSE provides a measure of the deviation between the estimated positions derived from the 3D model and the known coordinates of the GCPs.The RMSE is computed using Eq.1: where x i , y i , and z i represent the estimated positions of the GCPs in the 3D model, and x ref,i , y ref,i , and z ref,i represent their known reference coordinates.The sum is computed over all n GCPs.

Reconstruction of RGB point clouds
In this study, the SfM-MVS method from Agisoft Metashape was employed for the photogrammetric reconstruction.The SfM-MVS approach involves identifying common key points among overlapping images to determine their geometric relationships, as well as generating a sparse point cloud and estimating the camera poses (position and orientation) for each image.Following the initial stage of generating the Fig. 3 The proposed methodology encompasses both land and aerial inspection to comprehensively observe and analyze the archaeological site.By combining data acquired from UAS with ground-based investigations, a more comprehensive understanding of the site is achieved, revealing previously hidden details and enhancing overall insights sparse point cloud, a dense point cloud is computed.However, due to the complex geometry observed in the scene and the potential for errors, the dense point cloud is not further processed to obtain a triangle mesh.Triangulations, in particular, can be challenging in this context.The image processing pipeline implemented in the proposed software comprises several key steps, as outlined below: 1. Image loading: This step involves selecting the images to be used in subsequent stages of the pipeline while excluding those of lower quality.2. Selection of coordinates: Geolocation of the resulting point cloud is facilitated by providing the coordinates of at least three points in the scene.3. Identification of GCPs: GCPs are identified in the images, which is particularly important when the alignment process encounters difficulties.4. SfM: Meaningful features are detected and matched among the selected images, forming the basis for reconstructing the 3D structure.The success of this step depends on the accurate retrieval of features.5. Camera alignment optimization: Non-linear deformations within the model can be mitigated by optimizing the estimated point cloud and camera parameters using the reference coordinates.This involves adjusting the estimated point coordinates and camera parameters to minimize both the re-projection error and the misalignment error of the reference coordinates (Agisoft 2020).6. Dense point cloud reconstruction: Using the estimated camera positions, the depth information of each camera is calculated to generate a dense point cloud that captures detailed geometric information, as the one depicted in Fig. 4. 7. Noise removal: The sparse point cloud undergoes a filtering process to eliminate unwanted surfaces, such as vegetation, as well as spurious data, dynamic objects, and incorrectly estimated points.

DEM and orthomosaic
The next crucial step is the time-consuming process of generating a DEM.This stage involves various results, such as analytical hill shading, derivatives of hill shading from different angles (including range, mean, and Principal Component Analysis), elevation differentiation, trend removal, slope severity, sky-view factor, solar insolation modelling, and composite images such as normalized digital surface model (DSM) combined with shaded relief, as well as greyscale orthophoto image with shaded relief.The primary objective behind generating these maps is to interpret the topography by analyzing visible features and variations in slope.This approach utilizes a geomorphometric technique guided by terrain modelling.The initial step in generating the DEM involves classifying the observed points and isolating the ground from other classes like vegetation and human-made structures.This separation is crucial to ensure the accuracy of the DEM and orthomosaic generation process.Without this classification, the resulting DEM and orthomosaic would be significantly distorted, as they are essentially a fusion of rasterized orthophotos.Subsequently, the orthomosaic is obtained through orthorectification, which corrects for relief effects (terrain) and image perspective (tilt).This procedure

Thermal modelling
We have developed the reconstruction of dense 3D thermal point clouds based on our previous work (López et al. 2021).By employing our methodology, thermal data can be effectively projected into a highly dense and spatially accurate RGB point cloud comprising several hundred million points.Comparatively, the reconstruction of thermal point clouds using photogrammetry techniques is feasible; however, the resulting point clouds tend to be sparser and less geometrically precise due to the lower number of key points captured.Consequently, this sparsity poses challenges for inspecting and analyzing virtual reconstructions of target archaeologi-cal sites.A comparison of reconstructed thermal point clouds is reported in Table 3.For instance, Zephyr achieved a geometrically accurate reconstruction with low point density, whereas Pix4DMapper and Agisoft Metashape computed less sparse results at the expense of having more notable spatial errors, including gaps and noise.In this regard, Fig. 5 provides further insight into some common spatial errors and the lack of detail on rendering when the point cloud is sparser.Previous work has addressed the sparsity limitation by incorporating techniques that improve the rendering of large point clouds, enabling the display of a high level of detail, particularly regarding colourimetric data.A notable example in this domain is the work of Schütz et al. (2021), who leveraged computer graphics shaders in OpenGL (Open Graphics Library) to achieve a mesh-like rendering of point clouds using modern GPU extensions.This approach significantly enhances the visual representation of point clouds, allow- ing for a more immersive and detailed exploration of the reconstructed scenes (see Fig. 6).By adopting similar rendering techniques, we further extend the capability of our methodology to provide visually compelling and informative representations of thermal point clouds.
The methodology consists of the following steps for achieving an accurate fusion of RGB and thermal datasets.Firstly, the RGB dataset undergoes photogrammetric processing to accomplish two objectives: (1) calibrating the camera viewpoints to enable the projection of 3D points into RGB images and (2) estimating a large and dense 3D RGB point cloud.To fuse the RGB and thermal images effectively, the enhanced correlation coefficient (ECC) image-matching algorithm is employed.ECC maximizes the correlation between images by iteratively seeking the optimal transformation that enhances the correlation coefficient with a specified precision.This algorithm is particularly suitable for datasets with notable radiometric differences, such as RGB and near-infrared spectrum, enabling accurate fusion.Before the image-matching stage, both the RGB and thermal images undergo geometric correction to ensure a consistent depiction of geometry across the datasets.Due to the characteristics of each imaging device, RGB images may exhibit pincushion effects, while thermal images may display barrel effects.To address these distortions, the estimated radial and tangential distortion coefficients, along with the camera matrix of each viewpoint, are employed to remove the distortions.Subsequently, an inverse projection is performed on the corrected pixels, mapping them back to the pixels in the original images, denoted as (x d , y d ∈ R).By applying this inverse procedure, none of the pixels in the undistorted images are assigned a blank or null value, preserving the integrity of the data.Finally, colours are computed using bilinear interpolation based on the values of the four surrounding pixels around (x d , y d ).This interpolation process enhances the accuracy of colour representation in the fused images.To provide a visual illustration, Fig. 7 presents a comparison between the original and corrected images.The subsequent step involves fusing the RGB and thermal images using the ECC algorithm.It is important to note that disparities between RGB and thermal images extend beyond differences in the field of view; variations in translation and orientation are also present.To address this, the RGB images are cropped with a sufficiently large bounding box, enabling the ECC algorithm to identify the transformation matrix that optimizes the correlation metric within this bounding box.To achieve a more accurate and visually enhanced image fusion, the ECC algorithm is executed using the most complex transformation matrix, homography (3 × 4), which accounts for both translation and rotation.To ensure precise alignment, a high precision factor of 1 −10 is selected, and a sufficient number of iterations (400) are employed to allow for convergence and fine-tuning of the transformation matrix.A visual representation of the image fusion pipeline is depicted in Fig. 8.The figure showcases the overlapping results of the RGB and thermal images after the image-matching process.
Once the RGB and thermal images are fused, the 3D points from the RGB point cloud can be projected back onto both the RGB and thermal images.Each RGB camera viewpoint is associated with intrinsic and extrinsic parameters, including the focal length, principal point, and rotation matrices.
Consequently, the 3D-to-2D projection matrix (P) can be computed using Eq. 2, where K represents the camera matrix, R is the rotation matrix defined by yaw, roll, and pitch rotation angles, and p denotes the camera location.By applying the projection matrix P, each 3D point is mapped to a 2D point in the RGB image plane as (x RGB , y RGB ) ∈ R 2 .Consequently, retrieving thermal data for these mapped points becomes straightforward once the RGB and thermal images are properly aligned and overlapping.However, it is important to consider that even though points may be projected into a viewpoint and fall within its field of view, they might not be visible in the real-world scenario due to occlusion.Detecting the occlusion tackles projecting background information from the images onto foreground 3D points.In this work, occlusion is detected using a z-buffer, which is an image that stores, for each pixel, the minimum observed distance and the index of the point associated with that distance.In summary, a point obtains a thermal value from a specific viewpoint if two conditions are met: (1) its projection corresponds to a valid pixel within the thermal image, and (2) it is the point with the minimum observed distance at that particular pixel.This approach ensures that only the most relevant thermal information is assigned to each 3D point, considering occlu- It is worth noting that many points in the point cloud may be visible from multiple viewpoints, especially when the dataset is acquired with sufficient overlapping coverage.Therefore, points are mapped to multiple thermal samples that need to be aggregated.The simplest approach is to use the arithmetic mean (Javadnejad et al. 2020); however, a more sophisticated methodology considers several aggregation methods and selects the one that minimizes the distance between the original samples and the aggregated values.This selection can be based on a penalty function that quantifies the error or distance between the samples and aggregated values.Different means, such as arithmetic, geometric, and harmonic, can be chosen based on the penalty function.Figure 5 showcases the thermal point cloud reconstructed using our approach, as opposed to relying on commercial software.

Radiometric transformation
After correcting geometric distortions, the thermal images undergo a process to convert digital numbers (DN) to temperature.Unlike proprietary radiometric formats like R-JPEG, the thermal images were acquired as TIFF (Tagged Image File Format) files in this case study.TIFF files do not allow for the adjustment of ambient temperature during postprocessing and directly store a DN that can be ultimately transformed into temperature.In our specific case study, the default ambient temperature of 20 • C remains unchanged, as it is not relevant to the objective.Instead, the focus is placed on thermal contrast.It is important to note that the stored DN takes into account factors such as humidity, atmospheric transmittance, temperature of the imaging device, and focus distance, among others.For a deeper understanding of the DN-to-temperature transformation in R-JPEG, additional information can be found in the work of Tattersall (2021).However, TIFF files offer the advantage of being easier to read and process with open-source software.One example is ExifTool, which can be controlled via the command line to save visual results and temperature values in separate files.To facilitate the usage of this software, we have developed our own tool, "tiff2jpeg," which has been uploaded to Github (López Ruiz 2023).This tool enables the conversion of TIFF files, allowing users to extract visual representations and temperature information for further analysis and processing.
As a result, every thermal image has two layers: (1) a grey scale, visual representation and (2) absolute temperature values.The latter is obtained as shown in Eq. 3, where DN is the collected value, and h is either 0.04 or 0.4 depending on the operating mode of the thermal device (high-gain mode or not).Accordingly, previous geometrical corrections are performed on both layers, similarly to the projection stage.Following this radiometric transformation, the studied environment had a temperature ranging from 10 to 30 • C (see Fig. 9).

Highlighting of anomalies
A significant portion of the research conducted in this case study involved the use of rendering tools to uncover subtle details related to the fortress structure and identify ther- mal anomalies.Detecting these anomalies automatically can serve as a helpful aid in highlighting subtle details that may go unnoticed by the human eye alone.To identify anomalies, a visualization method described in our previous work (López et al. 2021;Javadnejad et al. 2020) was implemented in this study.The method involves the fusion of RGB and thermal data in the rendering process.Specifically, RGB values are combined with thermal information using a weight function, denoted as w(t), which quantifies the anomaly level of a given sample, represented as t.Anomalies are then classified based on their deviation from the interquartile range, utilizing a purely statistical approach.Figure 10 illustrates the rendering of the reconstructed point cloud, where RGB and thermal data are fused to highlight anomalies.Both images showcase notable anomalies that may potentially correspond to buried remains or other significant features.
In addition to the global anomaly visibility approach described earlier, another approach is to highlight outliers based solely on neighbouring points from the point cloud.However, the main challenge lies in efficiently searching for these neighbouring points.While some methods, such as those utilizing Morton curves, offer efficient and linear spatial search, they are limited by the "z"-shape, reducing the number of points accessible within a small search radius.Furthermore, constructing a "z"-curve requires the develop-ment of tree-inspired algorithms, specifically on GPU, to ensure low response times when applied to point clouds with a significant number of points.Alternatively, using a naive data structure like a regular grid can guarantee linear complexity searches to access a point's neighbours.This approach simplifies the procedure by representing a discretized spatial subdivision, where points are grouped into equally distributed voxels (cubes).The data structure can be computed in real time on the GPU, as points can be efficiently transformed into a grid index.In this case, the memory requirements primarily depend on the aggregated information.
With this voxelization approach, the point cloud is divided into voxels using a variable number of subdivisions.Each voxel is represented by a real number that stores the average temperature of a subset of points.By considering the aggregated data of the surrounding cells, voxels with an average temperature exceeding the environment's average temperature by a factor of r σ env can be highlighted.Here, σ env represents the standard deviation of an environment with variable extension, and r allows for adjusting the anomaly threshold.Figure 11 demonstrates the identified anomalies in a 3D voxelization of size 300 × 150 × 300 derived from the thermal point cloud.In this case, the neighbourhood search was set to 15, and the threshold was set to 2.2 • C. By implementing this approach, outliers can be effectively highlighted, providing valuable insights into potential anomalies within the thermal data.

Results
The findings of this study have been shown throughout Sect.3, and the key results are highlighted below.These results provide valuable insights into the shape of the castle, reinforcing the limited existing data available in the litera-ture.Despite the brevity of documentation dating back to the 1990s, it has proven to be a reliable guide for this study.The topography of the land played a significant role in shaping the fortress, as it seamlessly integrated the castle with the contours of the hill.The ground plan of the castle exhibits an "L" shape, with the shorter limb extending from the north side to the west and the longer limb stretching from the north to the south (see Fig. 12).This distinctive configuration showcases three defensive lines within the inner shape of the castle.On the other hand, the shape recorded by Fernández Hervás (1986) exhibits a distinct layout characterized The first line is an outer wall that defines the perimeter that includes the short limb as well as the peripheral east side of the long one.Thus, it faces the cliff, though it does not reach the southernmost part.On the other hand, the entrance is very poorly conserved and is located at the northernmost area of the outer wall.From the ground, there is only a clearly visible corridor formed by two walls, or what is left of them, that crosses the wall at an angle.However, the aerial view allows the observation of further remains that ought to be considered, as shown in Fig. 14.The second defensive line, known as the middle wall, exhibits distinct characteristics with a unique tower and wall structure.This area is surrounded by the first defensive line on the north and east sides, while it faces the cliff on the west side and the third defensive line on the south side.Notably, only one tower appears to belong to this middle wall.This tower is semicircular in shape and constructed using large, uncut stones with minimal use of mortar.It is worth mentioning that semicircular towers are not commonly found in Andalusian castles, suggesting that this particular tower may have been constructed during a later Christian settlement period.Furthermore, remnants of a water canalization system can be observed at the tower's base, as depicted in Fig. 15.
Between the aforementioned defensive lines, there exists a level space that was once suitable for the construction of secondary small buildings.However, these structures are currently inaccessible due to the presence of collapsed remnants and sedimentation.To gain a better understanding of this area, a geophysical prospection would be necessary to provide insights into buried remains.The thermal images indicate that this zone appears warmer than its surround-ings, suggesting the potential presence of buried structures (as depicted by the saturated red colour in the thermal images).
Within this space, a modest chapel was constructed in the late nineteenth century and subsequently rebuilt in recent years.However, the precise location and extent of the secondary buildings remain uncertain due to the challenging conditions created by the collapsed structures and sedimentation.It is suspected that plundering activities occurred in the past, resulting in a massive pit measuring 13 m wide and 4 m deep.This pit is presumed to be the aftermath of looting, which took place at some point between the abandonment of the castle and its declaration as a protected archaeological site.
The third line of defence can be observed in the form of inner walls situated in the southernmost area of the fortress.This section is considered the most secure part of the castle, as it commands control over all sides of the cliff, except for the northern side.It is hypothesized that on the northern side, the inner walls join the middle walls to create a fortified structure surrounded by multiple layers of defence.The DEM displayed in Fig. 13 reveals a notable protrusion on the Fig. 16 Location of two potentially decimated towers, situated in proximity to the cisterns, observed from a thermal orthomosaic 123 eastern side, exhibiting a size and shape similar to that of the West tower.However, the access to this area is steeper and more intricate.In the thermal imagery, a significant anomaly is observed in the same location, as depicted in Fig. 16.Through a preliminary ground survey, it was observed that this anomaly corresponds to what appears to be the basement of a tower.The absence of the tower's structure may be attributed to the strong winds that prevail at the highest point of the hill.The existence of this tower would have likely gone unnoticed without the intervention of UAS and their ability to capture high-resolution images from unique perspectives.
In addition to the previously mentioned features, one particular element captured our attention during the visual observation of drone flights: the water supply system.The orthomosaic imagery reveals the presence of two wellpreserved cisterns located within the inner enclosure of the castle.However, another intriguing component is a small canalization system that originates from the middle wall, passing beneath the semicircular tower.Initially, it takes the form of a narrow tunnel measuring a few tens of centimetres in width.As it progresses, the canalization transitions into a rough canal carved into the rock of the surrounding area, eventually leading to the cliff on the southern side of the castle.The exact functioning and purpose of this canalization system remain unknown and require further exploration during future fieldwork.

Discussion
One of the most noteworthy discoveries of this study is the identification of the remains of two potential towers that are not easily distinguishable through ground observations alone.However, they were clearly visible in both the DEM and thermographic point clouds.Additionally, this research has successfully generated the first aerial orthomosaic of the Castle of Puerta Arenas, providing a highly detailed view of the castle with a resolution of 1.56 cm/pixel, and a comprehensive understanding of the castle's structure.This includes accurate delimitation of the space within the inner and outer walls, enabling a thorough depiction of a feasible structure.Moreover, all measurements and results are reported in the metric system, facilitating precise analysis of fortress features such as defensive walls, distances between them, as well as the diameter and depth of a significant plundering hole.
The utilization of UAS has proven to be highly advantageous for surveying areas that are challenging to access.In the study area under investigation, the fortress access poses difficulties due to steep slopes, reaching up to 50%.This topographical complexity would have made terrestrial photogrammetry challenging to employ.However, the use of UAS and oblique flights provided a solution by capturing images of every facade, enabling the reconstruction of the fortress and facilitating the observation of intricate details.
While some features could be inferred from visible imaging, the drone's DEM, and the fortress infrastructure, thermal imagery has played a crucial role in enhancing the understanding of areas with significant archaeological value.By fusing RGB and thermal imagery and employing traditional statistical methods, anomalies were detected more effectively.This fusion was executed on a 3D reconstruction of a thermal point cloud, enabling a more detailed examination of the fortress.This representation proved helpful in discerning the infrastructure more accurately and discarding potential anomalies caused by shadows.However, while the global information derived from the point cloud provided valuable insights, it may not have been sufficient for detecting localized anomalies.To address this, the 3D thermal point cloud was voxelized, highlighting anomalies in previously noted areas.For instance, notable anomalies were detected near the water canalization system that descends towards the south area.Similarly, the missing castle towers in the north and south were identified through the 3D anomaly search.

Conclusions and future work
The proposed methodology has successfully generated a 3D georeferenced model that can be seamlessly integrated into a geographic information system (GIS) or building information modeling (BIM) platform.This integration offers significant benefits to archaeologists, as it assists in planning excavation fieldwork with precision and efficiency.This paper highlights the main features of the archaeological site, including ancient remains that make further investigation more efficient by targeting archaeological excavations.The results show the necessity of archaeological prospection as part of a more extensive and long-term project.
Moreover, the utilization of UAS, photogrammetry, and thermal point clouds not only establishes a framework for preventive archaeology but also facilitates the reconstruction of an ancient settlement.This comprehensive approach contributes to the conservation of the site as a cultural heritage asset and a valuable landscaping resource.In addition to the results obtained, which hold the potential to enhance the conservation and dissemination of historical heritage, exploring a wider array of sensors could prove beneficial in identifying additional archaeological features.For example, there are certain areas where additional towers may be missing, like the third defensive line situated beneath the semicircular 123 tower, which unfortunately remains undetected even with the utilization of thermography and RGB imagery.
In future work, a night flight could be carried out using a thermal camera to yield more substantial outcomes.However, this was currently deemed impractical due to the rugged topography of the study area.Furthermore, electromagnetic surveying techniques may offer valuable insights, but they are better suited for flatter terrains, whereas the majority of our study area exhibits irregular and steep topography.Aerial magnetometry, still in its developmental stage, is expected to be easily integrated into drones in the near future.Additionally, LiDAR technology holds the potential for detecting microreliefs, thereby enabling the identification of areas with buried remains.Finally, traditional methods such as GPS or terrestrial photogrammetry should be reserved as complementary techniques to survey specific areas of the castle that require a higher level of detail.

Fig. 1
Fig. 1 Overview of the research area.The right image shows an aerial view of the archaeological remains highlighted with a black polygon.The coordinates are displayed in Universal Transverse Mercator (UTM), in meters (zone 30, ETRS89, EPSG 25830)

Fig. 2
Fig. 2 Various UAS flight paths captured from different perspectives.From left to right: North-South, East-West, and oblique view with East-West swaths.Coordinates are shown in the UTM system (Zone 30, ETRS89)

Fig. 4
Fig. 4 Rendering of a high-resolution RGB dense point cloud

Fig. 6 Fig. 7 a
Fig.6Rendering of the reconstructed RGB point cloud using the OpenGL rendering library.First, the point cloud is displayed using the traditional point primitive, GL_POINTS, whereas the second rendering use compute shaders(Schütz et al. 2021)

Fig. 8 a
Fig. 8 a Summary of the ECC registration method for RGB and thermal images.b Result of the image-matching algorithm, using the original RGB image and the transformed thermal image

Fig
Fig. 9 Temperature distribution histogram across the four flights.Lower temperatures correspond to areas with dense vegetation, whereas the central region predominantly represents rock formations, including both archaeological features and natural formations.Higher temperatures indicate anomalies and heated rock masses

Fig. 10
Fig. 10 Fused rendering of RGB and thermal point clouds to highlight statistical anomalies

Fig. 12
Fig.12Archaeological remains highlighted over an RGB point cloud, including both visible shapes and those identified with thermal imagery (dotted).The reconstructed structure is compared against the shape documented by Fernández Hervás(1986)

Fig. 14
Fig. 14 Fortress entrance depicted using the fused rendering of RGB and thermal point clouds, simply thermal imagery, and RGB and thermal orthomosaics.The fused rendering improves the orientation while visualizing the landscape, whereas thermal representations are better to highlight thermal anomalies

Table 1
Specifications of imaging sensors

Table 2
UTM coordinates (m) of GCPs and their error measured in centimetres (δ E , δ N , δ H )

Table 3
Comparison of point clouds reconstructed by commercial software and our method