Introduction

Bucking of tree stems bounds the forest resources to meet the quality criteria of end users. It is performed in cut-to-length harvesters based on price and demand matrices, which define the desired log dimensions and their values, while defects are observed by the operator. However, it is difficult for the operator to notice defects related to stem form, such as sweep. There is a great demand for sensors that would measure properties of the processed stems and improve operator support in making qualitative assessments on the fly. Increased information from the properties of raw material could be used to further enhance the whole supply chain from forest to the end users.

The sweep (i.e. crookedness) refers to a steady deviation from a straight line along the stem (Richter 2015). A basal sweep indicates the vertical position of the maximum deviation. This deviation is often referred to as “bow height” (Pfeifer 1982; Gjerdrum and Warensjö 2001; Rune and Warensjö 2002). Basal sweep affects the most valuable part of the stem and decreases value recovery through increased bending, twisting, and lowering the yield of sawn products. When the max. bow height exceeds the limit set in the sawlog grading rules, the value of the stem substantially decreases.

There are no general grading rules in Finland that define the overall limit for the allowed bow height. However, most sawmills follow the rules of Heiskanen and Siimes (1959), with some sawmill specific variants. If the harvester operator estimates that the bow height exceeds the allowed limit, he has two options: to crosscut a pulpwood log with a minimum length or remove a section of the stem below the position of the max. bow height with a short (0.3–0.5 m) offcut.

Norway spruce (Picea abies (L.) Karst.) is an important conifer for the northern European sawmilling industry. For example, spruce sawlog was the most significant timber assortment to the Finnish forest industry in harvested removals, with 53% of all sawlogs (Natural Resources Institute Finland 2019). Furthermore, spruce sawlogs returned the highest average stumpage prices to forest owners in 2018.

Measuring the stem form of Norway spruce during bucking with advanced methods such as laser scanning (Liang et al. 2014) is difficult because of shadowing long crowns and undergrowth (Kankare et al. 2014). The max. bow height on the bottom log should therefore be predicted with indirect information attainable at a low cost during bucking.

Besides the curved shape, the leaning of the tree induces changes to internal wood structure, e.g. a formation of dense reaction wood and asymmetrical growth of annual rings (Gardiner et al. 2014), often referred to as an eccentricity of the pith (Warensjö 2003). Furthermore, the cross section of an asymmetrically grown stem is usually out-of-round or oval (Timell 1986).

The stem shape of mature trees is only weakly related to internal wood structure, because the shape depends on the tree’s ability to recover from leaning. Moreover, young trees, which allocate photosynthates to straighten their stem, are likely to be suppressed (Ishii et al. 2000). These suppressed trees reduce their height growth relatively more than radial growth (Greis and Kellomäki 1981), which leads to large tapering of the stem. According to Puhe (2003), suppressed spruces also have asymmetric crowns and a weakly developed horizontal root system, for which they compensate with a strong buttress root on the side away from the stress of asymmetrical canopies. Thus, tapering within the bottom part of the stem can be used to estimate the max. bow height of the bottom log.

Images taken from the log end faces can be used to measure information that indicates different defects of the stem. According to Warensjö (2003) and Warensjö and Rune (2004), pith eccentricity and out-of-roundness are related to a large bow height. In addition, the stem tapering can provide additional information about the max. bow height which used together with the log end face image could support the operator in bucking of the bottom logs to valid lengths according to the estimated bow height.

The aim of the study was to quantify the relationship between the max. bow height on the bottom log of Norway spruce and information derived from log end face images, and stem taper, and develop models to predict the max. bow height. Statistical modelling was divided into a descriptive and an applicative part. In the descriptive part, the bow height was described with mixed linear models to find explanatory variables that provide the best fit with data. In the applicative part, the possibilities of detecting bottom logs with a max. bow height exceeding the allowed limit of 31 mm were studied with a logistic regression.

Materials and methods

Tree selection and field measurements

The studied trees were gathered from five mature Norway spruce dominated even-aged stands in the Pirkanmaa region in Finland (Fig. 1, Table 1). The topographical differences between and within the stands were small (Fig. 1). The trees were subjectively selected prior to the harvesting to cover the whole range of max. bow height distribution in each stand. In the selected trees, the max. bow height was located below 1.3 m. The curvatures of the stem bottoms were J shaped, but not very sharp. Steeply bent or crooked stem bottoms that did not fulfil the sawlog grade were not included in the sample. Tree height, stem diameter at breast height, and crown base height were measured prior to the harvesting (Table 1).

