Class BinaryEllipseDetector<T extends ImageGray<T>>

All Implemented Interfaces:

public class BinaryEllipseDetector<T extends ImageGray<T>> extends Object implements VerbosePrint
Detects ellipses inside gray scale images. The first step is to detect them in a binary image and then refine the fit using the gray scale image. Optionally the refinement step can be turned off or postponed until the user invokes it directly. False positives are pruned using the edge intensity check. This check removes ellipses with edges that are low intensity sicne they are most likely generated from noise.
  • Constructor Details

    • BinaryEllipseDetector

      public BinaryEllipseDetector(BinaryEllipseDetectorPixel ellipseDetector, @Nullable @Nullable SnapToEllipseEdge<T> ellipseRefiner, EdgeIntensityEllipse<T> intensityCheck, Class<T> inputType)
      Configures the detector
      ellipseDetector - Detector which uses pixel precise edges
      ellipseRefiner - Sub pixel edge refinement. If null the refinement step is skipped
      intensityCheck - Computes the intensity of the edge to remove false positives
      inputType - Input image type
  • Method Details

    • setLensDistortion

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

      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.

      distToUndist - Transform from distorted to undistorted image.
      undistToDist - Transform from undistorted to distorted image.
    • process

      public void process(T gray, GrayU8 binary)
      Detects ellipses inside the binary image and refines the edges for all detections inside the gray image
      gray - Grayscale image
      binary - Binary image of grayscale. 1 = ellipse and 0 = ignored background
    • refine

      public boolean refine(EllipseRotated_F64 ellipse)
      If auto refine is turned off an ellipse can be refined after the fact using this function, provided that the refinement algorithm was passed in to the constructor
      ellipse - The ellipse to be refined
      true if refine was successful or false if not
    • getEllipseDetector

      public BinaryEllipseDetectorPixel getEllipseDetector()
    • isAutoRefine

      public boolean isAutoRefine()
    • setAutoRefine

      public void setAutoRefine(boolean autoRefine)
    • getInputType

      public Class<T> getInputType()
    • getAllContours

      public List<ContourPacked> getAllContours()
    • getFound

      Returns all the found ellipses in the input image.

      WARNING: Returned data is recycled on the next call to process
      List of found ellipses.
    • getFoundEllipses

      public List<EllipseRotated_F64> getFoundEllipses(@Nullable @Nullable List<EllipseRotated_F64> storage)
    • setVerbose

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