# Automated Tree Detection Using Image Processing and Multisource Data
## 4 Proposed Approach
### Flowchart and System  
In this subsection, we present a flowchart of the proposed system, which includes all the necessary steps to label each segment of a map. The entire system is divided into four distinct phases, each comprising several steps. It is important to note that the preferences of the decision maker are taken into account based on the thresholds related to the minimum color observed in the segment, denoted as \(\bar{c}\), and the height threshold, denoted as \(\bar{h}\). The flowchart is shown in Figure 5.  
The first phase, marked in the figure as \"a\", includes data acquisition. This phase primarily involves obtaining all necessary information in raw format and no further calculations are performed. However, it is important to note that the acquisition phase also includes data verification and the subsequent reporting of missing files. In the case of missing data, two main scenarios are identified:  
* If the GeoTIFF (map and vegetation index) file is present while the numerical terrain files are missing, the system is capable of labeling the segment of the map based on the information acquired from the vegetation data.  
Figure 5: The general flowchart of the proposed approach: (**a**) initial data acquisition; (**b**) calculation of the numerical terrain data; (**c**) map segmentation and calculation of the dominant color; (**d**) color and height data binding followed by setting the default thresholds for the colors and height set by the decision maker.  
If the GeoTIFF file is missing while the numerical terrain files are present, the segment label is calculated based on the height and the threshold \(\bar{h}\) set by the decision maker.  
At least one of the above formats is required to complete the labeling process. Phases \"b\" and \"c\" in Figure 5 can be conducted simultaneously since two types of information are necessary at this stage. We determined that the height data could be processed relatively quickly, so in a sequential approach, phase \"b\" is executed before phase \"c\". In phase b, information from two types of.asc files is collected, and data related to map coordinates are used to calculate the elevation relative to the sea level for the entire map. The number of values obtained in this phase corresponds to the number of small segments dividing the entire map. Information about the size of these segments is included in the.twf files.  
Phase \"c\" focuses on map segmentation and calculates the dominant color, based on the vegetation index acquired from the GeoTIFF files. After phases \"b\" and \"c\", this information is integrated with the decision maker's preferences, which is performed in phase \"d\". A single map segment can be labeled as a \"tree\" under certain conditions:  
* The segment is labeled as a tree if the dominant color is red (indicating a high vegetation index value)--this information is derived from phase \"c\";
* The segment is labeled as a tree if the height difference (\(h_{diff}\)), determined in phase \"d\", exceeds a specific threshold \(\bar{h}\).  
The combination of the above conditions results in labeling the selected segment as a \"tree\". This process is repeated for every segment on the map under consideration. The details and implementation of the system are discussed in the following subsection.