Class RansacDetector<T extends Primitive2d>

java.lang.Object
imagingbook.common.ransac.RansacDetector<T>
Type Parameters:
T - generic type extending Primitive2d
Direct Known Subclasses:
RansacCircleDetector, RansacEllipseDetector, RansacLineDetector

public abstract class RansacDetector<T extends Primitive2d> extends Object

Generic RANSAC detector for 2D primitives. See Sec. 12.1 of [1] for additional details. This abstract class defines the core RANSAC functionality used by all derived (concrete) classes.

[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).

Version:
2022/11/19
See Also:
  • Method Details

    • detectAll

      public List<RansacResult<T>> detectAll(ByteProcessor bp, int maxCount)
      Performs iterative RANSAC steps on the supplied image, which is assumed to be binary (all nonzero pixels are considered input points). Extracts the point set from the image and calls detectAll(Pnt2d[], int).
      Parameters:
      bp - a binary image (nonzero pixels are considered points)
      maxCount - the maximum number of primitives to detect
      Returns:
      the list of detected primitives
    • detectAll

      public List<RansacResult<T>> detectAll(Pnt2d[] points, int maxCount)
      Performs iterative RANSAC steps on the supplied point set until either no more primitive was detected or the maximum number of primitives was reached. Iteratively calls detectNext(Pnt2d[]) on the specified point set.
      Parameters:
      points - the original point set
      maxCount - the maximum number of primitives to detect
      Returns:
      the list of detected primitives
    • detectNext

      public RansacResult<T> detectNext(Pnt2d[] points)
      Performs a single RANSAC step on the supplied point set. If RansacDetector.RansacParameters.removeInliers is set true, all associated inlier points are removed from the point set (by setting array elements to null).
      Parameters:
      points - an array of Pnt2d instances (modified)
      Returns:
      the detected primitive (of generic type T) or null if unsuccessful