Table 1 Total number of sample trees per stand, average age of trees, diameter at breast height (dbh), tree height and crown base height (CBH), and average stem volume measured by the harvester

The sample trees were crosscut, measured, and piled by a Komatsu (931x) harvester (Komatsu Ltd., Tokyo, Japan). The harvester followed a standard bucking routine, where the butt end of the first log was crosscut as close to the ground as possible and sawlog defects were removed from the logs by short-cuts. The bottom logs which met the sawlog grade and were not shortened due to any defect on the butt end were included to the study. Diameters along the commercial stem part were measured over the bark with a harvester measurement system (StanForD 2010). Sawlog lengths were defined using 30-cm intervals (3.1 m, 3.4 m, and up to 6.1 m), and upper diameters varied from 16 to 40 cm, depending on log quality and length.

Fig. 1
figure 1

Locations of stands (1–5), the sawmill, and the city of Tampere in Finland (Pirkanmaa). Elevation (a.s.l., m) is stated in parentheses

Photographing of the log end face

The butt ends of the bottom logs were photographed with a digital camera (Nikon D7200, Tokyo, Japan), equipped with Sigma 17–50 mm f/2.8 EX DC OS HSM objective. The images were taken shortly after felling and bucking without a flash in daylight. Log end faces stained by snow, barkdust, or soil were lightly brushed before taking the image. A measurement bar with a sticker indicating log-id was held in the same plane as the log end face when the image was taken. After photographing, the log-id was painted on the log end face to re-identify the logs later at the sawmill.

Fig. 2
figure 2

Max. bow height of a bottom log

Measuring max. bow height on the bottom logs

The max. bow height of the bottom logs was measured by an industrial LIMAB (Göteborg, Sweden) 3D log scanner during the regular log-sorting routine of the local sawmill (Kinnaskoski Oy). The log scanner measures the max. bow height as the largest deviation of a centroid and a straight line between the middle point of the bottom and top ends (Fig. 2). The max. bow height was used instead of the more conventional steady sweep (mm/m), because the bottom logs were cut into varying lengths. Thus, the longer logs would have had smaller sweep per metre than shorter logs given that the max. bow height appears at the butt end of the log.

Since the industrial log scanner does not measure the first 30 cm from the butt end of the log, it is not included in the bow height measurements. Thus, the max. bow heights (Fig. 3) were underestimated on the logs with a buttress within 30 cm of the bottom.

Analysis of log end face and stem taper

Log end face image analysis

