shape_detection: Algorithms for shape detection of the local point...

shape_detectionR Documentation

Algorithms for shape detection of the local point neighbourhood

Description

These functions are made to be used in segment_shapes. They implement algorithms for local neighbourhood shape estimation.

Usage

shp_plane(th1 = 25, th2 = 6, k = 8)

shp_hplane(th1 = 25, th2 = 6, th3 = 0.98, k = 8)

shp_line(th1 = 10, k = 8)

shp_hline(th1 = 10, th2 = 0.02, k = 8)

shp_vline(th1 = 10, th2 = 0.98, k = 8)

Arguments

th1, th2, th3

numeric. Threshold values (see details)

k

integer. Number of neighbours used to estimate the neighborhood.

Details

In the following, a_1, a_2, a_3 denote the eigenvalues of the covariance matrix of the neighbouring points in ascending order. |Z_1|, |Z_2|, |Z_3| denote the norm of the Z component of first, second and third axis of the decomposition. th_1, th_2, th_3 denote a set of threshold values. Points are labelled TRUE if they meet the following criteria. FALSE otherwise.

shp_plane

Detection of plans based on criteria defined by Limberger & Oliveira (2015) (see references). A point is labelled TRUE if the neighborhood is approximately planar, that is:

a_2 > (th_1 \times a_1) \& (th_2 \times a_2) > a_3

shp_hplane

The same as 'plane' but with an extra test on the orientation of the Z vector of the principal components to test the horizontality of the surface.

a_2 > (th_1 \times a_1) \& (th_2 \times a_2) > a_3 \& |Z_3| > th_3

In theory |Z_3| should be exactly equal to 1. In practice 0.98 or 0.99 should be fine

shp_line

Detection of lines inspired by the Limberger & Oliveira (2015) criterion. A point is labelled TRUE if the neighbourhood is approximately linear, that is:

th_1 \times a_2 < a_3 \& th_1 \times a_1 < a_3

shp_hline

Detection of horizontal lines inspired by the Limberger & Oliveira (2015) criterion. A point is labelled TRUE if the neighbourhood is approximately linear and horizontal, that is:

th_1 \times a_2 < a_3 \& th_1 \times a_1 < a_3 \& |Z_1| < th_2

In theory |Z_1| should be exactly equal to 0. In practice 0.02 or 0.01 should be fine

shp_vline

Detection of vertical lines inspired by the Limberger & Oliveira (2015) criterion. A point is labelled TRUE if the neighbourhood is approximately linear and vertical, that is:

th_1 \times a_2 < a_3 \& th_1 \times a_1 < a_3 \& |Z_1| > th_2

In theory |Z_1| should be exactly equal to 1. In practice 0.98 or 0.99 should be fine

References

Limberger, F. A., & Oliveira, M. M. (2015). Real-time detection of planar regions in unorganized point clouds. Pattern Recognition, 48(6), 2043–2053. https://doi.org/10.1016/j.patcog.2014.12.020

Examples

# Generating some data
n = 400
xplane = runif(n,0,6)
yplane = runif(n,0,6)
zplane = xplane + 0.8 * yplane + runif(n, 0, 0.1)
plane = data.frame(X = xplane, Y = yplane, Z = zplane)

xhplane = runif(n,5,15)
yhplane = runif(n,0,10)
zhplane = 5 + runif(n, 0, 0.)
hplane = data.frame(X = xhplane, Y = yhplane, Z = zhplane)

tline = 1:n
xline = 0.05*tline
yline = 0.01*tline
zline = 0.02*tline + runif(n, 0, 0.1)
line = data.frame(X = xline, Y = yline, Z = zline)

thline = 1:n
xhline = 0.05*thline + runif(n, 0, 0.05)
yhline = 10 - 0.01*thline + runif(n, 0, 0.05)
zhline = 3 + runif(n, 0, 0.05)
hline = data.frame(X = xhline, Y = yhline, Z = zhline)

tvline = 1:n
xvline = 5 + runif(n, 0, 0.05)
yvline = 5 + runif(n, 0, 0.05)
zvline = 0.02*tline
vline = data.frame(X = xvline, Y = yvline, Z = zvline)

las <- rbind(plane, line, hplane, hline, vline)
las <- LAS(las)

las <- segment_shapes(las, shp_plane(k = 20), "plane")
las <- segment_shapes(las, shp_hplane(k = 20), "hplane")
las <- segment_shapes(las, shp_line(k = 20), "line")
las <- segment_shapes(las, shp_hline(k = 20), "hline")
las <- segment_shapes(las, shp_vline(k = 20), "vline")

#plot(las)
#plot(las, color = "plane")
#plot(las, color = "hplane")
#plot(las, color = "line")
#plot(las, color = "hline")
#plot(las, color = "vline")

lidR documentation built on Sept. 11, 2024, 5:21 p.m.