Learn R Programming

TreeLS (version 1.0)

sgmt.ransac.circle: Stem segmentation algorithm: RANSAC circle fit

Description

This function is meant to be used inside stemSegmentation. It applies a least squares circle fit algorithm in a RANSAC fashion over stem segments. Mode details are given in the sections below.

Usage

sgmt.ransac.circle(tol = 0.025, n = 10, conf = 0.99, inliers = 0.8)

Arguments

tol

numeric - tolerance offset between absolute radii estimates and hough transform estimates.

n

integer - number of points selected on every RANSAC iteration.

conf

numeric - confidence level.

inliers

numeric - expected proportion of inliers among stem segments' point cloud chunks.

Output Fields

  • TreeID: unique tree IDs - available only for multiple stems

  • Segment: stem segment number (from bottom to top)

  • X, Y: circle center coordinates

  • Radius: estimated circles radii

  • Error: least squares circle fit error

  • AvgHeight: average height of stem segments

  • N: number of points in the stem segments

Least Squares Circle Fit

The circle fit method applied in TreeLS estimates the circle parameters from a pre-selected (denoised) set of points by QR decompostion. The optimization criterion for selecting the best circle parameters among several possible candidates is the least squares method, that selects a set of circle parameters that minimize the sum of squared distances between the model circle and its originating points.

RANSAC Algorithm

The RANdom SAmple Consensus algorithm is a method that relies on resampling a data set as many times as necessary to find a subset comprised of only inliers - e.g. observations belonging to a desired model. The RANSAC algorithm provides a way of estimating the necessary number of iterations necessary to fit a model using inliers only, at least once, as shown in the equation: $$k = log(1 - p) / log(1 - w^n)$$ where:

  • k: number of iterations

  • p: confidence level - desired probability of success

  • w: proportion of inliers expected in the full dataset

  • n: number of observations sampled on every iteration

The models reiterated in TreeLS usually relate to circle or cylinder fitting over a set of 3D coordinates, selecting the best possible model through the RANSAC algorithm

For more information, checkout this wikipedia page.

References

Conto, T. ; Olofsson, K. ; Gorgens, E. B. ; Rodriguez, L. C. E. ; Almeida, G. Performance of stem denoising and stem modelling algorithms on single tree point clouds from terrestrial laser scanning. Computers and Electronics in Agriculture, v. 143, p. 165-176, 2017.

Examples

Run this code
# NOT RUN {
### single tree
file = system.file("extdata", "pine.laz", package="TreeLS")
tls = readTLS(file)
tls = stemPoints(tls)
df = stemSegmentation(tls)

head(df)
tlsPlot(tls, df)

### forest plot
file = system.file("extdata", "pine_plot.laz", package="TreeLS")
tls = readTLS(file)

# normalize the point cloud
tls = tlsNormalize(tls)

# map the trees on a resampled point cloud so all trees have approximately the same point density
thin = tlsSample(tls, voxelize(0.02))
map = treeMap(thin, map.hough(min_density = 0.05))

tls = stemPoints(tls, map)
df = stemSegmentation(tls, sgmt.ransac.circle(n=10))

head(df)
tlsPlot(tls, df, map)
# }

Run the code above in your browser using DataLab