Class BaseDetectFiducialSquare<T extends ImageGray<T>>

java.lang.Object
boofcv.alg.fiducial.square.BaseDetectFiducialSquare<T>
All Implemented Interfaces:
VerbosePrint
Direct Known Subclasses:
DetectFiducialSquareBinary, DetectFiducialSquareHamming, DetectFiducialSquareImage

public abstract class BaseDetectFiducialSquare<T extends ImageGray<T>> extends Object implements VerbosePrint

Base class for square fiducial detectors. Searches for quadrilaterals inside the image with a black border and inner contours. It then removes perspective and lens distortion from the candidate quadrilateral and rendered onto a new image. The just mentioned image is then passed on to the class which extends this one. After being processed by the extending class, the corners are rotated to match and the 3D pose of the target found. Lens distortion is removed sparsely for performance reasons.

Must call configure(boofcv.alg.distort.LensDistortionNarrowFOV, int, int, boolean) before it can process an image.

Target orientation. Corner 0 = (-r,r), 1 = (r,r) , 2 = (r,-r) , 3 = (-r,-r).

  • Field Details

    • borderWidthFraction

      protected double borderWidthFraction
      How wide the border is relative to the fiducial's total width
  • Constructor Details

    • BaseDetectFiducialSquare

      protected BaseDetectFiducialSquare(InputToBinary<T> inputToBinary, DetectPolygonBinaryGrayRefine<T> squareDetector, boolean binaryCopy, double borderWidthFraction, double minimumBorderBlackFraction, int squarePixels, Class<T> inputType)
      Configures the detector.
      Parameters:
      inputToBinary - Converts input image into a binary image
      squareDetector - Detects the quadrilaterals in the image
      binaryCopy - If true a copy is created of the binary image and it's not modified.
      borderWidthFraction - Fraction of the fiducial's width that the border occupies. 0.25 is recommended.
      minimumBorderBlackFraction - Minimum fraction of pixels inside the border which must be black. Try 0.65
      squarePixels - Number of pixels wide the undistorted square image of the fiducial's interior is. This will include the black border.
      inputType - Type of input image it's processing
  • Method Details

    • configure

      public void configure(@Nullable @Nullable LensDistortionNarrowFOV distortion, int width, int height, boolean cache)
      Specifies the image's intrinsic parameters and target size
      Parameters:
      distortion - Lens distortion
      width - Image width
      height - Image height
      cache - If there's lens distortion should it cache the transforms? Speeds it up by about 12%. Ignored if no lens distortion
    • process

      public void process(T gray)
      Examines the input image to detect fiducials inside it
      Parameters:
      gray - Undistorted input image
    • computeFractionBoundary

      protected double computeFractionBoundary(float pixelThreshold)
      Computes the fraction of pixels inside the image border which are black
      Parameters:
      pixelThreshold - Pixel's less than this value are considered black
      Returns:
      fraction of border that's black
    • getFound

      public DogArray<FoundFiducial> getFound()
      Returns list of found fiducials
    • processSquare

      protected abstract boolean processSquare(GrayF32 square, BaseDetectFiducialSquare.Result result, double edgeInside, double edgeOutside)
      Processes the detected square and matches it to a known fiducial. Black border is included.
      Parameters:
      square - Image of the undistorted square
      result - Which target and its orientation was found
      edgeInside - Average pixel value along edge inside
      edgeOutside - Average pixel value along edge outside
      Returns:
      true if the square matches a known target.
    • setVerbose

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

      public GrayU8 getBinary()