Package frclib.vision

Class FrcOpenCvAprilTagPipeline.DetectedObject

java.lang.Object
trclib.vision.TrcOpenCvDetector.DetectedObject<edu.wpi.first.apriltag.AprilTagDetection>
frclib.vision.FrcOpenCvAprilTagPipeline.DetectedObject
All Implemented Interfaces:
TrcVisionTargetInfo.ObjectInfo
Enclosing class:
FrcOpenCvAprilTagPipeline

public static class FrcOpenCvAprilTagPipeline.DetectedObject extends TrcOpenCvDetector.DetectedObject<edu.wpi.first.apriltag.AprilTagDetection>
This class encapsulates info of the detected object. It extends TrcOpenCvDetector.DetectedObject that requires it to provide a method to return the detected object rect and area.
  • Field Details

    • pixelWidth

      public final double pixelWidth
    • pixelHeight

      public final double pixelHeight
    • rotatedAngle

      public final double rotatedAngle
  • Constructor Details

    • DetectedObject

      public DetectedObject(String label, edu.wpi.first.apriltag.AprilTagDetection aprilTagInfo)
      Constructor: Creates an instance of the object.
      Parameters:
      aprilTagInfo - specifies the detected april tag info.
  • Method Details

    • getDetectedRect

      public static org.opencv.core.Rect getDetectedRect(edu.wpi.first.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.
      Returns:
      rect of the detected object.
    • getObjectArea

      public double getObjectArea()
      This method returns the area of the detected object.
      Returns:
      area of the detected object.
    • getPixelWidth

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

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

      public Double getRotatedAngle()
      This method returns the object's rotated rectangle angle.
      Returns:
      rotated rectangle angle.
    • getObjectPose

      public TrcPose2D getObjectPose()
      This method returns the pose of the detected object relative to the camera.
      Returns:
      pose of the detected object relative to camera.
    • getObjectWidth

      public Double getObjectWidth()
      This method returns the objects real world width.
      Returns:
      object real world width, null if not supported.
    • getObjectDepth

      public Double getObjectDepth()
      This method returns the objects real world depth.
      Returns:
      object real world depth, null if not supported.
    • getRotatedRectVertices

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

      public String toString()
      This method returns the string form of the target info.
      Overrides:
      toString in class TrcOpenCvDetector.DetectedObject<edu.wpi.first.apriltag.AprilTagDetection>
      Returns:
      string form of the target info.