Skip to content

Cuboid

Cuboid

class Cuboid():
 |  Cuboid()

Implementation for box (Cuboid) RANSAC.

A cuboid is defined as convex polyhedron bounded by six faces formed by three orthogonal normal vectors. Cats love to play with this kind of geometry. This method uses 6 points to find 3 best plane equations orthogonal to eachother.

We could use a recursive planar RANSAC, but it would use 9 points instead. Orthogonality makes this algorithm more efficient.

Cuboid


fit

 | fit(pts, thresh=0.05, maxIteration=5000)

Find the best equation for 3 planes which define a complete cuboid.

Arguments:

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

Returns:

  • best_eq: Array of 3 best planes's equation np.array (3, 4)
  • best_inliers: Inlier's index from the original point cloud. np.array (1, M)