## 2 Materials and Methods
### Estimation of Canopy Architecture Parameters by the VitiCanopy App  
Pictures with direct sunlight, weeds, posts, operators, and canopy from the other trees were considered unsuitable for analysis and discarded. Therefore, a total of 173 images were suitable for the analysis, with six to nine images analyzed from each tree. Canopy architecture parameters were obtained using the following algorithms to obtain the fractions of foliage projective cover (\(f_{\mathrm{c}}\)), crown cover (\(f_{\mathrm{c}}\)), and crown porosity (\(\Phi\)), which were calculated from [PERSON] et al. (2019) as:  
\[f_{\mathrm{f}}=1-\frac{t_{\mathrm{g}}}{t_{\mathrm{p}}} \tag{1}\]  
\[f_{\mathrm{c}}=1-\frac{t_{\mathrm{g}}}{t_{\mathrm{p}}} \tag{2}\]  
\[\Phi=1-\frac{f_{\mathrm{f}}}{f_{\mathrm{c}}} \tag{3}\]  
where \(l_{\mathrm{g}}\) = large gap pixels; \(t_{\mathrm{g}}\) = total pixels in all gaps, and \(t_{\mathrm{p}}\) = total gap pixels.  
LAI is calculated from Beer's Law:  
\[LAI=f_{\mathrm{c}}+\frac{\ln\Phi}{k} \tag{4}\]  
Figure 2: (**A**) Distance of image acquisition data in cocoa trees under a Tatura trellis system using the VitiCanopy application (app), and (**B**) image of canopy recorded using the VitiCanopy app.  
where \(k\) is the coefficient of light extinction (\(k\) = 0.61) [20], and the clumping index at the zenith, \(\Omega\) (0), was calculated as follows:  
\[\Omega(0)=\frac{(1-\Omega)\ln(1-f_{\mathrm{f}})}{\frac{\ln(\Theta)}{f_{f}}} \tag{5}\]  
The clumping index is a correction factor to obtain the effective LAI (LAI\({}_{e}\)), which is the product of:  
\[LAI_{e}=LAI_{M}\times\Omega(0) \tag{6}\]  
Equation (5) describes the non-random distribution of canopy elements. If \(\Omega(0)=1\), that means that the canopy displays random dispersion. For \(\Omega(0)>\) or \(<1\), the canopy is defined as clumped.  
This innovative app estimates canopy architecture parameters using upward-looking digital images based on a method developed by [PERSON] and [PERSON] et al. [21]. The image can be automatically sub-divided into \(m\times n\) (\(m\) = number of rows, \(n\) = number of columns) sub-images for gap analysis. For this research, a sub-division of \(5\times 5\) was used for the VitiCanopy App and to analyze each tree sub-image from the aerial image analysis. The algorithms used in the VitiCanopy app were calculated based on the formulas from [PERSON] et al. [19]. In the settings menu of the application, the gap fraction threshold was set as 75%, which means that a big gap was considered when 75% of the pixels from the images corresponded to the sky [21]. A value of the light extinction coefficient (\(k\)) of 0.7 was set based on the range of the standard mean values identified from the samples and according to the literature review data of cocoa tree studies made by [PERSON] [22] and [PERSON] et al. [23]. Since in these images the sky serves as a background to isolate non-leaf material, the app filters sky and clouds automatically by segmentation of images using the blue channel of the RGB images. In order to record the Global Positioning System (GPS) data of each cocoa tree, the location service of the app was enabled. The images were analyzed with the application individually as they were obtained. The results from the app, which included the canopy architecture parameters, date, GPS location, and settings used were exported via email by tapping the \"Export\" option, which generates a comma separated values (.csv) file with all the data.