Class BinaryEllipseDetectorPixel

java.lang.Object
boofcv.alg.shapes.ellipse.BinaryEllipseDetectorPixel
All Implemented Interfaces:
VerbosePrint

public class BinaryEllipseDetectorPixel extends Object implements VerbosePrint

Detects ellipses inside a binary image by finding their contour and fitting an ellipse to the contour. Fitting is done using pixel precise contour points. See SnapToEllipseEdge for a way to use sub-pixel points and improve the fit's accuracy. Optionally, lens distortion can be removed from the contour points prior to processing.

After the contour has been found an ellipse is fit to them using the algebraic formulation. Points which are not approximately ellipsoidal are removed. Approximately ellipsoidal is defined by the distance of the farthest contour point away from the ellipse. For computational efficiency reasons a maximum of 20 points are sampled. If there are more than 20 points in the contour then they are evenly sampled across the contour. Only external contours are considered. Parameters:
maxDistanceFromEllipse
maximum distance from the ellipse in pixels
minimumContour
minimum number of pixels in the contour
maximumContour
maximum number of pixels in the contour
internalContour
If true it will process internal contours
  • Field Details

  • Constructor Details

    • BinaryEllipseDetectorPixel

      public BinaryEllipseDetectorPixel(ConnectRule connectRule)
    • BinaryEllipseDetectorPixel

      public BinaryEllipseDetectorPixel()
  • Method Details

    • setLensDistortion

      public void setLensDistortion(@Nullable @Nullable PixelTransform<Point2D_F32> distToUndist)

      Specifies transforms which can be used to change coordinates from distorted to undistorted. The undistorted image is never explicitly created.

      WARNING: The undistorted image must have the same bounds as the distorted input image. This is because several of the bounds checks use the image shape. This are simplified greatly by this assumption.

      Parameters:
      distToUndist - Transform from distorted to undistorted image.
    • process

      public void process(GrayU8 binary)
      Finds all valid ellipses in the binary image
      Parameters:
      binary - binary image
    • adjustElipseForBinaryBias

      protected void adjustElipseForBinaryBias(EllipseRotated_F64 ellipse)
      In a binary image the contour on the right and bottom is off by one pixel. This is because the block region extends the entire pixel not just the lower extent which is where it is indexed from.
    • getContours

      public List<ContourPacked> getContours()
    • loadContour

      public void loadContour(int id, DogArray<Point2D_I32> storage)
    • getContourFinder

      public BinaryContourInterface getContourFinder()
    • isVerbose

      public boolean isVerbose()
    • isInternalContour

      public boolean isInternalContour()
    • setInternalContour

      public void setInternalContour(boolean internalContour)
    • getFound

    • setVerbose

      public void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration)
      Specified by:
      setVerbose in interface VerbosePrint