## 2 Materials and Methods
### Leaf Segmentation
#### 2.3.3 \(k\)-Value for \(k\)-Means  
The \(k\)-value, which is the initial parameter of the \(k\)-means, is the total number of segments expected in the PCDs. The elbow method has been introduced to determine the robustly optimal \(k\)-value in the literature [30; 32]. However, the insignificant spatial deviation of datasets might occur with different \(k\)-values, leading to criticism due to unsuccessful performance. The \(k\)-value is expected to be equal to or  
Figure 3: The algorithm for leaf segmentation: (a) \(k\)-means, where triangles and squares represent the centroid of grouped clusters. The distance from the centroid to the group points is \(Di\) in the \(n\)th iteration and \(D^{\prime}i\) in the \((n+1)\)th iteration. As the sum of \(\sum\)\(D^{\prime}i\) becomes minimum, the iteration will stop or the iteration will continue. (b) Octree (Oi) is an octree space unit that is divided by octree. greater than the number of leaves (\(N\)) to prevent multiple leaves from being grouped into the same cluster (\(k\geq N\)). In other words, knowing the value of \(N\) explicitly is of great interest in determining the optimal \(k\)-value. As discussed previously (Section 2.3.2), \(N\) can simply be estimated by evaluating the relationship between the total number of points in a single leaf and the octree unit space. In addition, as described in a previous section, one octree unit space (Oi) is expected to contain 1 to 3 leaves. Therefore, the initial \(k\)-value should be set to at least greater than 3 (\(k\geq N=3\)). However, in reality, the estimation of \(N\) is not always correct. In Figure 4a, \(N\) is truly equal to 4, but the estimation (\(N=3\)) is intrinsically lower. A larger \(k\)-value (\(k\to k^{\prime}\)) should be given until \(k^{\prime}\geq N\) to properly separate the clusters of leaf PCDs into a specific number of clusters. Increasing the \(k\)-value without limitation, regardless of a reduction in the number of PCDs, causes the leaf PCDs to become smaller, rendering them susceptible to noise and anomalies in calculating the leaf angle [10] and making the process computationally inefficient. In this study, a simple method for deciding the \(k\)-value is provided by considering the distance of the points from the centroid and the leaf gap distance (\(L\)), i.e., the shortest distance between two close leaves. As shown in Figure 4a, the longest distance from the centroid to a cluster point in each group is \(r\). Thus, for the groups \(Ci\), \(Cj\), and \(Ck\), the longest distances are \(ri\), \(rj\), and \(ri\), respectively, where \(rj>rk>ri\). When multiple leaves are included in the group, such as in \(Cj\), the distance \(r\) will be longer than half the distance of the leaf gap (\(r>L/2\)). In this case, the \(k\)-value can be added to have more domains for grouping the leaf PCDs. As can be seen in group \(Cj\), as more than a single leaf is included in group j, the \(k\)-value can be increased to \(k+1\) (i.e., 4). The cluster is split into two different clusters if r of the cluster exceeds a pre-specified value (\(L/2\)). As a result, four domains are created, and two leaves being grouped together can be prevented. In other words, it is not required to increase the \(k\)-value indefinitely, but only gradually until all \(r\)-values in the domains are not beyond (\(L/2\)), which means \(r=\{ri\dots rn\}\leq(L/2)\) is satisfied. \(L\) was set at 2 cm because it mostly ranged from 2 cm to 5 cm in this study. There was consistent accuracy in the segmentation, justifying the approach. Segmentation based on this approach was compared to manually extracted leaf segments. Leaf PCDs from four to five regions of the sampled trees were manually divided into several individual leaf segments. Each region consisted of approximately 20-30 leaf segments. Figure 4b shows an  
Figure 4: The algorithm for leaf segmentation. (**a**) The relationship between the distance \(r\) and the leaf gap distance (\(L\)). The \(k\)-value increased from 3 to 4 to decompose more segmented pieces to make \(r_{j}>(L/2)\).