Class TargetCalculations

java.lang.Object
org.photonvision.vision.target.TargetCalculations

public class TargetCalculations extends Object
  • Constructor Details

    • TargetCalculations

      public TargetCalculations()
  • Method Details

    • calculateYawPitch

      public static DoubleCouple calculateYawPitch(double offsetCenterX, double targetCenterX, double horizontalFocalLength, double offsetCenterY, double targetCenterY, double verticalFocalLength, CameraCalibrationCoefficients cameraCal)
      Calculates the yaw and pitch of a point in the image. Yaw and pitch must be calculated together to account for perspective distortion. Yaw is positive right, and pitch is positive up.
      Parameters:
      offsetCenterX - The X value of the offset principal point (cx) in pixels
      targetCenterX - The X value of the target's center point in pixels
      horizontalFocalLength - The horizontal focal length (fx) in pixels
      offsetCenterY - The Y value of the offset principal point (cy) in pixels
      targetCenterY - The Y value of the target's center point in pixels
      verticalFocalLength - The vertical focal length (fy) in pixels
      cameraCal - Camera calibration parameters, or null if not calibrated
      Returns:
      The yaw and pitch from the principal axis to the target center, in degrees.
    • calculateSkew

      public static double calculateSkew(boolean isLandscape, org.opencv.core.RotatedRect minAreaRect)
    • calculateTargetOffsetPoint

      public static org.opencv.core.Point calculateTargetOffsetPoint(boolean isLandscape, TargetOffsetPointEdge offsetRegion, org.opencv.core.RotatedRect minAreaRect)
    • calculateRobotOffsetPoint

      public static org.opencv.core.Point calculateRobotOffsetPoint(org.opencv.core.Point offsetPoint, org.opencv.core.Point camCenterPoint, DualOffsetValues dualOffsetValues, RobotOffsetPointMode offsetMode)
    • getAspectRatio

      public static double getAspectRatio(org.opencv.core.RotatedRect rect, boolean isLandscape)
    • calculateDualOffsetCrosshair

      public static org.opencv.core.Point calculateDualOffsetCrosshair(DualOffsetValues dualOffsetValues, double currentArea)
    • getLineFromPoints

      public static DoubleCouple getLineFromPoints(org.opencv.core.Point firstPoint, org.opencv.core.Point secondPoint)