Package ftclib.vision

Class FtcVisionAprilTag.DetectedObject

java.lang.Object
ftclib.vision.FtcVisionAprilTag.DetectedObject
All Implemented Interfaces:
TrcVisionTargetInfo.ObjectInfo
Enclosing class:
FtcVisionAprilTag

public static class FtcVisionAprilTag.DetectedObject extends Object implements TrcVisionTargetInfo.ObjectInfo
This class encapsulates info of the detected object. It extends TrcOpenCvDetector.DetectedObject that requires it to provide methods to return the detected object rect and area.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    org.firstinspires.ftc.vision.apriltag.AprilTagDetection
     
    double
     
    double
     
    double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DetectedObject(org.firstinspires.ftc.vision.apriltag.AprilTagDetection aprilTagDetection)
    Constructor: Creates an instance of the object.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.opencv.core.Rect
    getDetectedRect(org.firstinspires.ftc.vision.apriltag.AprilTagDetection at)
    This method calculates the rectangle of the detected AprilTag.
    double
    This method returns the area of the detected object.
    This method returns the real world depth of the detected object.
    This method returns the pose of the detected object relative to the camera.
    org.opencv.core.Rect
    This method returns the rect of the detected object.
    This method returns the real world width of the detected object.
    This method returns the object's pixel height.
    This method returns the object's pixel width.
    This method returns the object's rotated rectangle angle.
    org.opencv.core.Point[]
    This method returns the rotated rect vertices of the detected object.
    This method returns the string form of the target info.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • aprilTagDetection

      public org.firstinspires.ftc.vision.apriltag.AprilTagDetection aprilTagDetection
    • pixelWidth

      public double pixelWidth
    • pixelHeight

      public double pixelHeight
    • rotatedAngle

      public double rotatedAngle
  • Constructor Details

    • DetectedObject

      public DetectedObject(org.firstinspires.ftc.vision.apriltag.AprilTagDetection aprilTagDetection)
      Constructor: Creates an instance of the object.
      Parameters:
      aprilTagDetection - specifies the detected april tag object.
  • Method Details

    • getDetectedRect

      public static org.opencv.core.Rect getDetectedRect(org.firstinspires.ftc.vision.apriltag.AprilTagDetection at)
      This method calculates the rectangle of the detected AprilTag.
      Parameters:
      at - specifies the AprilTag info.
      Returns:
      AprilTag rectangle.
    • getObjectRect

      public org.opencv.core.Rect getObjectRect()
      This method returns the rect of the detected object.
      Specified by:
      getObjectRect in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      rect of the detected object.
    • getObjectArea

      public double getObjectArea()
      This method returns the area of the detected object.
      Specified by:
      getObjectArea in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      area of the detected object.
    • getPixelWidth

      public Double getPixelWidth()
      This method returns the object's pixel width.
      Specified by:
      getPixelWidth in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      object pixel width, null if not supported.
    • getPixelHeight

      public Double getPixelHeight()
      This method returns the object's pixel height.
      Specified by:
      getPixelHeight in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      object pixel height, null if not supported.
    • getRotatedAngle

      public Double getRotatedAngle()
      This method returns the object's rotated rectangle angle.
      Specified by:
      getRotatedAngle in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      rotated rectangle angle.
    • getObjectPose

      public TrcPose2D getObjectPose()
      This method returns the pose of the detected object relative to the camera.
      Specified by:
      getObjectPose in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      pose of the detected object relative to camera.
    • getObjectWidth

      public Double getObjectWidth()
      This method returns the real world width of the detected object.
      Specified by:
      getObjectWidth in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      real world width of the detected object.
    • getObjectDepth

      public Double getObjectDepth()
      This method returns the real world depth of the detected object.
      Specified by:
      getObjectDepth in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      real world depth of the detected object.
    • getRotatedRectVertices

      public org.opencv.core.Point[] getRotatedRectVertices()
      This method returns the rotated rect vertices of the detected object.
      Specified by:
      getRotatedRectVertices in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      rotated rect vertices.
    • toString

      @NonNull public String toString()
      This method returns the string form of the target info.
      Overrides:
      toString in class Object
      Returns:
      string form of the target info.