Class DetectFiducialSquareImage<T extends ImageGray<T>>

All Implemented Interfaces:

public class DetectFiducialSquareImage<T extends ImageGray<T>>
extends BaseDetectFiducialSquare<T>

Fiducial which uses images to describe arbitrary binary patterns. When useing this fiducial it's up to the user to select good images which will provide unique orientation and are easily distinguished against other patterns and noise insensitive.

The above image visually shows the fiducials internal coordinate system. The center of the fiducial is the origin of the coordinate system, e.g. all sides are width/2 distance away from the origin. +x is to the right, +y is up , and +z out of the paper towards the viewer.

A good pattern will have thick lines or thick shapes. When detecting the image it's not uncommon for the distortion removal to be off by one or two pixels. So think lines are be completely out of synch. The image should also be chosen so that there is to rotational ambiguity. A perfect circle in the center is an example of a bad fiducial in which orientation can't be uniquely determined.

  • Constructor Details

    • DetectFiducialSquareImage

      public DetectFiducialSquareImage​(InputToBinary<T> inputToBinary, DetectPolygonBinaryGrayRefine<T> quadDetector, double borderWidthFraction, double minimumBlackBorderFraction, double matchThreshold, Class<T> inputType)
      Configures the fiducial detector
      matchThreshold - Considered a match if the hamming distance is less than this fraction of the maximum
  • Method Details

    • addPattern

      public int addPattern​(GrayU8 inputBinary, double lengthSide)
      Adds a new image to the detector. Image must be gray-scale and is converted into a binary image using the specified threshold. All input images are rescaled to be square and of the appropriate size. Thus the original shape of the image doesn't matter. Square shapes are highly recommended since that's what the target looks like.
      inputBinary - Binary input image pattern. 0 = black, 1 = white.
      lengthSide - How long one of the sides of the target is in world units.
      The ID of the provided image
    • binaryToDef

      protected static void binaryToDef​(GrayU8 binary, short[] desc)
      Converts a binary image into the compressed bit format
    • processSquare

      protected boolean processSquare​(GrayF32 gray, BaseDetectFiducialSquare.Result result, double edgeInside, double edgeOutside)
      Description copied from class: BaseDetectFiducialSquare
      Processes the detected square and matches it to a known fiducial. Black border is included.
      Specified by:
      processSquare in class BaseDetectFiducialSquare<T extends ImageGray<T>>
      gray - 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
      true if the square matches a known target.
    • hamming

      protected int hamming​(short[] a, short[] b)
      Computes the hamming score between two descriptions. Larger the number better the fit
    • getTargets