Module imagingbook.common
Package imagingbook.common.ransac
Class RansacDetector<T extends Primitive2d>
java.lang.Object
imagingbook.common.ransac.RansacDetector<T>
- Type Parameters:
T
- generic type extendingPrimitive2d
- Direct Known Subclasses:
RansacCircleDetector
,RansacEllipseDetector
,RansacLineDetector
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Parameters used by all RANSAC types. -
Method Summary
Modifier and TypeMethodDescriptiondetectAll
(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).Performs iterative RANSAC steps on the supplied point set until either no more primitive was detected or the maximum number of primitives was reached.detectNext
(Pnt2d[] points) Performs a single RANSAC step on the supplied point set.
-
Method Details
-
detectAll
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 callsdetectAll(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
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 callsdetectNext(Pnt2d[])
on the specified point set.- Parameters:
points
- the original point setmaxCount
- the maximum number of primitives to detect- Returns:
- the list of detected primitives
-
detectNext
Performs a single RANSAC step on the supplied point set. IfRansacDetector.RansacParameters.removeInliers
is set true, all associated inlier points are removed from the point set (by setting array elements tonull
).- Parameters:
points
- an array ofPnt2d
instances (modified)- Returns:
- the detected primitive (of generic type T) or
null
if unsuccessful
-