Class FiducialDetectorPnP<T extends ImageBase<T>>

java.lang.Object
boofcv.abst.fiducial.FiducialDetectorPnP<T>
All Implemented Interfaces:
FiducialDetector<T>
Direct Known Subclasses:
CalibrationFiducialDetector, ECoCheck_to_FiducialDetector, MicroQrCodeDetectorPnP, QrCodeDetectorPnP, SquareBase_to_FiducialDetector, Uchiya_to_FiducialDetector

public abstract class FiducialDetectorPnP<T extends ImageBase<T>>
extends Object
implements FiducialDetector<T>

Provides everything you need to convert a image based fiducial detector into one which can estimate the fiducial's pose given control points. The camera pose is found using a solution to the Pose-N-Point (PnP) problem.

Stability is computed by perturbing each control point by the user provided amount of disturbance. The largest delta for location and orientation is then found and saved.

  • Field Details

  • Constructor Details

    • FiducialDetectorPnP

      public FiducialDetectorPnP()
  • Method Details

    • getSideWidth

      public abstract double getSideWidth​(int which)
      Width of the fiducial. used to compute stability
      Parameters:
      which - specifies which fiducial
      Returns:
      the width
    • getSideHeight

      public abstract double getSideHeight​(int which)
      Height of the fiducial. used to compute stability
      Parameters:
      which - specifies which fiducial
      Returns:
      the height
    • computeStability

      public boolean computeStability​(int which, double disturbance, FiducialStability results)
      Estimates the stability by perturbing each land mark by the specified number of pixels in the distorted image.
      Specified by:
      computeStability in interface FiducialDetector<T extends ImageBase<T>>
      Parameters:
      which - Index of which fiducial the stability is being requested from
      disturbance - Amount of the applied disturbance, in pixels. Try 0.25
      results - (output) Storage for stability metrics.
      Returns:
      true if successful or false if it failed for some reason
    • setLensDistortion

      public void setLensDistortion​(@Nullable @Nullable LensDistortionNarrowFOV distortion, int width, int height)
      Description copied from interface: FiducialDetector
      Specifies how to remove lens distortion from the input image and how to convert pixels into normalized image coordinates.
      Specified by:
      setLensDistortion in interface FiducialDetector<T extends ImageBase<T>>
      Parameters:
      distortion - Lens distortion model. null if you want to remove a lens distortion model that had previously been set.
      width - Input image's width.
      height - Input image's height
    • getLensDistortion

      @Nullable public @Nullable LensDistortionNarrowFOV getLensDistortion()
      Description copied from interface: FiducialDetector
      Returns the intrinsic parameters that it
      Specified by:
      getLensDistortion in interface FiducialDetector<T extends ImageBase<T>>
      Returns:
      intrinsic parameters
    • getFiducialToCamera

      public boolean getFiducialToCamera​(int which, Se3_F64 fiducialToCamera)
      Description copied from interface: FiducialDetector
      Used to retrieve the transformation from the fiducial's reference frame to the camera's reference frame.
      Specified by:
      getFiducialToCamera in interface FiducialDetector<T extends ImageBase<T>>
      Parameters:
      which - Fiducial's index
      fiducialToCamera - (output) Storage for the transform. modified.
      Returns:
      true if could estimate the location or false if it couldn't
    • estimatePose

      protected boolean estimatePose​(int which, List<Point2D3D> points, Se3_F64 fiducialToCamera)
      Given the mapping of 2D observations to known 3D points estimate the pose of the fiducial. This solves the P-n-P problem. Do a simple form of robust estimation. Prune points which are greater than 3 standard deviations and likely noise the recompute the pose
    • getDetectedControl

      public abstract List<PointIndex2D_F64> getDetectedControl​(int which)
      Returns a list of detected control points in the image for the specified fiducial. Observations will be in distorted image pixels.
    • getControl3D

      protected abstract List<Point2D3D> getControl3D​(int which)
      3D location of control points in the fiducial reference frame
      Returns:
      3D location of control points
    • is3D

      public boolean is3D()
      Description copied from interface: FiducialDetector
      If true then 3D information is available for the fiducial. In general a len distortion model must be provided by invoking FiducialDetector.setLensDistortion(LensDistortionNarrowFOV, int, int). The following functions are then enabled:
      1. FiducialDetector.computeStability(int, double, boofcv.abst.fiducial.FiducialStability)
      2. FiducialDetector.getFiducialToCamera(int, georegression.struct.se.Se3_F64)
      Specified by:
      is3D in interface FiducialDetector<T extends ImageBase<T>>