The dehesa is an anthropic complex ecosystem typical of some areas of Spain and Portugal, with a key role in soil and biodiversity conservation and in the search for a balance between production, conservation and ecosystem services. For this reason, it is essential to have tools that allow its characterization, as well as to monitor and support decision-making to improve its sustainability. A multipurpose and scalable tool has been developed and validated, which combines several low-cost technologies, computer vision methods and RGB aerial orthophotographs using open data sources and which allows for automated agroforestry inventories, identifying and quantifying units with important ecological significance such as: trees, groups of trees, ecosystem corridors, regenerated areas and sheets of water. The development has been carried out from images of the national aerial photogrammetry plan of Spain belonging to 32 dehesa farms, representative of the existing variability in terms of density of trees, shrub species and the presence of other ecological elements. First, the process of obtaining and identifying areas of interest was automated using WMS services and shapefile metadata. Then, image analysis techniques were used to detect the different ecological units. Finally, a classification was developed according to the OBIA approach, which stores the results in standardized files for Geographic Information Systems. The results show that a stable solution has been achieved for the automatic and accurate identification of ecological units in dehesa territories. The scalability and generalization to all the dehesa territories, as well as the possibility of segmenting the area occupied by trees and other ecological units opens up a great opportunity to improve the construction of models for interpreting satellite images.