The log end faces without bark were manually segmented from the image background with an open-source software “GIMP” (https://www.gimp.org). The locations of the piths were then manually identified with an image processing program “ImageJ” (Schneider et al. 2012). The measurement bar was used to convert pixels into centimetres.

Fig. 3
figure 3

Distribution of max. bow height on the bottom logs

An image analysis was performed with scripts written in the Python computing language (Python v. 2.7). The original RGB images without a background (Fig. 4a) were first converted into binary form. The binary images were used to calculate the geometric centre, or centroid, of the log end face with the scikit-image library (v. 0.14.1) (van der Walt et al. 2014). The centroid represents the average position of all pixels included in the log end face.

To calculate the minimum, maximum, and average diameters from the butt end of the log, a polar transformation was performed, in which the log end face image was displayed in polar coordinates (\(\phi\)r). Polar transformation was performed according to the position of the centroid in the binary image.

In the polar transformed image (Fig. 4b), the distance from the top of the image to the edge between the wood and the background is a radius of the butt end of the log. Accordingly, the diameter is calculated by adding the two opposing radii, as shown in Fig. 4a, b with the dashed lines. The lengths of the radii were derived by finding positions on the y-axis where the pixel values of each radius became zero, i.e. the background (marked with a red line in Fig. 4b, c).

The large end diameters, with the locations of centroid and pith, were used to calculate pith eccentricity and out-of-roundness. Pith eccentricity (\(P_{\mathrm{e}}\)) was calculated as follows:

$$\begin{aligned} P_{\mathrm{e}} = \bigg (\frac{e}{D_{\mathrm{avg}}}\bigg ) \cdot 100, \end{aligned}$$
(1)

where e is the distance between the pith and the centroid and \(D_{\mathrm{avg}}\) is the average large end diameter.

Out-of-roundness (OOR) illustrates a deviation from a circle as percentage of the average large end diameter. OOR was calculated based on the minimum, maximum, and average diameters of the log end face:

$$\begin{aligned} \hbox {OOR} = \bigg (\frac{D_{\mathrm{max}} - D_{\mathrm{min}}}{D_{\mathrm{avg}}}\bigg ) \cdot 100, \end{aligned}$$
(2)

where \(D_{\mathrm{max}}\), \(D_{\mathrm{min}}\), and \(D_{\mathrm{avg}}\) are the maximum, minimum, and average large end diameters, respectively.

Stem taper analysis

Tapering in different sections of the stem was characterised by calculating a decrease in the diameters between relative heights (10–20%, 20–30%, etc.) of the commercial stem part. The relative tapering between relative heights, in addition to relative tapering between stem diameter at breast height (dbh) and 10% relative height, was calculated by

$$\begin{aligned} \hbox {Taper}_{{\mathrm{rh}}_1 - {\mathrm{rh}}_2} = \bigg (1 - \frac{D_{{\mathrm{rh}}_2}}{D_{{\mathrm{rh}}_1}}\bigg ) \cdot 100, \end{aligned}$$
(3)

where \(D_{{\mathrm{rh}}_1}\) and \(D_{{\mathrm{rh}}_2}\) were the diameters at relative heights \(\hbox {rh}_1\) and \(\hbox {rh}_2\), respectively.

The stem dbh was measured by the harvester, because it grasps the stem from a height of 1.3 m. The maximum tapering of the stem below this height (\(\hbox {Taper}_{\mathrm{dbh}}\)) was calculated to quantify the butt swell as follows

$$\begin{aligned} \hbox {Taper}_{\mathrm{dbh}} = \bigg (1 - \frac{{\mathrm{dbh}}}{D_{\mathrm{max}}}\bigg ) \cdot 100, \end{aligned}$$
(4)

where \(D_{\mathrm{max}}\) was the maximum diameter of the large end.

Predicting the max. bow height on the bottom log

A linear regression to describe the max. bow height

Linear models to predict the max. bow height were built to test an in-sample fit with two sets of explanatory variables. The final models were selected based on the Akaike information criterion and residuals. The sets of variables were assumed to be good predictors of response variable, and they were not chosen based on their statistical significance. Stand was treated as a random variable in the models, and logarithmic transformations of the explanatory variables, excluding the dbh, were applied because of deviations from the normal distribution.

Fig. 4
figure 4

Log end face image analysis: a irregular log end face with the markers indicating the pith, the centroid, and radii \(r_1\) and \(r_2\). b Polar transformed log end face image, where the dashed lines indicate the radii on the log end face. c Greyscale values along the blue radius (\(r_2\)) in a, b. The y-axis in c is the distance from pith in pixels. The length of radius (\(r_2\)) is indicated by the red line in b, c. (Color figure online)

The first model, \(lm_1\) (Eq. 5), included the log end face features and was defined as

$$\begin{aligned} \begin{aligned} \hbox {bh}_{ij} = {}&\alpha _{0} + \alpha _{1}\ln ({P_{\mathrm{e}}}_{ij}) + \alpha _{2}\ln ({\hbox {OOR}}_{ij}) \\&+ \alpha _{3}\ln ({D_{\mathrm{avg}}}_{ij}) + u_j + \epsilon _{ij}, \end{aligned} \end{aligned}$$
(5)

where \({\hbox {bh}}_{ij}\) was the bow height of the bottom log i on stand j, \({P_{\mathrm{e}}}_{ij}\), \({\mathrm{OOR}}_{ij}\) and \({D_{\mathrm{avg}}}_{ij}\) were pith eccentricity, out-of-roundness, and average large end diameter of bottom log. \(\alpha _{0}\), \(\alpha _{1}\), \(\alpha _{2}\), \(\alpha _{3}\) were estimated parameters, ln was a natural logarithm, \(u_j\) was a random stand-level variation, and \(\epsilon _{ij}\) was between-tree error.

In addition to the log end face features included in \(lm_1\), model \(lm_2\) also utilised dbh and variables describing stem taper (“Stem taper analysis” section). To avoid highly correlated taper variables, a set of variables having low mutual correlation was used in model \(lm_2\). The chosen variables describe the stem taper from the bottom to middle stem without over-fitting the model to the data. \(lm_2\) was defined as

$$\begin{aligned} \begin{aligned} \hbox {bh}_{ij} ={}&\beta _{0} + \beta _{1}\ln ({Pe}_{ij}) + \beta _{2}\ln ({OOR}_{ij}) + \beta _{3}\ln ({D_{\mathrm{avg}}}_{ij}) \\&+ \beta _{4}\ln ({\hbox {Taper}_{\mathrm{dbh}}}_{ij}) + \beta _{5}\ln ({\hbox {Taper}_{{\mathrm{dbh}}-10\%}}_{ij}) \\&+ \beta _{6}\ln ({\hbox {Taper}_{20-30\%}}_{ij}) + \beta _{7}\ln ({\hbox {Taper}_{50-60\%}}_{ij}) \\&+ \beta _{8}{{\mathrm{dbh}}}_{ij} + u_j + \epsilon _{ij}, \end{aligned} \end{aligned}$$
(6)

where \({\hbox {Taper}_{{\mathrm{dbh}}}}_{ij}\), \({\hbox {Taper}_{{\mathrm{dbh}}-10\%}}_{ij}\), \({\hbox {Taper}_{20-30\%}}_{ij}\), \({\hbox {Taper}_{50-60\%}}_{ij}\) were the taper variables of stem i on stand j between the corresponding relative heights, stated in subscript. \(\beta _{0}\), \(\beta _{1}\), \(\beta _{2}\), \(\beta _{3}\), \(\beta _{4}\), \(\beta _{5}\), \(\beta _{6}\), \(\beta _{7}\), and \(\beta _{8}\) are estimated parameters and the other variables as described above.

The fit of the linear models was compared with a pseudo-\(R^{2}\) statistic (Nakagawa and Schielzeth 2013), in which marginal \(R^{2}\) included the variance explained by the fixed factors, while conditional \(R^{2}\) was concerned with the variance explained by both fixed and random factors. The models were fitted with lme4 (Bates et al. 2015) in the R software.

Predicting a probability of excessive max. bow height (> 31 mm)

The occurrence of excessive max. bow height was modelled using a logistic regression. The limit for the max. bow height was set to 31 mm, based on the sawlog grading rules (Heiskanen and Siimes 1959) widely used in the Finnish sawmilling industry. The grading rules define 10 mm per metre as the upper limit for steady sweep. While 3.1 m is commonly used as the minimum length for sawlogs, a max. bow height above 31 mm indicates that the automatic bucking of a harvester should intervene and remove the defect. In our study, the ratio between the straight bottom logs with a max. bow height under 31 mm and bottom logs (referred to as “sweep” ) with a max. bow height above 31 mm was 65/36.

Logistic regression models (\(\hbox {lr}_1\) and \(\hbox {lr}_2\)) with two sets of explanatory variables were designed similar to the linear models in “A linear regression to describe the max. bow height” section. Unlike in Eqs. 5 and 6, the stand was not applied as a random variable in the logistic regression models, because it was not statistically significant. Moreover, \(\hbox {Taper}_{50-60}\) was excluded from the explanatory variables, because it was unknown when the bucking of a stem began. Logistic regression models were defined as

$$\begin{aligned} ln\bigg (\frac{p_{\mathrm{bh}}}{1-p_{\mathrm{bh}}}\bigg ) = \gamma _{0} +\gamma _{1}\ln ({{Pe}_i}) + \gamma _{2}\ln ({\hbox {OOR}_i}) \nonumber \\ +\gamma _{3}\ln ({D_{avg_i}}) + \epsilon _i, \end{aligned}$$
(7)
$$\begin{aligned} \ln \bigg (\frac{p_{\mathrm{bh}}}{1-p_{\mathrm{bh}}}\bigg ) = \delta _{0} + \delta _{1}\ln ({Pe_i}) + \delta _{2}\ln ({\hbox {OOR}_i})\nonumber \\ +\delta _{3}\ln ({D_{\mathrm{avg}}}) + \delta _{4}\ln ({\hbox {Taper}_{{\mathrm{dbh}}}}_i)\nonumber \\ +\delta _{5}\ln ({\hbox {Taper}_{{\mathrm{dbh}}-10\%}}_i)\nonumber \\ +\delta _{6}\ln ({\hbox {Taper}_{20-30\%}}_i)\nonumber \\ + \delta _{7}{{\mathrm{dbh}}}_i +\epsilon _i, \end{aligned}$$
(8)

where \(p_{\mathrm{bh}}\) was the logarithm of the odds, \(\gamma _{0 - 3}\) and \(\delta _{0 - 7}\) were estimated parameters, and the other symbols as defined above.

Accuracy assessment of the logistic regression models

The fit of the logistic regression models and their ability to detect bottom logs with a high max. bow height were evaluated according to accuracy, which was defined as

$$\begin{aligned} \hbox {Accuracy} = \frac{{{\mathrm{TP}} + {\mathrm{TN}}}}{{{\mathrm{TP}}+{\mathrm{FP}}+{\mathrm{TN}}+{\mathrm{FN}}}} \cdot 100, \end{aligned}$$
(9)

where TP and TN were true positives and negatives (logs correctly classified as sweep and straight), and accordingly, FP and FN were false positives and negatives (logs misclassified as sweep and straight).

Due to the imbalanced ratio between the sweep (\(\hbox {bh} >{ 31 \hbox { mm}}\)) and straight bottom logs, the Cohen’s kappa (\(\kappa\)) coefficient (Cohen 1960) was calculated. Cohen’s kappa compares classifications based on the estimated and measured values, i.e. it displays how well the model performs against chance. A kappa of 0 indicates that the detection of bottom logs with an excessive max. bow height happens purely by chance. Accordingly, when the kappa value is 1, the model and ground-truth classification are in complete agreement. Cohen’s kappa was calculated by

$$\begin{aligned} \kappa= & {} \frac{p_{\mathrm{o}} - p_{\mathrm{e}}}{1 - p_{\mathrm{e}} },\nonumber \\ p_{\mathrm{o}}= & {} \hbox {TP} + \hbox {FP} \nonumber \\ p_{\mathrm{e}}= & {} \frac{(({\mathrm{TP}}+{\mathrm{FP}}) \cdot ({\mathrm{TP}}+{\mathrm{FN}})) + (({\mathrm{FN}}+{\mathrm{TN}}) \cdot ({\mathrm{TN}}+{\mathrm{FP}}))}{{\mathrm{TP}}+{\mathrm{FP}}+{\mathrm{TN}}+{\mathrm{FN}}} \end{aligned}$$
(10)

where \(p_{\mathrm{o}}\) and \(p_{\mathrm{e}}\) were the observed and expected levels of agreement, and other symbols as defined above.

Logistic regression models’ ability to classify logs into true positives and negatives was visually examined using receiver operating characteristic (ROC) and precision–recall (PR) curves (Fawcett 2006). Areas under the ROC and PR curves were also calculated. The statistical measures used in the ROC and PR were

$$\begin{aligned} \hbox {Sensitivity}= & {} \frac{{\mathrm{TP}}}{{{\mathrm{TP}} + {\mathrm{FN}}} }, \end{aligned}$$
(11)
$$\begin{aligned} \hbox {Specificity}= & {} \frac{{\mathrm{TN}}}{{{\mathrm{TN}}+ {\mathrm{FP}}} }, \end{aligned}$$
(12)
$$\begin{aligned} \hbox {Precision}= & {} \frac{{\mathrm{TP}}}{{{\mathrm{TP} }+ {\mathrm{FP}}} }, \end{aligned}$$
(13)

where the symbols were defined as above.

Results

Properties of the sample trees and bottom logs

The max. bow height of the bottom logs varied from 5.6 to 65.4 mm, with an average of 27.1 mm (Table 2). The max. bow height correlated positively with pith eccentricity (\(r = 0.43, p< 0.05\)) and out-of-roundness (\(r = 0.20, p < 0.05\)). Significant positive correlations were also found between max. bow height, large end diameter, and dbh (Table 3).

Table 2 Mean, standard deviation and range of log properties, log end face variables, and stem taper variables

The average pith eccentricity and out-of-roundness were 7.2% and 17.0% (Table 2), and they positively correlated with each other (\(r = 0.24, p < 0.05\)). In addition, both variables showed significant positive correlation with the large end diameter (Table 3). A low correlation was found between pith eccentricity and dbh (\(r = 0.17, p < 0.1\)), but no correlation was found between dbh and out-of-roundness.

Table 3 Pearson correlations between explanatory variables and max. bow height
Fig. 5
figure 5

Stem taper was characterised by diameters measured from the butt end, 1.3 m and relative heights in 10% intervals. Among the taper variables, a \(\hbox {Taper}_{\mathrm{dbh}}\), b \(\hbox {Taper}_{\mathrm{dbh}-10}\), and c \(\hbox {Taper}_{20-30}\) showed the largest difference in tapering between the straight and sweep bottom logs. The logs were classified as sweep when the max. bow height was more than 31 mm. \(D_{\mathrm{max}}\) and \({\mathrm{dbh}}\) are the large end diameter and diameter at breast height

Stem taper was analysed with variables that described the relative decrease in diameters between the chosen relative heights (“Stem taper analysis” section). As expected, tapering of the stem was greatest below the first 1.3 m, because of the maximum diameter used in Eq. 4. Diameters decreased between max. large end diameter and \({\mathrm{dbh}}\) by 22% on average. Tapering between \({\mathrm{dbh}}\) and 10% stem height was lower, with an average decrease of 3.6%. From there on, stem tapering slowly increased (Table 2) to stem heights of 50% and 60%, where tapering was an average of 9.7%.

\(\hbox {Taper}_{{\mathrm{dbh}}-10}\) and \(\hbox {Taper}_{20-30}\) positively correlated with max. bow height, but the correlation between \(\hbox {Taper}_{{\mathrm{dbh}}}\) and max. bow height was not statistically significant (Table 3). Moreover, the logs classified as sweep had only a slightly larger average \(\hbox {Taper}_{{\mathrm{dbh}}}\), \(\hbox {Taper}_{{\mathrm{dbh}}-10}\), and \(\hbox {Taper}_{20-30}\) than the straight logs (Fig. 5).

Predicting the max. bow height with mixed linear models

The pith eccentricity (\(\ln (P_{\mathrm{e}})\)) was statistically significant in both models \(lm_1\) and \(lm_2\) to predict the max. bow height of bottom logs (Table 4). When natural logarithm of pith eccentricity increased by a unit, the max. bow height increased by 7.66 mm and 6.86 mm according to \(lm_1\) and \(lm_2\), respectively. The out-of-roundness was not a statistically significant predictor of max. bow height in either model (Table 4). The average large end diameter (\(\ln (D_{\mathrm{avg}})\)) was not significantly related to max. bow height in \(lm_1\).

Table 4 Parameter estimates of the fixed effects in mixed linear models \(lm_1\) and \(lm_2\) (Eqs. 5 and 6) with p values (Wald) and standard errors of the estimates

Increasing tapering of the stem bottom (\(\hbox {Taper}_{{\mathrm{dbh}}}\), \(\hbox {Taper}_{{\mathrm{dbh}}-10}\), \(\hbox {Taper}_{20-30}\)), as well as increasing \({\mathrm{dbh}}\), increased the max. bow height estimate for the bottom log (Table 4). In contrast, large stem tapering at the mid-stem (\(\hbox {Taper}_{50-60}\)) indicated smaller max. bow height.

Fig. 6
figure 6

Measured and predicted max. bow heights in a \(lm_1\) (Eq. 5) and b \(lm_2\) (Eq. 6)

The model fit was compared with marginal (fixed effects) and conditional (fixed and random effects) \(R^2\)s. The marginal and conditional \(R^2\)s were 0.24 and 0.25 in \(lm_1\), while adding the stem taper variables increased the marginal and conditional \(R^2\) of \(lm_2\) to 0.40 and 0.42, respectively.

The max. bow height estimates of \(lm_2\) were less biased than estimates of \(lm_1\), especially when predicting max. bow heights of more than 40 mm (Fig. 6). \(lm_1\) underestimated max. bow heights above 40 mm, and correspondingly overestimated max. bow heights below 20 mm (Fig. 6a). In \(lm_2\), the differences of the measured and predicted bow heights were lower for max. bow heights above 40 mm than those in \(lm_1\) (Fig. 6b).

Predicting the probability of excessive max. bow height of bottom log

Pith eccentricity was the best predictor of the max. bow height above the 31 mm limit in logistic regression models \(\hbox {lr}_1\) and \(\hbox {lr}_2\) (Table 5). Pith eccentricity was the only statistically significant variable in \(\hbox {lr}_1\). Increasing the natural logarithm of pith eccentricity by 1% increased the odds of the bottom log having an excessive max. bow height by 3.16 and 3.00 in \(\hbox {lr}_1\) and \(\hbox {lr}_2\). Out-of-roundness was not a statistically significant predictor of excessive max. bow height in either model (Table 5).

Table 5 Parameter estimates of logistic regression models (Eqs. 7 and 8), predicting the probability of a max. bow height above 31 mm, with p values (Wald) and standard errors of the estimates

The average large end diameter (\(D_{\mathrm{avg}}\)) was statistically not significant in \(\hbox {lr}_1\), but it was significant in \(\hbox {lr}_2\). According to \(\hbox {lr}_2\), a 1 cm increase in the natural logarithm of \(D_{\mathrm{avg}}\) decreased the odds by 6.16 \(\times 10^{-7}\). Yet an increase of 1 cm in \({\mathrm{dbh}}\) increased the odds by 1.68 in \(\hbox {lr}_2\). The coefficients of variables describing the stem taper in \(\hbox {lr}_2\) were positive, but not statistically significant (Table 5)

The logistic regression model (\(\hbox {lr}_1\)), without the stem taper information and \(\mathrm{dbh}\), showed an accuracy of 67% in the detection of bottom logs with an excessive max. bow height. The kappa value of \(\hbox {lr}_1\) was 0.21. Accordingly, \(\hbox {lr}_2\) was able to detect an excessive max. bow height with 76% accuracy and 0.44 kappa, which indicates a moderate agreement between the predicted and observed classes (Cohen 1960).

The area under the ROC curve of \(\hbox {lr}_1\) was 0.69; for \(\hbox {lr}_2\), it was 0.76 (Fig. 7a). The shape of the ROC curve in \(\hbox {lr}_2\) was slightly more upward than in \(\hbox {lr}_1\) when the probability threshold value was low. If a model with a minimal number of false positives (i.e. straight logs predicted to have a max. bow height above 31 mm) is desired, \(\hbox {lr}_2\) with stem taper information is more accurate than \(\hbox {lr}_1\). The area under the precision–recall curve (Fig. 7b) was 0.57 in \(\hbox {lr}_1\) and 0.65 in \(\hbox {lr}_2\).

Fig. 7
figure 7

a Receiver operating characteristic (ROC) curves for models \(\hbox {lr}_1\) and \(\hbox {lr}_2\). The sensitivity (Eq. 11) of the y-axis stands for the true positive rate (recall), while 1-specificity (Eq. 12) of the x-axis is the false positive rate. b Precision–recall curves of models \(\hbox {lr}_1\) and \(\hbox {lr}_2\), where precision (Eq. 13) on the y-axis describes models’ ability to distinguish true positives from false positives

Discussion

The possibility of estimating the max. bow height of the bottom log of Norway spruce with a log end face image and stem taper was studied with two modelling approaches, in which the max. bow height was first predicted by fitting a linear regression with two sets of explanatory variables. The max. bow height model utilising the pith eccentricity, out-of-roundness, and large end diameter of the log resulted in highly biased max. bow height estimates. When supplemented with additional information on stem taper and dbh, the model was able to predict the max. bow height with higher accuracy. The results show that a larger pith eccentricity on the log end face indicates a higher max. bow height of the bottom log. A higher out-of-roundness also indicated higher max. bow height, but because of the high correlation between out-of-roundness and pith eccentricity, it was not significant in the linear models. Moreover, the out-of-roundness variable based on the maximum and minimum diameter may not fully describe the shape of the log end face. Yet, more complex variables, such as isoperimetric ratio, should be tested in further studies.

Similar results were found when the detection of bottom logs that did not meet the sawlog quality requirement due to an excessive max. bow height was examined with logistic regression models. Accuracy, kappa value, and the ROC and PR curves revealed that when the log end face features were used alone, an excessive max. bow height could not be reliably predicted. The taper information from the bottom part of the stem appears to be necessary in detecting an excessive max. bow height. Despite the statistical significance of pith eccentricity, it did not substantially increase the probability of an excessive max. bow height, especially in small diameter logs (Fig. 8).

Fig. 8
figure 8

Predicted probability of excessive max. bow height according to pith eccentricity, large end diameter, and an average out-of-roundness (17%)

In our study, the pith locations were manually identified on the images. However, previous studies have demonstrated that piths can be automatically detected with a reasonable accuracy from RGB images (Saint-Andre and Leban 2001; Norell and Borgefors 2008; Österberg 2009; Kurdthongmee and Suwannarat 2019). The algorithms developed by Schraml and Uhl (2013) detected pith locations from the images of rough log end face with an average accuracy of 0.5 cm. However, the images used in the study of Schraml and Uhl (2013) were taken from slightly dried log ends at the sawmill yard, when annual rings are more distinguishable than immediately after the crosscut. Moreover, the counting of annual rings from dried log ends in sawmill conditions has been demonstrated (e.g. Norell 2011), whereas the analysis of fresh log end face images has received less attention.

A relationship between pith eccentricity and max. bow height has been found in previous studies. In Scots pine (Pinus sylvestris L.), Warensjö and Rune (2004) discovered in seedlings (6-year) and young trees (22-year) that the process whereby the tree corrected leaning by an uneven growth of annual rings and reaction wood could take decades, and the length of recovery period depended mainly on the size of the stem when the tree began to lean.

The positive correlations between pith eccentricity, out-of-roundness, and max. bow height found in this study were similar to the results of Rune and Warensjö (2002) and Warensjö and Rune (2004). However, the results of this study and those of Rune and Warensjö (2002) and Warensjö and Rune (2004) were poorly comparable due to the age difference and irregular stem shape of this study’s spruces, which was caused by the buttress. Excluding the bottom logs with very large buttresses increased the correlation between pith eccentricity and max. bow height (results not shown).

Although some inconsistency in the correlations with max. bow height and tapering variables was found, the stems with large tapering had a larger max. bow height of the bottom log. This could, at least partly, be explained by canopy competition, in which the leaning young trees are likely to settle in dominated crown classes. In the lower canopy, Norway spruce adapts to increased shading by changing the crown structure, including decreased height growth (Greis and Kellomäki 1981). Increasing the initial spacing has also increased the max. bow height of the bottom logs of Norway spruce (Høibø 1991). However, in Johansson’s study (1992), only a marginal relationship between initial spacing and the presence of basal sweep was found. Accordingly, Mäkinen (1998) found that stand density and thinning had no clear effect on the bole eccentricity of Scots pine. Presumably, decreasing the proportion of stems in clear-cuts with excessive bow height is accomplished mainly by removing them during thinnings.

Warensjö and Rune (2004) discovered that increasing compression wood content on the log end face of 60-year-old Norway spruce indicated increasing bow height. However, only the most pronounced reaction wood can be distinguished from freshly cut wood (Timell 1986). Thus, the detection of reaction wood from a standard RGB image is challenging without staining methods, which involve dyeing the wood surface with acid or alcohol (Gardiner et al. 2014). Devices that operate beyond visible wavelengths, such as hyperspectral sensors (Hagman 1996) and portable spectrometers (Sandak et al. 2020), hold great potential to decrease the bias of max. bow height predictions through the better detection of the reaction wood from the fresh log end face.

The image taken from the log end face reveals defects that are otherwise difficult for the harvester operator to notice based only on external indicators. However, properties of a single tree could not only be estimated during the harvesting but also before it with ALS derived crown characteristics (Fischer et al. 2018). Suitability of a log for structural timber could be further estimated by measuring the force needed for crosscutting the stem (Sandak et al. 2017) which essentially reflects the density of a wood. In appearance grading, log end face image could be utilised to estimate other sawlog features, such as knottiness (Uusitalo and Isotalo 2005; Mäkinen et al. 2019), that have traditionally been predicted based on external features, such as dead branch height (Uusitalo and Kivinen 1998). Overall, a combination of various sensors could provide valuable information throughout the supply chain for sawmills, and the plywood or veneer industries.

Due to the limitations and industrial nature of the 3D log scanner used in the study, the longitudinal position of the max. bow height was not measured. Furthermore, the operator followed the regular bucking instructions concerning the defects and only the bottom logs fulfilling the sawlog grade were included in the study. The operator followed regular bucking instructions and principles dealing with the defects and only the bottom logs fulfilling the sawlog grade were included to the study. However, large bow heights are rather exceptional in Finnish clear-cut stands. In addition, the logs were gathered from a small geographical area, and it was impossible to evaluate a generalisation of the models. The estimates represent the model fit to the data and are not applicable as such.

Conclusions

Log end face image features combined with stem taper information can be used to detect a large bow height on Norway spruce bottom logs. Advanced sensors that measure wood and detect failures would guide the harvester operator towards more optimised bucking decisions where log length is determined according to the estimated amount of bow height. Nevertheless, the aim of operator assisting systems is to increase the efficiency of the whole supply chain. In Norway spruce, quantifying the butt swell and the stem diameter at breast height is highly recommended when estimating the max. bow height. Further studies are needed to define the most effective bucking principles, based on the bow height of the bottom log. Yet more complex and nonlinear methods, such as deep learning with log end face images, could provide more accurate estimates for max. bow height.