Skip to content

Line

Line

class Line():
 |  Line()

Implementation for 3D Line RANSAC.

This object finds the equation of a line in 3D space using RANSAC method. This method uses 2 points from 3D space and computes a line. The selected candidate will be the line with more inliers inside the radius theshold.

3D line


fit

 | fit(pts, thresh=0.2, maxIteration=1000)

Find the best equation for the 3D line. The line in a 3d enviroment is defined as y = Ax+B, but A and B are vectors intead of scalars.

Arguments:

  • pts: 3D point cloud as a np.array (N,3).
  • thresh: Threshold distance from the line which is considered inlier.
  • maxIteration: Number of maximum iteration which RANSAC will loop over.

Returns:

  • A: 3D slope of the line (angle) np.array (1, 3)
  • B: Axis interception as np.array (1, 3)
  • inliers: Inlier's index from the original point cloud. np.array (1, M)